clark@CS.UBC.CA (Graeme Clark) (08/02/89)
We found the following bug in gdb version 3.2, running on a Sun 4 running (I believe) SunOS 4.0: Script started on Tue Aug 1 21:42:55 1989 % cat bug.c struct foo { }; main() { struct foo f; } % gcc -g bug.c % gdb a.out GDB 3.2, 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 /spring/clark/a.out...done. Type "help" for a list of commands. (gdb) list Reading in symbols for bug.c...Segmentation fault (core dumped) % exit % script done on Tue Aug 1 21:43:38 1989 We were able to fix the problem by making the following small change to the file dbxread.c: % diff -c dbxread.c new_dbxread.c *** dbxread.c Mon Jul 10 19:38:46 1989 --- new_dbxread.c Mon Jul 31 14:05:20 1989 *************** *** 4159,4164 **** --- 4159,4165 ---- char *name; register char *p; int nfields = 0; + int MethodFound = 0; register int n; register struct next_fnfieldlist *mainlist = 0; *************** *** 4208,4214 **** break; case '1': via_virtual = 1; ! break; default: error ("Invalid symbol data: bad visibility format at symtab pos %d", symnum); --- 4209,4215 ---- break; case '1': via_virtual = 1; ! break; default: error ("Invalid symbol data: bad visibility format at symtab pos %d", symnum); *************** *** 4273,4279 **** --- 4274,4283 ---- /* C++: Check to see if we have hit the methods yet. */ if (p[1] == ':') + { + MethodFound = 1; break; + } *pp = p + 1; *************** *** 4341,4347 **** OPERATOR::*.methods, where OPERATOR is the string "operator", `*' holds the place for an operator name (such as `+=') and `.' marks the end of the operator name. */ ! if (p[1] == ':') { /* Now, read in the methods. To simplify matters, we "unread" the name that has been read, so that we can --- 4345,4351 ---- OPERATOR::*.methods, where OPERATOR is the string "operator", `*' holds the place for an operator name (such as `+=') and `.' marks the end of the operator name. */ ! if (MethodFound) { /* Now, read in the methods. To simplify matters, we "unread" the name that has been read, so that we can *************** *** 4348,4353 **** --- 4352,4358 ---- start from the top. */ p = *pp; + /* chill the list of fields: the last entry (at the head) is a partially constructed entry which we now scrub. */ % Graeme Clark clark@cs.ubc.ca