This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strange segfaults of gdb


Michal Ludvig wrote:
> 
> Hi all,
> I've spent several days with chasing gdb segfaults on x86-64 but had no
> luck. So I'm finally asking here for any suggestions, opinions, hints,
> just anything that could move me forward.
> The problem is, that when I print anything using a 'print' command, or
> info or maybe some others, and then want to run or step the debugged
> program, the gdb segfaults:
> 
> # ./gdb ~/mludvig/tst/xmmtest
> GNU gdb 2002-04-04-cvs
> [...]
> This GDB was configured as "x86_64-unknown-linux-gnu"...
> Setting up the environment for debugging gdb.
> gdbinit:3: Error in sourced command file:
> Function "internal_error" not defined.
> (gdb) br 10
> Breakpoint 1 at 0x4004d8: file xmmtest.c, line 10.
> (gdb) r
> Starting program: /root/mludvig/tst/xmmtest
> 
> Breakpoint 1, main () at xmmtest.c:10
> 10              printf("v1=%f, v2=%f, v3=%e\n", v1, v2, v3);
> (gdb) p 1
> $1 = 1
> (gdb) c
> Continuing.
> Segmentation fault (core dumped)
> 
> It doesn't matter which program I run, what I want to print and if I
> then want invoke 'run', 'continue' or even 'si'. It segfaults. Core file
> doesn't give any reasonable informations.
> This segfault also happens when I leave 'set complaints 1' in .gdbinit
> in sourcedir, run gdb from there and then try to run a debugged program.
>   Unfortunately it is perfectly reproductable :-(
> 
> Does anybody have an idea how print, set and step can be related?
> I really don't know...

I don't actually have any insight into your problem, but
I thought of an interesting way to debug it...

If you have a gdb that is recent enough to include the "gcore" command, 
you could do the following:

1) run gdb under gdb
2) go up to the point just before you say "p 1"
3) generate a corefile of gdb.
4) do the "p 1"
5) generate another corefile of gdb.
6) compare the corefiles, to see what changed.


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