gdb add-symbol-file命令

来源:互联网 发布:命令行中mysql 删除表 编辑:程序博客网 时间:2024/06/06 01:46
origin: http://www.delorie.com/gnu/docs/gdb/gdb_125.html
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 tableinformation from the filefilename. You would use this commandwhen filename has been dynamically loaded (by some other means)into the program that is running.address should be the memoryaddress at which the file has been loaded; GDB cannot figurethis out for itself. You can additionally specify an arbitrary numberof`-ssection address' pairs, to give an explicitsection name and base address for that section. You can specify anyaddress as an expression.

The symbol table of the file filename is added to the symbol tableoriginally read with thesymbol-file command. You can use theadd-symbol-file command any number of times; the new symbol datathus read keeps adding to the old. To discard all old symbol datainstead, use thesymbol-file command without any arguments.

Althoughfilename is typically a shared library file, anexecutable file, or some other object file which has been fullyrelocated for loading into a process, you can also load symbolicinformation from relocatable`.o' files, as long as:

  • the file's symbolic information refers only to linker symbols defined inthat file, not to symbols defined by other object files,
  • every section the file's symbolic information refers to has actuallybeen loaded into the inferior, as it appears in the file, and
  • you can determine the address at which every section was loaded, andprovide these to theadd-symbol-file command.

Some embedded operating systems, like Sun Chorus and VxWorks, can loadrelocatable files into an already running program; such systemstypically make the requirements above easy to meet. However, it'simportant to recognize that many native systems use complex linkprocedures (.linkonce section factoring and C++ constructor tableassembly, for example) that make the requirements difficult to meet. Ingeneral, one cannot assume that usingadd-symbol-file to read arelocatable object file's symbolic information will have the same effectas linking the relocatable object file into the program in the normalway.

add-symbol-file does not repeat if you press RET after using it.

You can use the `-mapped' and `-readnow' options just as withthesymbol-file command, to change how GDB manages the symboltable information forfilename.


原创粉丝点击