Programs SIGSEGV in Gdb under Solaris 2.6

Programs SIGSEGV in Gdb under Solaris 2.6

Post by Hrvoje Niksi » Mon, 21 Dec 1998 04:00:00



[ I had problems with my news server.  Sorry if you see this again. ]

Since upgrading to 2.6, I've noticed a strange behaviour of Gdb 4.17;
I am unable to call functions from Gdb because the program receives a
SIGSEGV every time I do so.  Take this trivial example:

#include <stdio.h>
int somefunc (void) { return 0; }
int main (void)
{
  int x = somefunc ();
  printf ("%d\n", x);
  return 0;

Quote:}

Now, compile it with `gcc -g' and try calling somefunc() directly from
Gdb, e.g. like this:

$ gdb a.out
GNU gdb 4.17
[... (c) blurb ...]
This GDB was configured as "sparc-sun-solaris2.6"...
(gdb) b main
Breakpoint 1 at 0x10aa0: file a.c, line 5.
(gdb) run
Starting program: /home/hniksic/work/a.out

Breakpoint 1, main () at a.c:5
5         int x = somefunc ();
(gdb) print somefunc()

Program received signal SIGSEGV, Segmentation fault.
<function called from gdb>
The program being debugged stopped while in a function called from GDB.
When the function (somefunc) is done executing, GDB will silently
stop (instead of continuing to evaluate the expression containing
the function call).
(gdb)

For me, this scenario repeats for any function and any program I
debug, making Gdb virtually useless.  I checked the Solaris FAQ, but
Casper's patch didn't help here.  The same happens with both Gcc
2.7.2.3 and 2.8.1, as well as with SparcWorks cc 4.0 (`cc -g -xs')
compilers.

Is there a known fix for this problem?  Does Gdb work for other people
under Solaris 2.6?