cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rwk
Visitor
Visitor
685 Views
Registered: ‎06-18-2018

[GDB] Linux kernel image (vmlinux) built with PetaLinux is missing symbols

Hello.

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 :

build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/linux-xlnx/4.19-xilinx-v2019.2+gitAUTOINC+b983d5fd71-r0/linux-plnx_zynq7-standard-build/.config

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 :

  • Cleaning the project with : 
    petalinux-build -x mrproper --force
    petalinux-package --prebuilt --clean
  • Checking that the configuration is correct with :
    petalinux-config -c kernel
  • Building with :
    petalinux-build
    petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot --force
    petalinux-package --prebuilt --fpga images/linux/system.bit --force

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.

 

 

Regards.
Rick

0 Kudos
Reply
1 Reply
rwk
Visitor
Visitor
667 Views
Registered: ‎06-18-2018

I found out what was missing thanks to this document :

https://www.xilinx.com/support/answers/66853.html 

[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.

 

Regards,
Rick

0 Kudos
Reply