aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-06-13 02:32:05 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-06-13 02:32:05 +0000
commitb0f61d04f617f32c4ee1e8b7fb35b6b79a854c98 (patch)
treec028d09274548739bc91574049743fbcf29ab7b0 /gdb
parent8357834fbec086011dbb4b445f63c03c9f4c6c1e (diff)
downloadgdb-b0f61d04f617f32c4ee1e8b7fb35b6b79a854c98.zip
gdb-b0f61d04f617f32c4ee1e8b7fb35b6b79a854c98.tar.gz
gdb-b0f61d04f617f32c4ee1e8b7fb35b6b79a854c98.tar.bz2
* valprint.c (print_hex_chars): Use local_hex_format_{pre,suf}fix.
* printcmd.c (print_scalar_formatted): Use val_print_type_code_int.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/printcmd.c46
-rw-r--r--gdb/valprint.c9
2 files changed, 22 insertions, 33 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index c6d4a6c..d40a2f8 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -355,39 +355,25 @@ print_scalar_formatted (valaddr, type, format, size, stream)
LONGEST val_long;
int len = TYPE_LENGTH (type);
- if (size == 'g' && sizeof (LONGEST) < 8
- && format == 'x')
+ if (len > sizeof (LONGEST)
+ && (format == 't'
+ || format == 'c'
+ || format == 'o'
+ || format == 'u'
+ || format == 'd'
+ || format == 'x'))
{
- /* ok, we're going to have to get fancy here. Assumption: a
- long is four bytes. FIXME. */
- unsigned long v1, v2;
-
- v1 = unpack_long (builtin_type_long, valaddr);
- v2 = unpack_long (builtin_type_long, valaddr + 4);
-
-#if TARGET_BYTE_ORDER == LITTLE_ENDIAN
- /* Swap the two for printing */
- {
- unsigned long tmp;
-
- tmp = v1;
- v1 = v2;
- v2 = tmp;
- }
-#endif
-
- switch (format)
- {
- case 'x':
- fprintf_filtered (stream, local_hex_format_custom("08x%08"), v1, v2);
- break;
- default:
- error ("Output size \"g\" unimplemented for format \"%c\".",
- format);
- }
+ /* We can't print it normally, but we can print it in hex.
+ Printing it in the wrong radix is more useful than saying
+ "use /x, you dummy". */
+ /* FIXME: we could also do octal or binary if that was the
+ desired format. */
+ /* FIXME: we should be using the size field to give us a minimum
+ field width to print. */
+ val_print_type_code_int (type, valaddr, stream);
return;
}
-
+
val_long = unpack_long (type, valaddr);
/* If value is unsigned, truncate it in case negative. */
diff --git a/gdb/valprint.c b/gdb/valprint.c
index b09474d..b3b1f71 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -304,7 +304,7 @@ val_print_type_code_int (type, valaddr, stream)
unpack_long (type, valaddr));
#endif
}
-}
+}
/* Print a number according to FORMAT which is one of d,u,x,o,b,h,w,g.
The raison d'etre of this function is to consolidate printing of LONG_LONG's
@@ -517,8 +517,10 @@ print_hex_chars (stream, valaddr, len)
unsigned len;
{
unsigned char *p;
-
- fprintf_filtered (stream, "0x");
+
+ /* FIXME: We should be not printing leading zeroes in most cases. */
+
+ fprintf_filtered (stream, local_hex_format_prefix ());
#if TARGET_BYTE_ORDER == BIG_ENDIAN
for (p = valaddr;
p < valaddr + len;
@@ -531,6 +533,7 @@ print_hex_chars (stream, valaddr, len)
{
fprintf_filtered (stream, "%02x", *p);
}
+ fprintf_filtered (stream, local_hex_format_suffix ());
}
/* Called by various <lang>_val_print routines to print elements of an