Re: How can I trace a segfault on program start?
"Oliver Elphick" <olly@lfix.co.uk> writes:
> I have compiled a program with gcc 2.95. It segfaults immediately on starting
> and neither gdb nor strace reveal any useful information:
>
>
> olly@linda:.../src$ people
> Segmentation fault (core dumped)
> olly@linda:.../src$ gdb people
> GNU gdb 2001-07-05-cvs (MI_OUT)
> ...
> (gdb) run
> Starting program: /usr1/proj/bray/gtk/people_glade/src/people
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000001 in ?? ()
> (gdb) bt
> #0 0x00000001 in ?? ()
> Cannot access memory at address 0x0
> (gdb) q
> The program is running. Exit anyway? (y or n) y
> olly@linda:.../src$ strace people
> execve("./people", ["people"], [/* 49 vars */]) = 0
> --- SIGSEGV (Segmentation fault) ---
> +++ killed by SIGSEGV +++
It could be that the stack pointers and/or frame pointers have been
corrupted.
You might want to break at '_start' which is the first function called
by the loader, and then step through the assembler from there.
Phil.
Reply to: