(value_fetch_lazy): Avoid 0-length fetches.

This commit is contained in:
John Gilmore 1991-10-25 09:03:36 +00:00
parent db138ce2a7
commit 9cb602e111
2 changed files with 10 additions and 2 deletions

View 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) Thu Oct 24 23:06:40 1991 Fred Fish (fnf at cygnus.com)
* dwarfread.c: Add casts to remove compiler warnings. * dwarfread.c: Add casts to remove compiler warnings.

View File

@ -163,6 +163,9 @@ value_at_lazy (type, addr)
data from the user's process, and clears the lazy flag to indicate data from the user's process, and clears the lazy flag to indicate
that the data in the buffer is valid. 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 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 macro as part of an expression, where a void would not work. The
value is ignored. */ value is ignored. */
@ -173,8 +176,9 @@ value_fetch_lazy (val)
{ {
CORE_ADDR addr = VALUE_ADDRESS (val) + VALUE_OFFSET (val); CORE_ADDR addr = VALUE_ADDRESS (val) + VALUE_OFFSET (val);
read_memory (addr, VALUE_CONTENTS_RAW (val), if (TYPE_LENGTH (VALUE_TYPE (val)))
TYPE_LENGTH (VALUE_TYPE (val))); read_memory (addr, VALUE_CONTENTS_RAW (val),
TYPE_LENGTH (VALUE_TYPE (val)));
VALUE_LAZY (val) = 0; VALUE_LAZY (val) = 0;
return 0; return 0;
} }