This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
break on C++ global objects ctors
- From: Daniel Gutson <daniel dot gutson at tallertechnologies dot com>
- To: gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 26 Mar 2014 15:22:32 -0300
- Subject: break on C++ global objects ctors
- Authentication-results: sourceware.org; auth=none
Hi,
AFAIK, there is no command to break and debug the construction of
global objects in C++.
I'm looking for an equivalent command to "start" but instead of temp
breaking at the
beginning of main(), breaks at the beginning of every global ctor.
The way I'm currently doing this in GNU Linux/x86_64 is:
br __static_initialization_and_destruction_0
which is a workaround, with the nice side effect that when asking info br, gdb
shows all the source locations of the global object instances.
I'm not sure whether this could supported by a native gdb feature or by a python
extension.
If there is consensus about the former, I might create some patch.
However, I suspect that this might require some support from collect2 too,
or some libc internals knowledge by gdb.
Daniel.