diff options
Diffstat (limited to 'gdb/p-valprint.c')
-rw-r--r-- | gdb/p-valprint.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index ec90016..50c993f 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -57,6 +57,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, 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; @@ -95,7 +96,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, /* 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; @@ -143,9 +145,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, /* 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 (gdbarch, - 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)); @@ -193,7 +195,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, 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); } @@ -294,7 +297,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, print_address_demangle (gdbarch, extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8, - TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))), + TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET)), byte_order), stream, demangle); } else @@ -302,7 +305,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, 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); + 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, 0, options); } else |