From: John Gilmore Date: Sat, 3 Aug 1991 02:02:03 +0000 (+0000) Subject: Only read the right number of bytes in reading basetypes, so we don't X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f6f12f989cf28d793de33fc8f6bdc1864752bd6;p=binutils-gdb.git Only read the right number of bytes in reading basetypes, so we don't overrun malloc. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3217d333e5a..f4c1b4f205e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ Fri Aug 2 00:13:06 1991 John Gilmore (gnu at cygint.cygnus.com) + * values.c (basetype_addr): When reading target memory, use the + length of the basetype, not the upper type. We've only malloc'd + enough space for the basetype, leading to errors in free(). + * expprint.c (print_subexp): Print UNOP_MEMVAL of an OP_LONG that ends up as a function specially, since we know the actual type of the pointed-to address. This (somewhat) fixes display of diff --git a/gdb/values.c b/gdb/values.c index 1c11d4ea402..34c64b3a4d1 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1179,7 +1179,7 @@ baseclass_addr (type, index, valaddr, valuep, errp) status = target_read_memory (addr, VALUE_CONTENTS_RAW (val), - TYPE_LENGTH (type)); + TYPE_LENGTH (basetype)); VALUE_LVAL (val) = lval_memory; VALUE_ADDRESS (val) = addr;