Re: gdb seg violation during print command

David Cogen
2000-05-04T11:06:00Z

> 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