Debugging symbols contain source code level information such as function names, function calling conventions, and source line numbers to instructions mapping. This information is very useful when debugging or profiling the kernel. In this article, I will show how to get debugging symbols on Ubuntu with any kernel.
There are two ways to get the debugging symbols. Either build the source code of the kernel with debugging symbols or install the symbols separately. The first approach is followed when you want to modify the source code and work on your own kernel. Otherwise, you can follow the simpler second approach. Even if you need the source code (to step through it during debugging, for example), you can still follow the second approach by downloading the source code and point the tool you’re using to the containing directory. You don’t have to build it. I will discuss the second approach here.
Step 1: GPG key import
Make sure that you have the GPG key of your system. For Ubuntu 16.04 and higher:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C8CAB6595FDFF622
For older distributions:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01
Step 2: Add repository config
codename=$(lsb_release -c | awk '{print $2}') sudo tee /etc/apt/sources.list.d/ddebs.list << EOF deb http://ddebs.ubuntu.com/ ${codename} main restricted universe multiverse deb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiverse deb http://ddebs.ubuntu.com/ ${codename}-updates main restricted universe multiverse deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverse EOF
Step 3: Update packages
sudo apt-get update
Step 4: Download and install the debugging symbols
sudo apt-get install linux-image-$(uname -r)-dbgsym
Step 5: Verify that the symbols have been successfully downloaded
The file that contains debugging information is called vmlinux-XXX-debug where XXX is the kernel version. The file is stored under /usr/lib/debug/boot.
Pingback: The Art of Profiling Using Intel VTune Amplifier, Part 1 | Micromysteries
Pingback: Kdump in ubuntu 18.04 ARM64 | richliu's blog
How do I do this on a ubuntu machine running a different kernel (and a different architecture) from the kernel of interest? I run a guest ubuntu under QEMU, and on the host want to get the guest’s dbg sysms, not the host’s.
Pingback: Ubuntu 21.10 安装调试符号 - 谭汇标博客
Pingback: SystemTap – Note