Next: Symbol Errors, Previous: Separate Debug Files, Up: GDB Files
When gdb finds a symbol file, it scans the symbols in the file in order to construct an internal symbol table. This lets most gdb operations work quickly—at the cost of a delay early on. For large programs, this delay can be quite lengthy, so gdb provides a way to build an index, which speeds up startup.
The index is stored as a section in the symbol file. gdb can write the index to a file, then you can put it into the symbol file using objcopy.
To create an index file, use the save gdb-index
command:
save gdb-index
directoryOnce you have created an index file you can merge it into your symbol file, here named symfile, using objcopy:
$ objcopy --add-section .gdb_index=symfile.gdb-index \ --set-section-flags .gdb_index=readonly symfile symfile
There are currently some limitation on indices. They only work when for DWARF debugging information, not stabs. And, they do not currently work for programs using Ada.