7

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

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

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

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
user44556
  • 5,763
  • 5
  • 30
  • 27

3 Answers3

2

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

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.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Well, lets assume I don't compile anything myself. For example after apt-get install libc-dbg. Should I move installed debug package by copying it somewhere before debugging? – user44556 May 17 '10 at 05:52
  • Executing "apt-get install libc-dbg" should allow you to debug libc in GDB *without* any additional symbol-file commands. If it doesn't, then either you have a broken .gdbinit (most likely), a broken GDB, or a broken libc-dbg. I suggest you edit your question and provide as many details as possible, including what packages are installed and what they contain, as well as output from your actual GDB session with "gdb -nx -ex 'set verbose on' ./a.out". – Employed Russian May 17 '10 at 18:17
0

Use following command: set solib-search-path path

0

The solution is to add-symbol-file. For instance, if symbol file is called 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.

Fuujuhi
  • 313
  • 3
  • 8