- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
如何在 gdb
中加载多个符号文件。我有一个可执行文件 foo.out 并加载了一个模块 bar.so。我创建了两个符号文件 foo.symbol 和 bar.symbol。如何将这两个文件加载到 gdb 中。
# gdb --core core
# (gdb)
# (gdb) symbol-file foo.symbol
如何加载第二个符号文件。或者有没有办法加载gdb
最佳答案
设置包含符号文件的目录使用
set debug-file-directory <directory>
和使用
show debug-file-directory
显示当前设置为包含符号文件的目录。
如果二进制文件根据调试链接提供符号文件的名称(不带路径),则符号文件会自动从该目录中读取。
要添加其他符号,您可以使用 add-symbol-file
。
(因为 gdb onlinedocs 现在我在这里引用它似乎不可用)
add-symbol-file filename address
add-symbol-file filename address [ -readnow ] [ -mapped ]
add-symbol-file filename -ssection address ...
The add-symbol-file command reads additional symbol table information from the file filename. You would use this command when filename has been dynamically loaded (by some other means) into the program that is running. address should be the memory address at which the file has been loaded; gdb cannot figure this out for itself. You can additionally specify an arbitrary number of `-ssection address' pairs, to give an explicit section name and base address for that section. You can specify any address as an expression.
The symbol table of the file filename is added to the symbol table originally read with the symbol-file command. You can use the add-symbol-file command any number of times; the new symbol data thus read keeps adding to the old. To discard all old symbol data instead, use the symbol-file command without any arguments.
Although filename is typically a shared library file, an executable file, or some other object file which has been fully relocated for loading into a process, you can also load symbolic information from relocatable .o files, as long as:
- the file's symbolic information refers only to linker symbols defined in that file, not to symbols defined by other object files,
- every section the file's symbolic information refers to has actually been loaded into the inferior, as it appears in the file, and
- you can determine the address at which every section was loaded, and provide these to the add-symbol-file command.
Some embedded operating systems, like Sun Chorus and VxWorks, can load relocatable files into an already running program; such systems typically make the requirements above easy to meet. However, it's important to recognize that many native systems use complex link procedures (.linkonce section factoring and C++ constructor table assembly, for example) that make the requirements difficult to meet. In general, one cannot assume that using add-symbol-file to read a relocatable object file's symbolic information will have the same effect as linking the relocatable object file into the program in the normal way.
add-symbol-file does not repeat if you press after using it.
You can use the
-mapped' and
-readnow' options just as with the symbol-file command, to change how gdb manages the symbol table information for filename.
关于c - 如何在gdb中加载多个符号文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20380204/
我正在开发一个需要能够平均三个数字的 Facebook 应用程序。但是,它总是返回 0 作为答案。这是我的代码: $y = 100; $n = 250; $m = 300; $number = ($y
我只是无法弄清楚这一点,也找不到任何对我来说有意义的类似问题。我的问题:我从数据库中提取记录,并在我的网页上以每个面板 12 条的倍数显示它们。因此,我需要知道有多少个面板可以使用 JavaScrip
我是一名优秀的程序员,十分优秀!