(value_fetch_lazy): Avoid 0-length fetches.
authorJohn Gilmore <gnu@cygnus>
Fri, 25 Oct 1991 09:03:36 +0000 (09:03 +0000)
committerJohn Gilmore <gnu@cygnus>
Fri, 25 Oct 1991 09:03:36 +0000 (09:03 +0000)
gdb/ChangeLog
gdb/valops.c

index f7ad1dda787405b0abb26e2196c81b0a9c9f20f3..f999d4e221497227c3e7f5c0520f1157eb4e91fe 100644 (file)
@@ -1,3 +1,7 @@
+Fri Oct 25 02:02:13 1991  John Gilmore  (gnu at cygnus.com)
+
+       * valops.c (value_fetch_lazy):  Avoid 0-length fetches.
+
 Thu Oct 24 23:06:40 1991  Fred Fish  (fnf at cygnus.com)
 
        * dwarfread.c:  Add casts to remove compiler warnings.
index 614317f5370bf41be15c2a8514b7eb1e1fce36e7..07c96af55b99d0608a6e50b92f701d9f5d7aaa43 100644 (file)
@@ -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;
 }
This page took 0.028221 seconds and 4 git commands to generate.