aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/c-valprint.c12
-rw-r--r--gdb/cp-valprint.c4
-rw-r--r--gdb/hpacc-abi.c2
-rw-r--r--gdb/i386-tdep.c2
-rw-r--r--gdb/infcall.c2
-rw-r--r--gdb/m68k-tdep.c2
-rw-r--r--gdb/valops.c16
-rw-r--r--gdb/value.c8
-rw-r--r--gdb/value.h4
-rw-r--r--gdb/vax-tdep.c2
11 files changed, 38 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8806bfc..c56d5e3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 532dedc..6f10619 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -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);
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index a4aef46..e90a2b5 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -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);
}
diff --git a/gdb/hpacc-abi.c b/gdb/hpacc-abi.c
index 1cd7ad6d..79b4c69 100644
--- a/gdb/hpacc-abi.c
+++ b/gdb/hpacc-abi.c
@@ -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
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 671ad50..1033eaf 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -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. */
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 4025ee2..667a07f 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -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),
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 553bdde..0e6ec10 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -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. */
diff --git a/gdb/valops.c b/gdb/valops.c
index ac55d53..50b7e7c 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -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)
diff --git a/gdb/value.c b/gdb/value.c
index 2579143..690ef9a 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -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
diff --git a/gdb/value.h b/gdb/value.h
index ed4d9ee..ba435bc 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -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);
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 028e24b..44bd845 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -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. */