如何从给定路径(包括子目录)递归加载所有符号文件?

时间:2021-05-14 07:08:00

You can point a single symbol file to gdb with command the:

您可以使用以下命令将单个符号文件指向gdb:

symbol-file /usr/lib/debug/symbolfile.so

But how to tell gdb to load all symbol-files from given path including subdirectories?

但是如何告诉gdb从包含子目录的给定路径加载所有符号文件?

3 个解决方案

#1


2  

On a Linux system, you should never have to use symbol-file GDB command in the first place.

在Linux系统上,您不应该首先使用符号文件GDB命令。

The trick is to prepare your binaries in such a way that GDB will find the symbol file automatically. This is surprisingly easy to do. Detailed instructions are here.

诀窍是以这样的方式准备二进制文件,即GDB将自动找到符号文件。这非常容易做到。详细说明在这里。

#2


0  

Use following command: set solib-search-path path

使用以下命令:set solib-search-path path

#3


0  

The solution is to add-symbol-file. For instance, if symbol file is called lib.out:

解决方案是添加符号文件。例如,如果符号文件被称为lib.out:

add-symbol-file lib.out 0

This is particularly useful on embedded system where application developers use a library stored in ROM. The debugger needs the symbol file to reconstruct the stack if execution stops in the middle of a library function call. This works even if the library was generated on a separate system to which the developers have no access.

这在嵌入式系统上特别有用,其中应用程序开发人员使用存储在ROM中的库。如果执行在库函数调用的中间停止,则调试器需要符号文件来重建堆栈。即使库是在开发人员无法访问的单独系统上生成的,这也可以工作。

#1


2  

On a Linux system, you should never have to use symbol-file GDB command in the first place.

在Linux系统上,您不应该首先使用符号文件GDB命令。

The trick is to prepare your binaries in such a way that GDB will find the symbol file automatically. This is surprisingly easy to do. Detailed instructions are here.

诀窍是以这样的方式准备二进制文件,即GDB将自动找到符号文件。这非常容易做到。详细说明在这里。

#2


0  

Use following command: set solib-search-path path

使用以下命令:set solib-search-path path

#3


0  

The solution is to add-symbol-file. For instance, if symbol file is called lib.out:

解决方案是添加符号文件。例如,如果符号文件被称为lib.out:

add-symbol-file lib.out 0

This is particularly useful on embedded system where application developers use a library stored in ROM. The debugger needs the symbol file to reconstruct the stack if execution stops in the middle of a library function call. This works even if the library was generated on a separate system to which the developers have no access.

这在嵌入式系统上特别有用,其中应用程序开发人员使用存储在ROM中的库。如果执行在库函数调用的中间停止,则调试器需要符号文件来重建堆栈。即使库是在开发人员无法访问的单独系统上生成的,这也可以工作。