+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.
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)
{
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;
/* 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. */
#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));
}
}
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;
/* 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");
#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);
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
+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.
#include "gdb.h"
#include <ctype.h>
#include <sys/time.h>
-#include "regbuf.h"
enum
{
};
-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;
``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;
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;
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)
{
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 (®isters, sizeof (registers), NULL);
register_gdbarch_swap (®ister_valid, sizeof (register_valid), NULL);
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
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);
#include "demangle.h"
#include "doublest.h"
#include "gdb_assert.h"
+#include "regcache.h"
/* Prototypes for exported functions. */
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)
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);
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;