public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* debugging segfault before main.
@ 2008-07-18 11:15 Karl Hiramoto
  2008-07-18 13:09 ` Andrew Bell
  2008-07-18 13:34 ` Karl Hiramoto
  0 siblings, 2 replies; 3+ messages in thread
From: Karl Hiramoto @ 2008-07-18 11:15 UTC (permalink / raw)
  To: gcc-help

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.


# gdb /usr/bin/myprog
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "armeb-linux-uclibc"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) break _init
Breakpoint 1 at 0xb6cc
(gdb) break main
Breakpoint 2 at 0xc4f8: file /home/karl/Work/myprog.c, line 355.
(gdb) run
Starting program: /usr/bin/myprog
[Thread debugging using libthread_db enabled]
[New Thread 1024 (LWP 894)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 894)]
0x400d1578 in _pthread_cleanup_push_defer () from /lib/libc.so.0
(gdb)



The only thing i have left to try, is to start to eliminate the 
libraries i link to, to try and find which one it is.


Some similar problems to mine, but not really helping me:
http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00219.html
http://gcc.gnu.org/ml/gcc-help/1999-10/msg00485.html


Any suggestions welcome..

Thanks.

karl.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: debugging segfault before main.
  2008-07-18 11:15 debugging segfault before main Karl Hiramoto
@ 2008-07-18 13:09 ` Andrew Bell
  2008-07-18 13:34 ` Karl Hiramoto
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Bell @ 2008-07-18 13:09 UTC (permalink / raw)
  To: Karl Hiramoto; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: debugging segfault before main.
  2008-07-18 11:15 debugging segfault before main Karl Hiramoto
  2008-07-18 13:09 ` Andrew Bell
@ 2008-07-18 13:34 ` Karl Hiramoto
  1 sibling, 0 replies; 3+ messages in thread
From: Karl Hiramoto @ 2008-07-18 13:34 UTC (permalink / raw)
  To: gcc-help

Karl Hiramoto 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.
>
>
> # gdb /usr/bin/myprog
> GNU gdb 6.6
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and 
> you are
> welcome to change it and/or distribute copies of it under certain 
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for 
> details.
> This GDB was configured as "armeb-linux-uclibc"...
> Using host libthread_db library "/lib/libthread_db.so.1".
> (gdb) break _init
> Breakpoint 1 at 0xb6cc
> (gdb) break main
> Breakpoint 2 at 0xc4f8: file /home/karl/Work/myprog.c, line 355.
> (gdb) run
> Starting program: /usr/bin/myprog
> [Thread debugging using libthread_db enabled]
> [New Thread 1024 (LWP 894)]
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1024 (LWP 894)]
> 0x400d1578 in _pthread_cleanup_push_defer () from /lib/libc.so.0
> (gdb)
>
>
>
> The only thing i have left to try, is to start to eliminate the 
> libraries i link to, to try and find which one it is.
>
>
> Some similar problems to mine, but not really helping me:
> http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00219.html
> http://gcc.gnu.org/ml/gcc-help/1999-10/msg00485.html
>
>
> Any suggestions welcome..
>
> Thanks.
>
> karl.
>

figured this out myself, by  removing all libs,  then readding them till 
i found which lib caused the problem.   Found that the problematic lib 
was being compilled with -pthread even though it did not use threads.

-- 

--
Karl Hiramoto  http://karl.hiramoto.org/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-18 13:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-18 11:15 debugging segfault before main Karl Hiramoto
2008-07-18 13:09 ` Andrew Bell
2008-07-18 13:34 ` Karl Hiramoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).