This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Re: gdb seg violation during print command
- To: David Cogen <cogen at ll dot mit dot edu>
- Subject: Re: gdb seg violation during print command
- From: Daniel Berlin <dan at cgsoftware dot com>
- Date: Thu, 4 May 2000 10:42:38 -0700 (PDT)
- cc: kettenis at wins dot uva dot nl, gdb at sourceware dot cygnus dot com
It's also possible the bug you are experiencing is that the compiler is
putting the line note in the wrong place, and it's not breaking till the
program is really done, and cerr doesn't exist properly.
Try -gdwarf-2, see if it helps.
On Thu, 4 May 2000, David Cogen wrote:
> > First off, your code is broken. You claim to return an int, but don't.
> > This is what is causing the segfault in gdb.
> > It's impossible for us to not believe the compiler when it says "this
> > function returns an int". We expect it to return an int.
>
> Sorry, that's not it. I have also tried the following:
>
> #include <iostream>
>
> int tteesstt11 (int)
> {
> cerr << "\n";
> return 4;
> }
>
> int main ()
> {
> }
>
> print tteesstt11(1) from a breakpoint in main() still causes gdb to seg
> fault. Indeed, I have tried lots of forms for tteesstt11; they all seg fault.
>
> > In the newer gdb, what'll happen is you'll get no segfault, but a weird number
> > returned, which will actually the address of the function, which is
> > the last value we have around, i guess.
>
> Have you actually tried this or are you supposing? Where can I get the "newer"
> gdb? What version is the "newer" gdb?
>
> -- DavidC
>