Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Gdb + kvm debug kernel

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Compile the kernel

Modify Makefile to-O1 or-O0

Ifdef CONFIG_PROFILE_ALL_BRANCHES

KBUILD_CFLAGS + =-O1 $(call cc-disable-warning,maybe-uninitialized,)

Else

KBUILD_CFLAGS + =-O1

Endif

Modify virtual machine xml file

.

Start the virtual machine

Id=balloon0,bus=pci.0,addr=0x9-S-gdb tcp::1234-msg timestamp=on

Create a directory on the host, and copy the kernel files to be debugged to that directory, such as:

Vmlinuz-4.14.0-generic

Vmlinuz-4.14.0-generic: x86 boot sector

4. Start gdb

Gdb vmlinuz-4.14.0-generic

(gdb) target remote 127.0.0.1 purl 1234

Remote debugging using 127.0.0.1:1234

Compile kvm

1. Enter the directory where kvm is located

Linux-4.14/arch/x86/kvm

two。 Execute compilation command

Make CONFIG_KVM=m CONFIG_INTEL_KVM=m-C / vms/kernel4.14/linux-4.14 M=$PWD modules

The path where the / vms/kernel4.14/linux-4.14 kernel is located

The path where M=$PWD kvm is located

Enter the kernel code directory

Make CONFIG_KVM=m CONFIG_INTEL_KVM=m-C / vms/kernel4.14/linux-4.14 M=/vms/kernel4.14/linux-4.14/arch/x86/kvm modules

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report