* valprint.c (print_hex_chars): Use local_hex_format_{pre,suf}fix.
* printcmd.c (print_scalar_formatted): Use val_print_type_code_int.
This commit is contained in:
parent
8357834fbe
commit
b0f61d04f6
|
@ -355,36 +355,22 @@ print_scalar_formatted (valaddr, type, format, size, stream)
|
||||||
LONGEST val_long;
|
LONGEST val_long;
|
||||||
int len = TYPE_LENGTH (type);
|
int len = TYPE_LENGTH (type);
|
||||||
|
|
||||||
if (size == 'g' && sizeof (LONGEST) < 8
|
if (len > sizeof (LONGEST)
|
||||||
&& format == 'x')
|
&& (format == 't'
|
||||||
|
|| format == 'c'
|
||||||
|
|| format == 'o'
|
||||||
|
|| format == 'u'
|
||||||
|
|| format == 'd'
|
||||||
|
|| format == 'x'))
|
||||||
{
|
{
|
||||||
/* ok, we're going to have to get fancy here. Assumption: a
|
/* We can't print it normally, but we can print it in hex.
|
||||||
long is four bytes. FIXME. */
|
Printing it in the wrong radix is more useful than saying
|
||||||
unsigned long v1, v2;
|
"use /x, you dummy". */
|
||||||
|
/* FIXME: we could also do octal or binary if that was the
|
||||||
v1 = unpack_long (builtin_type_long, valaddr);
|
desired format. */
|
||||||
v2 = unpack_long (builtin_type_long, valaddr + 4);
|
/* FIXME: we should be using the size field to give us a minimum
|
||||||
|
field width to print. */
|
||||||
#if TARGET_BYTE_ORDER == LITTLE_ENDIAN
|
val_print_type_code_int (type, valaddr, stream);
|
||||||
/* 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);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,9 @@ print_hex_chars (stream, valaddr, len)
|
||||||
{
|
{
|
||||||
unsigned char *p;
|
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
|
#if TARGET_BYTE_ORDER == BIG_ENDIAN
|
||||||
for (p = valaddr;
|
for (p = valaddr;
|
||||||
p < valaddr + len;
|
p < valaddr + len;
|
||||||
|
@ -531,6 +533,7 @@ print_hex_chars (stream, valaddr, len)
|
||||||
{
|
{
|
||||||
fprintf_filtered (stream, "%02x", *p);
|
fprintf_filtered (stream, "%02x", *p);
|
||||||
}
|
}
|
||||||
|
fprintf_filtered (stream, local_hex_format_suffix ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by various <lang>_val_print routines to print elements of an
|
/* Called by various <lang>_val_print routines to print elements of an
|
||||||
|
|
Loading…
Reference in New Issue