Setting a breakpoint on a template method with multiple instantiations displays a menu showing all instantiations and the user can choose to set breakpoints on all or any one or none.
For example,
(gdb) file test
Reading symbols from test...done. (gdb) b MyClass::MyMember
[0]cancel
[1]all
[2]MyClass::MyMember(int, int) at test.C:14
[3]MyClass::MyMember(int, float) at test.C:14
[4]MyClass::MyMember(int, double) at test.C:14
14.22Debugging support for shared libraries
On
•deferred breakpoints
•catch load command
14.22.1Using shared library as main program
If the main program is in a shared library and you try to load it as follows:
(gdb)
Load new symbol table from "main.sl"? (y or n) y Reading symbols from main.sl
done.
Things don't appear to work.
This command is not the correct thing to do. This command assumes that main.sl is loaded at its link time address. This is not true for shared libraries.
Do not use
Instead, what you should do is to use the deferred breakpoint feature to set breakpoints on any functions necessary before the program starts running.
(gdb) b main
Breakpoint 1 (deferred) at "main" ("main" was not found).
Breakpoint deferred until a shared library containing "main" is loaded. (gdb) r
Once the program has started running, it will hit the breakpoint. In addition, the debugger will then already know about the sources for main, since it gets this information when the shared library is loaded.
210