Virtualbox + kgdb: Can't see vmlinux symbols
I have an Ubuntu 16.04 VM running in Virtualbox. I'm building kernel from git using make deb-pkg. After I install all the deb packages (including debug symbols) on the VM and restart it, I can see in uname -r output that the appropriate kernel was booted from. I'm passing the following parameters to the kernel:
kgdboc=ttyS0,115200 kgdbwait
Once the kernel boots, I am able to connect to it via socat + gdb from host. I'm using the full uncompressed vmlinux file to start the gdb which contains all the debugging symbols. However, I can't see any of the symbols in backtrace etc.
$ du -sh vmlinux 425M vmlinux $ gdb vmlinux GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later [gnu.org] [...] For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from vmlinux...done. (gdb) target remote /dev/pts/2 Remote debugging using /dev/pts/2 0xffffffffb113c5b4 in ?? () (gdb) bt #0 0xffffffffb113c5b4 in ?? () #1 0xffffb035421c7dd0 in ?? () #2 0xffffffffb113c60c in ?? () #3 0xffffb035421c7e00 in ?? () #4 0xffffffffb153035a in ?? () #5 0x0000000000000002 in irq_stack_union () #6 0x00000000013a7408 in ?? () #7 0xffff8fb8bd0d3b00 in ?? () #8 0xffffb035421c7e18 in ?? () #9 0xffffffffb15307df in ?? () #10 0xffff8fb8b8779900 in ?? () #11 0xffffb035421c7e38 in ?? () #12 0xffffffffb12ab412 in ?? () #13 0xffff8fb8bd0d3b00 in ?? ()
Any ideas what am I doing wrong? Thanks, Kamran.
This is happening only with kernel 4.8+. When I compile kernel 4.4 with a stock Ubuntu Xenial .config, symbols appear just fine. When I compile kernel 4.8/4.10 with Yakkety/Zesty stock configs the symbols disappear. On Wed, Jun 14, 2017 at 4:58 PM, Kamran Khan <krkhan@inspirated.com> wrote:
I have an Ubuntu 16.04 VM running in Virtualbox.
I'm building kernel from git using make deb-pkg.
After I install all the deb packages (including debug symbols) on the VM and restart it, I can see in uname -r output that the appropriate kernel was booted from.
I'm passing the following parameters to the kernel:
kgdboc=ttyS0,115200 kgdbwait
Once the kernel boots, I am able to connect to it via socat + gdb from host.
I'm using the full uncompressed vmlinux file to start the gdb which contains all the debugging symbols.
However, I can't see any of the symbols in backtrace etc.
$ du -sh vmlinux 425M vmlinux $ gdb vmlinux GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later [gnu.org] [...] For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from vmlinux...done. (gdb) target remote /dev/pts/2 Remote debugging using /dev/pts/2 0xffffffffb113c5b4 in ?? () (gdb) bt #0 0xffffffffb113c5b4 in ?? () #1 0xffffb035421c7dd0 in ?? () #2 0xffffffffb113c60c in ?? () #3 0xffffb035421c7e00 in ?? () #4 0xffffffffb153035a in ?? () #5 0x0000000000000002 in irq_stack_union () #6 0x00000000013a7408 in ?? () #7 0xffff8fb8bd0d3b00 in ?? () #8 0xffffb035421c7e18 in ?? () #9 0xffffffffb15307df in ?? () #10 0xffff8fb8b8779900 in ?? () #11 0xffffb035421c7e38 in ?? () #12 0xffffffffb12ab412 in ?? () #13 0xffff8fb8bd0d3b00 in ?? ()
Any ideas what am I doing wrong?
Thanks, Kamran.
On Fri, 16 Jun 2017 13:24:58 -0700, Kamran Khan said:
This is happening only with kernel 4.8+.
When I compile kernel 4.4 with a stock Ubuntu Xenial .config, symbols appear just fine.
When I compile kernel 4.8/4.10 with Yakkety/Zesty stock configs the symbols disappear.
What happens when you try to compile 4.8/r.10 with a Xenial .config? I'm willing to bet the problem is that the Xenial config turns on symbols and Yakkety/Zesty disable them by default. See these for further info: CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_REDUCED=y CONFIG_DEBUG_INFO_SPLIT=y It appears that you'll need DEBUG_INFO_REDUCED=n for kgdb to work properly.
The debug symbols are on for all of them, and gdb *does* load the symbols. I have a suspicion that KASLR that was introduced around 4.7 might be the culprit here. CONFIG_RANDOMIZE_MEMORY is an option that's not present in the Xenial config. Anyone here has attached kgdb to 4.8/4.10? Thanks, Kamran. On Fri, Jun 16, 2017 at 1:41 PM, <valdis.kletnieks@vt.edu> wrote:
On Fri, 16 Jun 2017 13:24:58 -0700, Kamran Khan said:
This is happening only with kernel 4.8+.
When I compile kernel 4.4 with a stock Ubuntu Xenial .config, symbols appear just fine.
When I compile kernel 4.8/4.10 with Yakkety/Zesty stock configs the symbols disappear.
What happens when you try to compile 4.8/r.10 with a Xenial .config?
I'm willing to bet the problem is that the Xenial config turns on symbols and Yakkety/Zesty disable them by default.
See these for further info:
CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_REDUCED=y CONFIG_DEBUG_INFO_SPLIT=y
It appears that you'll need DEBUG_INFO_REDUCED=n for kgdb to work properly.
Disabling CONFIG_RANDOMIZE_MEMORY did not help. Disabled CONFIG_RANDOMIZE_BASE as well and the symbols came up. The weird thing is that CONFIG_RANDOMIZE_BASE is enabled on Xenial (4.4) kernel as well, but somehow having it enabled on Zesty (4.10) kernel throws off kgdb. Thanks, Kamran. On Fri, Jun 16, 2017 at 3:02 PM, Kamran Khan <krkhan@inspirated.com> wrote:
The debug symbols are on for all of them, and gdb *does* load the symbols. I have a suspicion that KASLR that was introduced around 4.7 might be the culprit here. CONFIG_RANDOMIZE_MEMORY is an option that's not present in the Xenial config.
Anyone here has attached kgdb to 4.8/4.10?
Thanks, Kamran.
On Fri, Jun 16, 2017 at 1:41 PM, <valdis.kletnieks@vt.edu> wrote:
On Fri, 16 Jun 2017 13:24:58 -0700, Kamran Khan said:
This is happening only with kernel 4.8+.
When I compile kernel 4.4 with a stock Ubuntu Xenial .config, symbols appear just fine.
When I compile kernel 4.8/4.10 with Yakkety/Zesty stock configs the symbols disappear.
What happens when you try to compile 4.8/r.10 with a Xenial .config?
I'm willing to bet the problem is that the Xenial config turns on symbols and Yakkety/Zesty disable them by default.
See these for further info:
CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_REDUCED=y CONFIG_DEBUG_INFO_SPLIT=y
It appears that you'll need DEBUG_INFO_REDUCED=n for kgdb to work properly.
participants (2)
-
Kamran Khan -
valdis.kletnieks@vt.edu