Thread View: gnu.gdb.bug
1 messages
1 total messages
Started by Steve Murphy
Mon, 24 Jul 1989 19:15
gdb enhancement request
Author: Steve Murphy
Date: Mon, 24 Jul 1989 19:15
Date: Mon, 24 Jul 1989 19:15
113 lines
3883 bytes
3883 bytes
I took my local gdb copy and did this to it:
*** valprint.c.orig Sun Jul 9 19:26:36 1989
--- valprint.c Fri Jul 21 17:29:33 1989
***************
*** 68,75 ****
fprintf_filtered (stream, "\"");
for (i = 0; i < n && i < print_max; i++)
{
QUIT;
! printchar (VALUE_CONTENTS (val)[i], stream, '"');
}
if (i < n)
fprintf_filtered (stream, "...");
--- 68,87 ----
fprintf_filtered (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_filtered (stream, "...");
***************
*** 185,192 ****
fprintf_filtered (stream, "\"");
for (i = 0; i < len && i < print_max; i++)
{
QUIT;
! printchar (valaddr[i], stream, '"');
}
if (i < len)
fprintf_filtered (stream, "...");
--- 197,214 ----
fprintf_filtered (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_filtered (stream, "...");
***************
*** 196,205 ****
{
for (i = 0; i < len && i < print_max; i++)
{
if (i) fprintf_filtered (stream, ", ");
! val_print (elttype, valaddr + i * eltlen,
! 0, stream, format, deref_ref,
! recurse + 1, pretty);
}
if (i < len)
fprintf_filtered (stream, "...");
--- 218,239 ----
{
for (i = 0; i < len && i < print_max; i++)
{
+ int reps,rep1;
if (i) fprintf_filtered (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,
! recurse + 1, pretty);
! fprintf(stream,"<*%d>...",reps);
! i = rep1 -1;
! }
! else
! val_print (elttype, valaddr + i * eltlen,
! 0, stream, format, deref_ref,
! recurse + 1, pretty);
}
if (i < len)
fprintf_filtered (stream, "...");
=====================================================================
The reason for doing the above, of course, is to annotate repetitive
array info such that redundant info is cut down in size. Now, you implemented
my prettyprint suggestion very nicely, allowing the user to reject/demand it.
Could the same be done with this? perhaps let the user control the number
(minimum) of successive repetitions in an array before notation is used,
and whether to do compression or not.
I've been running with for a while, and it works. Nice, because I don't have
to do as much counting at times to find which element is what number.
murf
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads