/* Support for printing Pascal values for GDB, the GNU debugger.
- Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007, 2008, 2009
+ Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GDB.
struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
+ struct gdbarch *gdbarch = get_type_arch (type);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int i = 0; /* Number of characters printed */
unsigned len;
struct type *elttype;
/* Look for a NULL char. */
for (temp_len = 0;
extract_unsigned_integer (valaddr + embedded_offset +
- temp_len * eltlen, eltlen)
+ temp_len * eltlen, eltlen,
+ byte_order)
&& temp_len < len && temp_len < options->print_max;
temp_len++);
len = temp_len;
}
LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
- valaddr + embedded_offset, len, 0,
+ valaddr + embedded_offset, len, NULL, 0,
options);
i = len;
}
/* Print vtable entry - we only get here if we ARE using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
/* Extract the address, assume that it is unsigned. */
- print_address_demangle (extract_unsigned_integer (valaddr + embedded_offset, TYPE_LENGTH (type)),
- stream, demangle);
+ addr = extract_unsigned_integer (valaddr + embedded_offset,
+ TYPE_LENGTH (type), byte_order);
+ print_address_demangle (gdbarch, addr, stream, demangle);
break;
}
elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
- print_address_demangle (addr, stream, demangle);
+ print_address_demangle (gdbarch, addr, stream, demangle);
/* Return value is irrelevant except for string pointers. */
return (0);
}
if (options->addressprint && options->format != 's')
{
- fputs_filtered (paddress (addr), stream);
+ fputs_filtered (paddress (gdbarch, addr), stream);
}
/* For a pointer to char or unsigned char, also print the string
void *buffer;
buffer = xmalloc (length_size);
read_memory (addr + length_pos, buffer, length_size);
- string_length = extract_unsigned_integer (buffer, length_size);
+ string_length = extract_unsigned_integer (buffer, length_size,
+ byte_order);
xfree (buffer);
i = val_print_string (char_type ,addr + string_pos, string_length, stream, options);
}
CORE_ADDR addr
= extract_typed_address (valaddr + embedded_offset, type);
fprintf_filtered (stream, "@");
- fputs_filtered (paddress (addr), stream);
+ fputs_filtered (paddress (gdbarch, addr), stream);
if (options->deref_ref)
fputs_filtered (": ", stream);
}
-fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
/* Extract the address, assume that it is unsigned. */
print_address_demangle
- (extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
- TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
+ (gdbarch,
+ extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+ TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET)), byte_order),
stream, demangle);
}
else
if (is_pascal_string_type (type, &length_pos, &length_size,
&string_pos, &char_type, NULL))
{
- len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size);
- LA_PRINT_STRING (stream, char_type, valaddr + embedded_offset + string_pos, len, 0, options);
+ len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size, byte_order);
+ LA_PRINT_STRING (stream, char_type,
+ valaddr + embedded_offset + string_pos,
+ len, NULL, 0, options);
}
else
pascal_object_print_value_fields (type, valaddr + embedded_offset, address, stream,
type_print (type, "", stream, -1);
fprintf_filtered (stream, "} ");
/* Try to print what function it points to, and its address. */
- print_address_demangle (address, stream, demangle);
+ print_address_demangle (gdbarch, address, stream, demangle);
break;
case TYPE_CODE_BOOL: