aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-08-03 02:02:03 +0000
committerJohn Gilmore <gnu@cygnus>1991-08-03 02:02:03 +0000
commit4f6f12f989cf28d793de33fc8f6bdc1864752bd6 (patch)
tree48aa65977e6b9280da0e51d942c5eb731a6fa3da
parentc5c604c4467d2b786a97de4d212af59e67e146e2 (diff)
downloadgdb-4f6f12f989cf28d793de33fc8f6bdc1864752bd6.zip
gdb-4f6f12f989cf28d793de33fc8f6bdc1864752bd6.tar.gz
gdb-4f6f12f989cf28d793de33fc8f6bdc1864752bd6.tar.bz2
Only read the right number of bytes in reading basetypes, so we don't
overrun malloc.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/values.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3217d33..f4c1b4f 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 1c11d4e..34c64b3 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;