Index: valprint.h =================================================================== RCS file: /cvs/src/src/gdb/valprint.h,v retrieving revision 1.4 diff -u -p -r1.4 valprint.h --- valprint.h 6 Apr 2003 19:25:04 -0000 1.4 +++ valprint.h 26 Feb 2004 22:07:15 -0000 @@ -63,4 +63,10 @@ extern void print_octal_chars (struct ui extern void print_decimal_chars (struct ui_file *, unsigned char *, unsigned int); + +extern void print_hex_chars (struct ui_file *, unsigned char *, + unsigned int); + +extern void print_char_chars (struct ui_file *, unsigned char *, + unsigned int); #endif Index: valprint.c =================================================================== RCS file: /cvs/src/src/gdb/valprint.c,v retrieving revision 1.31 diff -u -p -r1.31 valprint.c --- valprint.c 21 Sep 2003 01:26:45 -0000 1.31 +++ valprint.c 26 Feb 2004 22:07:15 -0000 @@ -42,9 +42,6 @@ static int partial_memory_read (CORE_ADDR memaddr, char *myaddr, int len, int *errnoptr); -static void print_hex_chars (struct ui_file *, unsigned char *, - unsigned int); - static void show_print (char *, int); static void set_print (char *, int); @@ -846,7 +843,7 @@ print_decimal_chars (struct ui_file *str /* VALADDR points to an integer of LEN bytes. Print it in hex on stream. */ -static void +void print_hex_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len) { unsigned char *p; @@ -873,6 +870,40 @@ print_hex_chars (struct ui_file *stream, } } fputs_filtered (local_hex_format_suffix (), stream); +} + +/* VALADDR points to a char integer of LEN bytes. Print it out in appropriate language form on stream. + Omit any leading zero chars. */ + +void +print_char_chars (struct ui_file *stream, unsigned char *valaddr, unsigned len) +{ + unsigned char *p; + + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + { + p = valaddr; + while (p < valaddr + len - 1 && *p == 0) + ++p; + + while (p < valaddr + len) + { + LA_EMIT_CHAR (*p, stream, '\''); + ++p; + } + } + else + { + p = valaddr + len - 1; + while (p > valaddr && *p == 0) + --p; + + while (p >= valaddr) + { + LA_EMIT_CHAR (*p, stream, '\''); + --p; + } + } } /* Called by various _val_print routines to print elements of an Index: printcmd.c =================================================================== RCS file: /cvs/src/src/gdb/printcmd.c,v retrieving revision 1.76 diff -u -p -r1.76 printcmd.c --- printcmd.c 23 Feb 2004 19:41:47 -0000 1.76 +++ printcmd.c 26 Feb 2004 22:07:15 -0000 @@ -350,6 +350,33 @@ print_scalar_formatted (void *valaddr, s LONGEST val_long = 0; unsigned int len = TYPE_LENGTH (type); + if (len > sizeof(LONGEST) && + (TYPE_CODE (type) == TYPE_CODE_INT || + TYPE_CODE (type) == TYPE_CODE_ENUM)) + { + switch (format) + { + case 'o': + print_octal_chars (stream, valaddr, len); + return; + case 'u': + case 'd': + print_decimal_chars (stream, valaddr, len); + return; + case 't': + print_binary_chars (stream, valaddr, len); + return; + case 'x': + print_hex_chars (stream, valaddr, len); + return; + case 'c': + print_char_chars (stream, valaddr, len); + return; + default: + break; + }; + } + if (format != 'f') val_long = unpack_long (type, valaddr);