This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFA: printing true characters when lang is C



unpack_long returns a long long; the code passed it to printf, with a
%u or %d format specifier.  We shouldn't use %llu / %lld, since those
aren't portable.

Note that this doesn't affect the C character type --- it only affects
true character types, like Java's.  And, with the patch I committed
a few days ago, like the type used by 'print/c'. 

(Thanks for catching this, Stan.)

1999-06-18  Jim Blandy  <jimb@zwingli.cygnus.com>

	* c-valprint.c (c_val_print): Cast a character's numeric value
	from long long to int before trying to print it with %u or %d.  I
	don't think we'll find a language with characters wider than a
	long.

Index: c-valprint.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/c-valprint.c,v
retrieving revision 2.41
diff -c -c -b -F'^(' -r2.41 c-valprint.c
*** c-valprint.c	1999/01/05 17:08:19	2.41
--- c-valprint.c	1999/06/18 07:08:10
***************
*** 402,409 ****
  	}
        else
  	{
! 	  fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%u" : "%d",
! 			    unpack_long (type, valaddr + embedded_offset));
  	  fputs_filtered (" ", stream);
  	  LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset), stream);
  	}
--- 402,409 ----
  	}
        else
  	{
! 	  fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%lu" : "%ld",
! 			    (long) unpack_long (type, valaddr + embedded_offset));
  	  fputs_filtered (" ", stream);
  	  LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset), stream);
  	}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]