Symbol tables for separately linked pieces

Andrew STUBBS andrew.stubbs@st.com
Thu Jul 10 14:58:00 GMT 2008


Paul Koning wrote:
> 1. When debugging in the subsystem, have its symbol table loaded "on
>    top" -- so any name lookups are resolved first from that symbol
>    table and only after that from the other (main program) table.

> 2. When I switch to debugging in the main program, I want to be able
>    to tell GDB to deactivate the subsystem symbol table temporarily
>    (or perhaps better yet, keep it around "on the bottom") so a
>    name that exists in both is now resolved from the main program.

It's easy enough to switch between two sets of symbols using the 
symbol-file command:

   (gdb) symbol-file a.elf
   ....
   (gdb) symbol-file b.elf
   ....

The symbol-file command throws away all previous symbols (including 
those from add-symbol-file), and loads new ones. This way there never 
are any duplicate symbols to get in the way.

This solution is less satisfactory when the context change occurs 
frequently, so I've been wondering if there would be a better way to do 
it myself. Some sort of context sensitive thing maybe (select symbols 
from the same source as the current function symbol), or perhaps 
explicitly by name ("break a.elf:main").

Andrew



More information about the Gdb mailing list