This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Global object constructors
- To: briareos at lokigames dot com, gcc at gcc dot gnu dot org
- Subject: Re: Global object constructors
- From: Mike Stump <mrs at windriver dot com>
- Date: Wed, 3 Nov 1999 14:40:23 -0800 (PST)
> Date: Wed, 3 Nov 1999 10:50:42 -0800
> From: Michael Vance <briareos@lokigames.com>
> Is anyone aware of any facilities, or recommended techniques, for
> debugging global object constructors?
Sure, you breakpoint the routine that calls them all, (hint _start
should be early enough), and then you next over each one, one by one,
and inbetween you call a routine that tells you if the world is sane.
After you find which one caused the world to go bad, you rerun, and
stop just before the call to the ctor. Instead, now you step into it.
You then have a routine name and file, you then recompile that file
with debugging (if it wasn't), rerun and reverify it breaks there, and
go into is and then watch it break stuff. From there standard
techniques should work.
Now, you're going to ask be the exact name of the routine. Well, on
some systems, you can breakpoint __main, and see the ctors run. On
others systems, you have tons of file static __do_global_ctors_aux
routines that you can break... and so on...