如何从源代码构建调试符号?

huangapple go评论67阅读模式
英文:

How to build debug symbols from source?

问题

我想使用Kdump和Crash来调试我的内核。然而,我的内核是从源代码构建的。我无法通过apt-get install linux-image-$(uname -r)-dbg获取调试符号。我应该如何从源代码构建-dbg版本?

我的操作系统是Ubuntu 20.04,内核版本是v5.15.0。

英文:

I want to use Kdump and Crash to debug my kernel. However, my kernel was built from source. I can't get debug symbols through apt-get install linux-image-$(uname -r)-dbg. How could I build -dbg from source?

My OS is Ubuntu 20.04 and kernel is v5.15.0.

答案1

得分: 1

你可以通过启用 CONFIG_DEBUG_INFO 轻松编译内核并包含调试符号。如果你正在使用 make menuconfig,它将位于“Kernel hacking” -> “Compile-time checks and compiler options” -> “Compiler a kernel with debug info” 下。

如果你想将调试符号拆分到不同的 .dwo 文件中,还可以启用 CONFIG_DEBUG_INFO_SPLIT(在相同的菜单位置)。这应该与 linux-image-$(uname -r)-dbg 软件包包含的内容差不多。

英文:

You can easily compile the kernel with debug symbols by enabling CONFIG_DEBUG_INFO. If you are using make menuconfig it's going to be under "Kernel hacking" -> "Compile-time checks and compiler options" -> "Compiler a kernel with debug info".

If you want to have the debug symbols split in a different .dwo file you can also enable CONFIG_DEBUG_INFO_SPLIT (same location in the menu). This should be more or less the same thing that the linux-image-$(uname -r)-dbg package contains.

huangapple
  • 本文由 发表于 2023年6月18日 20:55:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76500644.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定