This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Global object constructors

> Date: Wed, 3 Nov 1999 10:50:42 -0800
> From: Michael Vance <>

> 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...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]