03-31-2020 04:59 AM
I am following the documentation in UG1144 (v2019.2) chapter 9 Debugging - Debugging the Linux Kernel in QEMU.
When I load the vmlinux image with GDB I get :
user@host:/opt/pkg/projects/test_petalinux/images/linux$ petalinux-util --gdb vmlinux environment: line 292: get_subsystem: command not found GNU gdb (Linaro GDB 2019.03) 8.2 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-none-eabi". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from vmlinux...(no debugging symbols found)...done.
With the last line telling me that no debugging symbols were found, the documentation example shows the expected output :
... Reading symbols from vmlinux...done.
I have set the correct option in the kernel configuration menu (petalinux-config --kernel → Kernel hacking → Kernel debugging) it is active, this was verified by checking the .config file in :
It has the following options, with the CONFIG_DEBUG_KERNEL=y :
# # printk and dmesg options # # CONFIG_PRINTK_TIME is not set CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 CONFIG_CONSOLE_LOGLEVEL_QUIET=4 CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_BOOT_PRINTK_DELAY is not set # # Compile-time checks and compiler options # # CONFIG_DEBUG_INFO is not set CONFIG_ENABLE_MUST_CHECK=y CONFIG_FRAME_WARN=1024 # CONFIG_STRIP_ASM_SYMS is not set # CONFIG_READABLE_ASM is not set # CONFIG_UNUSED_SYMBOLS is not set # CONFIG_PAGE_OWNER is not set # CONFIG_DEBUG_FS is not set # CONFIG_HEADERS_CHECK is not set # CONFIG_DEBUG_SECTION_MISMATCH is not set CONFIG_SECTION_MISMATCH_WARN_ONLY=y # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set # CONFIG_MAGIC_SYSRQ is not set CONFIG_DEBUG_KERNEL=y
What I have tried :
The resulting images (vmlinux) still have no symbols
petalinux-util --gdb images/linux/vmlinux ... Reading symbols from images/linux/vmlinux...(no debugging symbols found)...done.
petalinux-util --gdb build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.19-xilinx-v2019.2+gitAUTOINC+b983d5fd71-r0/linux-plnx_zynq7-standard-build/vmlinux ... Reading symbols from build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.19-xilinx-v2019.2+gitAUTOINC+b983d5fd71-r0/linux-plnx_zynq7-standard-build/vmlinux...(no debugging symbols found)...done.
Either the option is not taken into account somewhere, either the symbols are stripped at some stage.
Thank you for your help !
If there is a solution, it may be good to update UG1144 with a another tip, because the current tip :
"TIP: It may be helpful to enable kernel debugging in the kernel configuration menu (petalinux-config --kernel →
Kernel hacking → Kernel debugging), so that kernel debug symbols are present in the image."
Did not help me get the symbols.
03-31-2020 06:04 AM
I found out what was missing thanks to this document :
[SOLUTION] I was missing the option in :
petalinux-config -c kernel → Kernel hacking → Compile-time checks and compiler options → Compile the kernel with debug info
Setting this option resulted in the generation of the Linux Kernel image (vmlinux) with symbols and gdb did load them correctly
petalinux-util --gdb images/linux/vmlinux ... Reading symbols from images/linux/vmlinux...done.
I hope this can help other people stumbling on this while following UG1144.