Automatically load symbols for a subset of libs?

Sysprogs forums Forums VisualGDB Automatically load symbols for a subset of libs?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20847
    BitFlipper
    Participant

    Hi,

    The app I’m debugging uses a lot of libraries and hence startup is slow due to GDB loading a lot of symbols. I can speed up startup by adding “set auto-solib-add off” into “Additional GDB Commands > …before selecting a target“.

    However the above of course disables auto symbol loading, which is correct. So to now load the symbols for a subset of libraries, I need to manually run the following command:

    > sharedlibrary libfoo.so\|libbar.so

    …which works but I would really like to have this run automatically every time I start debugging. If I add this into the “…before selecting a target” or “…after selecting a target” set of commands, in both cases GDB says “No loaded shared libraries match the pattern ‘sharedlibrary libfoo.so\|libbar.so'”. So this is too early.

    It should be executed after VGDB sets the breakpoint on main/exec-run/removes breakpoint. Is there a way to auto execute custom GDB commands at this point? Or some other way to auto load only a subset of symbols?

    Thanks in advance for any help with this!

    #20850
    support
    Keymaster

    Hi,

    Sorry, VisualGDB doesn’t provide any hooks that are executed when a library is loaded, however you can work around this as follows:

    • If you are debugging directly on the target, simply strip the symbol information from the libraries you don’t want to debug using the strip command (make backups in case you need the debug information later).
    • If you are debugging with a gdbserver, setup a directory on the gdb machine with the symbols you want to load (copy the updated symbol files there via custom actions) and ensure no other symbol files get there. Then replace the solib search path by with a path consisting of only that directory. Hence gdb will locate the libraries you want to debug and will skip the rest.

    You can also try indexing your symbols as described here, although in our tests we couldn’t get any significant performance improvement, so we decided not to do it automatically.

    #20852
    BitFlipper
    Participant

    The project is already set up to strip most of the libs (each have 3 versions: full, stripped, symbols-only). So I can work on configuring it using your suggestions above.

    Thanks for the help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.