How to prevent GDB from loading a debug symbol for a (large) library?

When debugging a Qt 5 application, sometimes I’m not interested in the inside of Qt 5, but the structure of the application itself. Therefore, I do not need to load all the debug symbols of the Qt 5 libraries, since it takes a few seconds to load.

Is it possible to prevent GDB from loading symbols for these Qt 5 libraries while retaining debug symbols for my application?

+5
source share
1 answer

Is it possible to prevent GDB from loading symbols for these Qt 5 libraries while retaining debug symbols for my application?

Yes.

As Richard Krettin mentions, setting auto-solib-add to 0 prevent characters from loading for all shared libraries, and you can then add files manually using the sharedlibrary (which accepts a regular expression). If this regular expression is omitted, all shared libraries are loaded.

However, this will prevent the automatic loading of all symbols (and not just debug symbols), and will also prevent the automatic loading of symbols for system libraries, which are often necessary to unwind the stack.

A better approach might be to keep a copy of the Qt5 libraries with full debugging information somewhere, for example. ~/Qt5-debug/ , then run strip -g in the source libraries. Thus, you will get symbolic information for all libraries, and in the rare case when you really need complete debugging information for Qt5, you can still do this with GDB file ~/Qt5-debug/libQt5Core.so.5.2 or similar commands .

The GDB Files chapter of the GDB manual has additional documentation on the use of these separate debugging symbols.

+7
source

All Articles