2005-02-02 Andrew Cagney <cagney@gnu.org>

* value.h (VALUE_CONTENTS_ALL): Delete.
	(value_contents_all): Declare.
	* value.c (value_contents_all): New function.
	* hpacc-abi.c, cp-valprint.c, valops.c, c-valprint.c: Update.
	* m68k-tdep.c, i386-tdep.c, infcall.c, valops.c: Update.
This commit is contained in:
Andrew Cagney 2005-02-02 21:36:17 +00:00
parent 1b9afc0454
commit 46615f07c3
11 changed files with 38 additions and 24 deletions

View File

@ -1,13 +1,17 @@
2005-02-02 Andrew Cagney <cagney@gnu.org>
* value.h (VALUE_CONTENTS_ALL): Delete.
(value_contents_all): Declare.
* value.c (value_contents_all): New function.
* hpacc-abi.c, cp-valprint.c, valops.c, c-valprint.c: Update.
* m68k-tdep.c, i386-tdep.c, infcall.c, valops.c: Update.
* value.c (value_enclosing_type): New function.
* value.h (VALUE_ENCLOSING_TYPE): Delete.
(value_enclosing_type): Declare.
* xstormy16-tdep.c, vax-tdep.c, m68k-tdep.c, i386-tdep.c: Update.
* gnu-v3-abi.c, hpacc-abi.c, infcall.c, valops.c: Update.
2005-02-01 Andrew Cagney <cagney@gnu.org>
* value.c (value_contents_all_raw)
(value_contents_raw): New functions.
* value.h (VALUE_CONTENTS_ALL_RAW, VALUE_CONTENTS_RAW): Delete.

View File

