/* If we are printing it as unsigned, truncate it in case it is actually
a negative signed value (e.g. "print/u (short)-1" should print 65535
(if shorts are 16 bits) instead of 4294967295). */
- if (options->format != 'd')
+ if (options->format != 'd' || TYPE_UNSIGNED (type))
{
if (len < sizeof (LONGEST))
val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1;
val = evaluate_expression (d->exp);
addr = value_as_address (val);
if (d->format.format == 'i')
- addr = gdbarch_addr_bits_remove (current_gdbarch, addr);
+ addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr);
annotate_display_value ();
gdb_byte *str;
CORE_ADDR tem;
int j;
- struct type *wctype = lookup_typename ("wchar_t", NULL, 0);
+ struct type *wctype = lookup_typename (current_language,
+ current_gdbarch,
+ "wchar_t", NULL, 0);
int wcwidth = TYPE_LENGTH (wctype);
gdb_byte *buf = alloca (wcwidth);
struct obstack output;
break;
case wide_char_arg:
{
- struct type *wctype = lookup_typename ("wchar_t", NULL, 0);
+ struct type *wctype = lookup_typename (current_language,
+ current_gdbarch,
+ "wchar_t", NULL, 0);
struct type *valtype;
struct obstack output;
struct cleanup *inner_cleanup;