ILD

build kernel with debug info in object file
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2023-12-9 站点:Inside Linux Development

最近在移植zynqmpsoc, 是6.1.0的内核,编译个内核模块后,出现了kernel panic,反汇编的时候,提示没有符号信息:

$ ~/toolchain/crosstool-mpsoc/bin/aarch64-linux-gnu-gdb vdma_function.o

GNU gdb (crosstool-NG 1.26.0) 13.2

Copyright (C) 2023 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-build_pc-linux-gnu --target=aarch64-linux-gnu".

Type "show configuration" for configuration details.

For bug reporting instructions, please see:

<https://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 vdma_function.o...

(No debugging symbols found in vdma_function.o)

(gdb) l *(of_vdma_data+0x360)

No symbol table is loaded.  Use the "file" command.

(gdb) 


原来是debug information选择成了关闭

 │     -> Kernel hacking                                                                                                                                                                                         

 │       -> Compile-time checks and compiler options                                                                                                                                         

 │         -> Debug information (<choice> [=y])  


选择第二个Rely on the toolchain's implicit default DWARF verion即可。

+CONFIG_DEBUG_INFO=y

 CONFIG_AS_HAS_NON_CONST_LEB128=y

-CONFIG_DEBUG_INFO_NONE=y

-# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set

+# CONFIG_DEBUG_INFO_NONE is not set

+CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y

 # CONFIG_DEBUG_INFO_DWARF4 is not set

 # CONFIG_DEBUG_INFO_DWARF5 is not set

+# CONFIG_DEBUG_INFO_REDUCED is not set

+# CONFIG_DEBUG_INFO_COMPRESSED is not set

+# CONFIG_DEBUG_INFO_SPLIT is not set

+# CONFIG_GDB_SCRIPTS is not set


Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.