@ -579,8 +579,9 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
TYPE_NAME (real_type),
full ? "" : _(" [incomplete object]"));
/* Print out object: enclosing type is same as real_type if full */
return val_print (value_enclosing_type (val), VALUE_CONTENTS_ALL (val), 0,
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
return val_print (value_enclosing_type (val),
value_contents_all (val), 0,
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
/* Note: When we look up RTTI entries, we don't get any information on
const or volatile attributes */
}
@ -589,13 +590,14 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
/* No RTTI information, so let's do our best */
fprintf_filtered (stream, "(%s ?) ",
TYPE_NAME (value_enclosing_type (val)));
return val_print (value_enclosing_type (val), VALUE_CONTENTS_ALL (val), 0,
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
return val_print (value_enclosing_type (val),
value_contents_all (val), 0,
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
}
/* Otherwise, we end up at the return outside this "if" */
}
return val_print (type, VALUE_CONTENTS_ALL (val),
return val_print (type, value_contents_all (val),
VALUE_EMBEDDED_OFFSET (val),
VALUE_ADDRESS (val) + value_offset (val),
stream, format, 1, 0, pretty);

View File

@ -664,12 +664,12 @@ cp_print_static_field (struct type *type,
sizeof (CORE_ADDR));
CHECK_TYPEDEF (type);
cp_print_value_fields (type, type, VALUE_CONTENTS_ALL (val),
cp_print_value_fields (type, type, value_contents_all (val),
VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
stream, format, recurse, pretty, NULL, 1);
return;
}
val_print (type, VALUE_CONTENTS_ALL (val),
val_print (type, value_contents_all (val),
VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
stream, format, 0, recurse, pretty);
}

View File

@ -219,7 +219,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
*using_enc = 1;
/* First get the virtual table address */
coreptr = *(CORE_ADDR *) ((VALUE_CONTENTS_ALL (v))
coreptr = *(CORE_ADDR *) ((value_contents_all (v))
+ value_offset (v)
+ (using_enclosing
? 0

View File

@ -1233,7 +1233,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
This makes sure the stack says word-aligned. */
sp -= (len + 3) & ~3;
write_memory (sp, VALUE_CONTENTS_ALL (args[i]), len);
write_memory (sp, value_contents_all (args[i]), len);
}
/* Push value address. */

View File

@ -591,7 +591,7 @@ You must use a pointer to function type variable. Command ignored.", arg_name);
sp += aligned_len;
}
/* Push the structure. */
write_memory (addr, VALUE_CONTENTS_ALL (args[i]), len);
write_memory (addr, value_contents_all (args[i]), len);
/* The value we're going to pass is the address of the
thing we just pushed. */
/*args[i] = value_from_longest (lookup_pointer_type (values_type),

View File

@ -432,7 +432,7 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else
offset = container_len - len;
sp -= container_len;
write_memory (sp + offset, VALUE_CONTENTS_ALL (args[i]), len);
write_memory (sp + offset, value_contents_all (args[i]), len);
}
/* Store struct value address. */

View File

@ -485,10 +485,11 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
return val;
}
/* Called only from the VALUE_CONTENTS and VALUE_CONTENTS_ALL macros,
if the current data for a variable needs to be loaded into
/* Called only from the VALUE_CONTENTS and value_contents_all()
macros, if the current data for a variable needs to be loaded into
VALUE_CONTENTS(VAL). Fetches the data from the user's process, and
clears the lazy flag to indicate that the data in the buffer is valid.
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.
@ -1023,7 +1024,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
for (idx = 0; idx < nelem; idx++)
{
memcpy (value_contents_all_raw (val) + (idx * typelength),
VALUE_CONTENTS_ALL (elemvec[idx]),
value_contents_all (elemvec[idx]),
typelength);
}
return val;
@ -1037,7 +1038,8 @@ value_array (int lowbound, int highbound, struct value **elemvec)
addr = allocate_space_in_inferior (nelem * typelength);
for (idx = 0; idx < nelem; idx++)
{
write_memory (addr + (idx * typelength), VALUE_CONTENTS_ALL (elemvec[idx]),
write_memory (addr + (idx * typelength),
value_contents_all (elemvec[idx]),
typelength);
}
@ -1503,7 +1505,7 @@ search_struct_method (char *name, struct value **arg1p,
according to HP/Taligent runtime spec. */
int skip;
find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
VALUE_CONTENTS_ALL (*arg1p),
value_contents_all (*arg1p),
offset + VALUE_EMBEDDED_OFFSET (*arg1p),
&base_offset, &skip);
if (skip >= 0)
@ -1737,7 +1739,7 @@ find_method_list (struct value **argp, char *method, int offset,
* according to HP/Taligent runtime spec. */
int skip;
find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
VALUE_CONTENTS_ALL (*argp),
value_contents_all (*argp),
offset + VALUE_EMBEDDED_OFFSET (*argp),
&base_offset, &skip);
if (skip >= 0)

View File

@ -165,6 +165,14 @@ value_enclosing_type (struct value *value)
return value->enclosing_type;
}
const bfd_byte *
value_contents_all (struct value *value)
{
if (value->lazy)
value_fetch_lazy (value);
return value->aligner.contents;
}
/* Return a mark in the value chain. All values allocated after the
mark is obtained (except for those released) are subject to being freed

View File

@ -203,9 +203,7 @@ extern bfd_byte *value_contents_raw (struct value *);
pointer by the embedded_offset value. */
extern bfd_byte *value_contents_all_raw (struct value *);
#define VALUE_CONTENTS_ALL(val) \
((void) (VALUE_LAZY(val) && value_fetch_lazy(val)), \
(val)->aligner.contents)
extern const bfd_byte *value_contents_all (struct value *);
extern int value_fetch_lazy (struct value *val);

View File

@ -128,7 +128,7 @@ vax_store_arguments (struct regcache *regcache, int nargs,
sp -= (len + 3) & ~3;
count += (len + 3) / 4;
write_memory (sp, VALUE_CONTENTS_ALL (args[i]), len);
write_memory (sp, value_contents_all (args[i]), len);
}
/* Push argument count. */