murf@CS.UTEXAS.EDU (Steve Murphy) (04/15/89)
I'm running SUNOS 3.5, on a 3/60. Gdb appears to be running correctly, at this site, but for two or 3 things: 1. The most disturbing is that once "run", "continue", etc. is issued, hitting control-c will not stop the process. It will stop the print command. The only way I can get gdb to return control to me when running a program with an infinite loop, is to kill -9 the gdb process. That, of course, makes it slightly difficult to continue.... 2. Gdb will break on a gets or fgets(stdin... attempts to continue are unsuccessful. You have to go back to dbx (ptui!). This is what I get: gdb exp GDB 3.1.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 /usr2/vulcan/caecolocal/rel_3.1/sdf/murf/exp...done. Type "help" for a list of commands. (gdb) run Starting program: /usr2/vulcan/caecolocal/rel_3.1/sdf/murf/exp Program received signal 21, Stopped (tty input) 0x239e in read () (gdb) where #0 0x239e in read () #1 0x3 in ?? () (gdb) c Continuing. Program received signal 21, Stopped (tty input) 0x239e in read () (gdb) and so on.... 3. One of my colleagues, who has a fairly big (>2Mbyte) executable, reported that the break command hangs forever when attempted. (but gdb 2.8 works fine still, so he's still using that.) This wasn't consistant, as other attempts to break would return after 60 or so seconds. ENHANCEMENT SUGGESTION FOLLOWS: GET GRAIN OF SALT READY! I don't like the way gdb prints arrays and structs. Big whoopee, right? Well, what's wrong with 'em, you ask. I say, struct values print out on one line, which is nice because it's dense, but also fairly hard to read. And it's inconsistent with the way other parts of print struct defs, etc. So, my suggestion is: print 'em indented like whatis would. The thing I don't like about the arrays is that if you ask for 200 max elements, you GET 200 elements. How about some shorthand for repetitive entries? In the interest of fulfilling the above enhancements, I enclose the following diffs as an example of what one might do to make this happen in gdb code: *** ../gdb-3.1/valprint.c Wed Jan 11 12:51:31 1989 --- valprint.c Thu Apr 13 14:14:02 1989 *************** *** 68,75 **** fputc ('"', stream); for (i = 0; i < n && i < print_max; i++) { QUIT; ! printchar (VALUE_CONTENTS (val)[i], stream, '"'); } if (i < n) fprintf (stream, "..."); --- 68,85 ---- fputc ('"', stream); for (i = 0; i < n && i < print_max; i++) { + int reps,rep1; QUIT; ! for(rep1=i+1,reps=1;rep1 < n && VALUE_CONTENTS(val)[i] == VALUE_CONTENTS(val)[rep1];reps++,rep1++) ! ; ! if( reps > 10 ) ! { ! printchar (VALUE_CONTENTS(val)[i], stream, '"'); ! fprintf(stream,"<*%d>...",reps); ! i = rep1 -1; ! } ! else ! printchar (VALUE_CONTENTS (val)[i], stream, '"'); } if (i < n) fprintf (stream, "..."); *************** *** 83,89 **** fprintf (stream, ", "); val_print (VALUE_TYPE (val), VALUE_CONTENTS (val) + typelen * i, VALUE_ADDRESS (val) + typelen * i, ! stream, format, 1); } if (i < n) fprintf (stream, "..."); --- 93,99 ---- fprintf (stream, ", "); val_print (VALUE_TYPE (val), VALUE_CONTENTS (val) + typelen * i, VALUE_ADDRESS (val) + typelen * i, ! stream, format, 1,0); } if (i < n) fprintf (stream, "..."); *************** *** 107,113 **** fprintf (stream, ") "); } return val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), ! VALUE_ADDRESS (val), stream, format, 1); } } ^L --- 117,123 ---- fprintf (stream, ") "); } return val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), ! VALUE_ADDRESS (val), stream, format, 1,0); } } ^L *************** *** 122,129 **** if DEREF_REF is nonzero, then dereference references, otherwise just print them like pointers. */ int ! val_print (type, valaddr, address, stream, format, deref_ref) struct type *type; char *valaddr; CORE_ADDR address; --- 132,154 ---- if DEREF_REF is nonzero, then dereference references, otherwise just print them like pointers. */ + void + val_tabs( stream,number ) + FILE *stream; + int number; + { + if( number ) + { + fprintf(stream,"\n"); + while(number--) + { + fprintf(stream,"\t"); + } + } + } + int ! val_print (type, valaddr, address, stream, format, deref_ref,lev) struct type *type; char *valaddr; CORE_ADDR address; *************** *** 130,135 **** --- 155,161 ---- FILE *stream; char format; int deref_ref; + int lev; { register int i; int len, n_baseclasses; *************** *** 155,163 **** { fputc ('"', stream); for (i = 0; i < len && i < print_max; i++) ! { ! QUIT; ! printchar (valaddr[i], stream, '"'); } if (i < len) fprintf (stream, "..."); --- 181,200 ---- { fputc ('"', stream); for (i = 0; i < len && i < print_max; i++) ! { ! int reps,rep1; ! ! QUIT; ! for(rep1=i+1,reps=1;rep1 < len && valaddr[i] == valaddr[rep1];reps++,rep1++) ! ; ! if( reps > 5 ) ! { ! printchar (valaddr[i], stream, '"'); ! fprintf(stream,"<*%d>...",reps); ! i = rep1 -1; ! } ! else ! printchar (valaddr[i], stream, '"'); } if (i < len) fprintf (stream, "..."); *************** *** 167,175 **** { for (i = 0; i < len && i < print_max; i++) { if (i) fprintf (stream, ", "); val_print (elttype, valaddr + i * eltlen, ! 0, stream, format, deref_ref); } if (i < len) fprintf (stream, "..."); --- 204,223 ---- { for (i = 0; i < len && i < print_max; i++) { + int reps,rep1; if (i) fprintf (stream, ", "); + for(rep1=i+1,reps=1;rep1 < len && !bcmp(valaddr+i*eltlen, valaddr+rep1*eltlen,eltlen);reps++,rep1++) + ; + if( reps > 5 ) + { val_print (elttype, valaddr + i * eltlen, ! 0, stream, format, deref_ref,lev+1); ! fprintf(stream,"<*%d>...",reps); ! i = rep1 -1; ! } ! else ! val_print (elttype, valaddr + i * eltlen, ! 0, stream, format, deref_ref,lev+1); } if (i < len) fprintf (stream, "..."); *************** *** 375,381 **** { value val = value_at (TYPE_TARGET_TYPE (type), * (int *) valaddr); val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), ! VALUE_ADDRESS (val), stream, format, deref_ref); } else fprintf (stream, "???"); --- 426,432 ---- { value val = value_at (TYPE_TARGET_TYPE (type), * (int *) valaddr); val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), ! VALUE_ADDRESS (val), stream, format, deref_ref,lev+1); } else fprintf (stream, "???"); Now, the above are only partial diffs just for an example. By hand you'll have to change all recursive calls to val_print from within val_print to include lev+1, and all calls to val_print from without val_print should get called with 0 as an added last argument. I think that there's one other file than val_print involved. The above changes affect a compromise in the -all on one line- and the -all on seperate lines- philosophies. Need more info? write me. I like gdb. I like it working well, too. murf