[gnu.gdb.bug] crashes and suggestions and questions

karl@mote.umb.edu ("Karl Berry.") (06/03/89)

On a Sun 3 running 3.4, gdb 3.1, it seems to core dump on any function call 
before the program is `run' for the first time. For example, gdb'ing gcc and 
calling `perror_with_name' produces a segmentation fault.


Suggestions: have the `source' command not print ``Directory already in path 
messages''. It is only when I'm starting up that I would care about that, 
and maybe not even then. At least have user commands that call source not 
produce such output.

Make the default file for `source' be .gdbinit, so that just `so' will work, 
instead of having to do `so .gdbinit'.

When a function call is returning, I seem to get a spurious stop, when the 
stack is a little messed up, since all the parameters are ridiculous values.


Finally, has anyone contributed 386i support yet? One can only appreciate 
gdb when one has to use dbx, instead...


Thanks.

karl@umb.edu   ...!harvard!umb!karl


Here is a little test for the screwed-up parameters problem:

#include <stdio.h>

void x();


main()
{
  int i = 100;
  char* s = "foobar";
  
   x(i, s);
}

void
x(i, s)
   int i;
   char* s;
{
   printf("%d, %s\n", i, s);
}


and the compilation:


gcc -g -v foo.c
gcc version 1.35
 /usr/local/gnu/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 foo.c /tmp/cca03022.cpp
GNU CPP version 1.35
 /usr/local/gnu/lib/gcc-cc1 /tmp/cca03022.cpp -quiet -dumpbase foo.c -g -version -o /tmp/cca03022.s
GNU C version 1.35 (68k, MIT syntax) compiled by GNU C version 1.35.
 as -mc68020 -o foo.o /tmp/cca03022.s
 ld /lib/crt0.o /lib/Mcrt1.o foo.o /usr/local/gnu/lib/gcc-gnulib -lg -lc


and the debugging:



% gdb a.out
GDB 3.1, Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /usr/tmp/a.out...done.
Type "help" for a list of commands.
(gdb) b x
Breakpoint 1 at 0x20d4: file foo.c, line 19.
(gdb) r
Starting program: /usr/tmp/a.out 

Bpt 1, x (i=100, s=(char *) 0x20a0 "foobar") (foo.c line 19)
19	   printf("%d, %s\n", i, s);
(gdb) s
100, foobar
20	}
(gdb) s
0x20e8 in x (i=1, s=(char *) 0xefff940 "\016\377\371\364") (foo.c line 20)
20	}


at this last point, either gdb shouldn't have stopped, or it should print 
out the right values for the arguments.