debugging segfault before main.

Andrew Bell andrew.bell.ia@gmail.com
Fri Jul 18 13:09:00 GMT 2008


On Fri, Jul 18, 2008 at 4:10 AM, Karl Hiramoto <karl@hiramoto.org> wrote:
> Hi all,
>
> I'm looking for suggestions how to debug a segfault i have before main().
> I'm  thinking now that  this is probably coming from one of the ten shared
> libraries i link to, but i don't know which one.    I recently upgraded from
> kernel 2.6.16, uclibc 0.28, gcc 3.4.6   to   kernel 2.6.25, uclibc 0.29, gcc
> 4.2.4 and this problem started.

This is, as usual, most probably a bug in your code.  Static ctors run
before main starts and their order is not well-defined across
compilation units.  Perhaps there is a dependency and things aren't
getting initialized in the same order as with the last system setup.

If you can't get a dump, eliminate the code/initialization that may
take place before start, and see if you at least get to the program
entry point.

-- 
Andrew Bell
andrew.bell.ia@gmail.com



More information about the Gcc-help mailing list