summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-06-15 19:32:44 +0000
committerAndrew Cagney <cagney@redhat.com>2002-06-15 19:32:44 +0000
commit89eaca2a72b6d6b7053b75da5f7711600737cf9e (patch)
treece32ed095c46b0d5ef32105334936688fff7935e
parentab9dfe2ee9d249d88c30101d9ff52c6738ae829b (diff)
downloadgdb-89eaca2a72b6d6b7053b75da5f7711600737cf9e.tar.gz
fixes for HEAD->branch merge.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/arch-utils.c10
-rw-r--r--gdb/arch-utils.h4
-rw-r--r--gdb/blockframe.c6
-rw-r--r--gdb/gdbarch.c5
-rw-r--r--gdb/gdbarch.h5
-rwxr-xr-xgdb/gdbarch.sh2
-rw-r--r--gdb/mi/ChangeLog4
-rw-r--r--gdb/mi/mi-main.c1
-rw-r--r--gdb/regcache.c28
-rw-r--r--gdb/rs6000-tdep.c4
-rw-r--r--gdb/values.c7
12 files changed, 62 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c1582ca06ba..0dbe0a5f740 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2002-06-15 Andrew Cagney <ac131313@redhat.com>
+
+ * regcache.c (regcache_descr): New function.
+ (init_legacy_regcache_descr): Replace legacy_regcache_descr.
+ (init_regcache_descr): Replace regcache_descr.
+ (_initialize_regcache): Pass init_regcache_descr to
+ register_gdbarch_data.
+
+ * arch-utils.h (legacy_extract_return_value): Declare.
+
+ * blockframe.c (generic_call_dummy_register_unwind): Use
+ deprecated_grub_regcache_for_registers to get register value.
+ * values.c (value_being_returned): Ditto. Include "regcache.h".
+
2002-05-23 Andrew Cagney <ac131313@redhat.com>
* regbuf.h, regbuf.c: Delete.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 887aa9d7223..c0569f2a110 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -91,6 +91,16 @@ legacy_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr)
return NULL;
}
+/* Implementation of extract return value that grubs around in the
+ register cache. */
+void
+legacy_extract_return_value (struct type *type, struct regcache *regcache,
+ char *valbuf)
+{
+ char *registers = deprecated_grub_regcache_for_registers (regcache);
+ DEPRECATED_EXTRACT_RETURN_VALUE (type, registers, valbuf);
+}
+
int
legacy_register_sim_regno (int regnum)
{
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 0b397af82d4..9dfa70cefdc 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -39,6 +39,10 @@ extern gdbarch_frame_num_args_ftype frame_num_args_unknown;
targets that don't yet implement their own breakpoint_from_pc(). */
extern gdbarch_breakpoint_from_pc_ftype legacy_breakpoint_from_pc;
+/* Implementation of extract return value that grubs around in the
+ register cache. */
+extern gdbarch_extract_return_value_ftype legacy_extract_return_value;
+
/* Frameless functions not identifable. */
extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_invocation_not;
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 39038a8f6f3..7362f5de603 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -1349,7 +1349,7 @@ generic_call_dummy_register_unwind (struct frame_info *frame, void **cache,
/* If needed, find and return the value of the register. */
if (bufferp != NULL)
{
- char *registers;
+ struct regcache *registers;
#if 1
/* Get the address of the register buffer that contains all the
saved registers for this dummy frame. Cache that address. */
@@ -1366,7 +1366,9 @@ generic_call_dummy_register_unwind (struct frame_info *frame, void **cache,
#endif
gdb_assert (registers != NULL);
/* Return the actual value. */
- memcpy (bufferp, registers + REGISTER_BYTE (regnum),
+ memcpy (bufferp,
+ (deprecated_grub_regcache_for_registers (registers)
+ + REGISTER_BYTE (regnum)),
REGISTER_RAW_SIZE (regnum));
}
}
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 96737928234..55041aca53a 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -516,6 +516,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->pointer_to_address = unsigned_pointer_to_address;
current_gdbarch->address_to_pointer = unsigned_address_to_pointer;
current_gdbarch->return_value_on_stack = generic_return_value_on_stack_not;
+ current_gdbarch->extract_return_value = legacy_extract_return_value;
current_gdbarch->push_arguments = default_push_arguments;
current_gdbarch->use_struct_convention = generic_use_struct_convention;
current_gdbarch->prologue_frameless_p = generic_prologue_frameless_p;
@@ -700,9 +701,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of address_to_pointer, invalid_p == 0 */
/* Skip verify of integer_to_address, has predicate */
/* Skip verify of return_value_on_stack, invalid_p == 0 */
- if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
- && (gdbarch->extract_return_value == 0))
- fprintf_unfiltered (log, "\n\textract_return_value");
+ /* Skip verify of extract_return_value, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->deprecated_extract_return_value == 0))
fprintf_unfiltered (log, "\n\tdeprecated_extract_return_value");
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 8b2736650cc..7d73294bfc9 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1461,6 +1461,11 @@ extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_
#endif
#endif
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (EXTRACT_RETURN_VALUE)
+#define EXTRACT_RETURN_VALUE(type, regcache, valbuf) (legacy_extract_return_value (type, regcache, valbuf))
+#endif
+
typedef void (gdbarch_extract_return_value_ftype) (struct type *type, struct regcache *regcache, char *valbuf);
extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, char *valbuf);
extern void set_gdbarch_extract_return_value (struct gdbarch *gdbarch, gdbarch_extract_return_value_ftype *extract_return_value);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index ca3ac330ec0..6d6c2d02f18 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -528,7 +528,7 @@ f:2:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, COR
F:2:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf
#
f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
-f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, char *valbuf:type, regcache, valbuf::0:0
+f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, char *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0
f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf::0:0
f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0
f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index fb029512645..096154f9ebb 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,3 +1,7 @@
+2002-06-15 Andrew Cagney <ac131313@redhat.com>
+
+ * mi-main.c: Do not include "regbuf.h".
+
2002-05-16 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (register_changed_p): Update.
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index d0e63e9a85a..43dbb6fd9a1 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -41,7 +41,6 @@
#include "gdb.h"
#include <ctype.h>
#include <sys/time.h>
-#include "regbuf.h"
enum
{
diff --git a/gdb/regcache.c b/gdb/regcache.c
index f2d5b54966c..5da651272d1 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -74,8 +74,8 @@ struct regcache_descr
};
-static struct regcache_descr *
-legacy_regcache_descr (struct gdbarch *gdbarch)
+static void *
+init_legacy_regcache_descr (struct gdbarch *gdbarch)
{
int i;
struct regcache_descr *descr;
@@ -83,10 +83,6 @@ legacy_regcache_descr (struct gdbarch *gdbarch)
``gdbarch'' as a parameter. */
gdb_assert (gdbarch != NULL);
- descr = gdbarch_data (gdbarch, regcache_data_handle);
- if (descr != NULL)
- return descr;
-
descr = XMALLOC (struct regcache_descr);
descr->gdbarch = gdbarch;
descr->legacy_p = 1;
@@ -136,23 +132,18 @@ legacy_regcache_descr (struct gdbarch *gdbarch)
return descr;
}
-static struct regcache_descr *
-regcache_descr (struct gdbarch *gdbarch)
+static void *
+init_regcache_descr (struct gdbarch *gdbarch)
{
int i;
struct regcache_descr *descr;
gdb_assert (gdbarch != NULL);
- /* If the value has previously been computed, just return that. */
- descr = gdbarch_data (gdbarch, regcache_data_handle);
- if (descr != NULL)
- return descr;
-
/* If an old style architecture, construct the register cache
description using all the register macros. */
if (!gdbarch_register_read_p (gdbarch)
&& !gdbarch_register_write_p (gdbarch))
- return legacy_regcache_descr (gdbarch);
+ return init_legacy_regcache_descr (gdbarch);
descr = XMALLOC (struct regcache_descr);
descr->gdbarch = gdbarch;
@@ -217,6 +208,12 @@ regcache_descr (struct gdbarch *gdbarch)
return descr;
}
+static struct regcache_descr *
+regcache_descr (struct gdbarch *gdbarch)
+{
+ return gdbarch_data (gdbarch, regcache_data_handle);
+}
+
static void
xfree_regcache_descr (struct gdbarch *gdbarch, void *ptr)
{
@@ -1238,7 +1235,8 @@ regcache_restore_no_passthrough (struct regcache *regcache)
void
_initialize_regcache (void)
{
- regcache_data_handle = register_gdbarch_data (NULL, xfree_regcache_descr);
+ regcache_data_handle = register_gdbarch_data (init_regcache_descr,
+ xfree_regcache_descr);
REGISTER_GDBARCH_SWAP (current_regcache);
register_gdbarch_swap (&registers, sizeof (registers), NULL);
register_gdbarch_swap (&register_valid, sizeof (register_valid), NULL);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index ffc7bb98b58..db38203b5e0 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2624,7 +2624,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_convert_to_raw (gdbarch, rs6000_register_convert_to_raw);
set_gdbarch_stab_reg_to_regnum (gdbarch, rs6000_stab_reg_to_regnum);
- set_gdbarch_deprecated_extract_return_value (gdbarch, rs6000_extract_return_value);
+ set_gdbarch_extract_return_value (gdbarch, rs6000_extract_return_value);
/* Note: kevinb/2002-04-12: I'm not convinced that rs6000_push_arguments()
is correct for the SysV ABI when the wordsize is 8, but I'm also
@@ -2640,7 +2640,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_store_struct_return (gdbarch, rs6000_store_struct_return);
set_gdbarch_store_return_value (gdbarch, rs6000_store_return_value);
- set_gdbarch_deprecated_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
+ set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address);
set_gdbarch_pop_frame (gdbarch, rs6000_pop_frame);
set_gdbarch_skip_prologue (gdbarch, rs6000_skip_prologue);
diff --git a/gdb/values.c b/gdb/values.c
index 1328ddb34b5..69e1dfa5ac2 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -34,6 +34,7 @@
#include "demangle.h"
#include "doublest.h"
#include "gdb_assert.h"
+#include "regcache.h"
/* Prototypes for exported functions. */
@@ -1230,7 +1231,6 @@ value_being_returned (struct type *valtype, struct regcache *retbuf,
struct value *val;
CORE_ADDR addr;
-#if 0
/* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
if (EXTRACT_STRUCT_VALUE_ADDRESS_P ())
if (struct_return)
@@ -1240,13 +1240,13 @@ value_being_returned (struct type *valtype, struct regcache *retbuf,
error ("Function return value unknown.");
return value_at (valtype, addr, NULL);
}
-#endif
/* If this is not defined, just use EXTRACT_RETURN_VALUE instead. */
if (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P ())
if (struct_return)
{
- addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (retbuf);
+ char *registers = deprecated_grub_regcache_for_registers (retbuf);
+ addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (registers);
if (!addr)
error ("Function return value unknown.");
return value_at (valtype, addr, NULL);
@@ -1254,7 +1254,6 @@ value_being_returned (struct type *valtype, struct regcache *retbuf,
val = allocate_value (valtype);
CHECK_TYPEDEF (valtype);
-#define EXTRACT_RETURN_VALUE DEPRECATED_EXTRACT_RETURN_VALUE
EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
return val;