aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-10-25 09:03:36 +0000
committerJohn Gilmore <gnu@cygnus>1991-10-25 09:03:36 +0000
commit9cb602e111d316e5c1f857fbd2f33f5dfbc275b3 (patch)
tree1dd6685b96e2b7b3d18aa20ae24ae246f5a34699 /gdb/valops.c
parentdb138ce2a7d36a3c1854376c8eba0bd1add0b7dd (diff)
downloadgdb-9cb602e111d316e5c1f857fbd2f33f5dfbc275b3.zip
gdb-9cb602e111d316e5c1f857fbd2f33f5dfbc275b3.tar.gz
gdb-9cb602e111d316e5c1f857fbd2f33f5dfbc275b3.tar.bz2
(value_fetch_lazy): Avoid 0-length fetches.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 614317f..07c96af 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -163,6 +163,9 @@ value_at_lazy (type, addr)
data from the user's process, and clears the lazy flag to indicate
that the data in the buffer is valid.
+ If the value is zero-length, we avoid calling read_memory, which would
+ abort. We mark the value as fetched anyway -- all 0 bytes of it.
+
This function returns a value because it is used in the VALUE_CONTENTS
macro as part of an expression, where a void would not work. The
value is ignored. */
@@ -173,8 +176,9 @@ value_fetch_lazy (val)
{
CORE_ADDR addr = VALUE_ADDRESS (val) + VALUE_OFFSET (val);
- read_memory (addr, VALUE_CONTENTS_RAW (val),
- TYPE_LENGTH (VALUE_TYPE (val)));
+ if (TYPE_LENGTH (VALUE_TYPE (val)))
+ read_memory (addr, VALUE_CONTENTS_RAW (val),
+ TYPE_LENGTH (VALUE_TYPE (val)));
VALUE_LAZY (val) = 0;
return 0;
}