[Dwarf-Discuss] Question / Proposal: breakpoints at global C++ constructors and destructors
daniel.gutson at tallertechnologies.com
Sun Oct 5 07:27:26 PDT 2014
this is my first post to this list.
Context: I've been a gdb and gcc maintainer in the past, but I'm not a
DWARF expert, so my post is
from the user's POV.
PROBLEM: ability to break in (all) the global objects' constructors
(that is, before main() is called),
and destructors (after main() ).
As a matter of proof of concept, we've developed a gdb script that is
also nontrivial and imperfect.
FWIW, there were two ways: one implementation-agnostic by regex
finding the ctors of all objects and
adding breakpoints in all of them, then breaking at main, disabling
the former and continuing;
another way was implementation-specific, knowing the internals of the
mechanism. Our proof of concept used the first approach but had a lot of issues.
So, it would be absolutely trivial if there was a DW_CTOR_CALL /
DW_DTOR_CALL with the address
of the call instruction, so the debugger can break on those calls, and
do a step-into to get into the ctor/dtor body.
Daniel F. Gutson
Chief Engineering Officer, SPD
San Lorenzo 47, 3rd Floor, Office 5
Phone: +54 351 4217888 / +54 351 4218211
More information about the Dwarf-Discuss