aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/arch-utils.c10
-rw-r--r--gdb/arch-utils.h4
-rw-r--r--gdb/gdbarch.c77
-rw-r--r--gdb/gdbarch.h55
-rwxr-xr-xgdb/gdbarch.sh3
-rw-r--r--gdb/values.c9
7 files changed, 166 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 317951b..b89be5d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2002-07-03 Andrew Cagney <ac131313@redhat.com>
+
+ * gdbarch.sh (struct regcache): Add opaque declaration.
+ (EXTRACT_RETURN_VALUE): New architecture method.
+ (EXTRACT_STRUCT_VALUE_ADDRESS): Ditto.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * arch-utils.c (legacy_extract_return_value): New function.
+ * arch-utils.h (legacy_extract_return_value): Declare.
+ * values.c (value_being_returned): Re-enable code handling
+ EXTRACT_STRUCT_VALUE_ADDRESS. Move
+ deprecated_grub_regcache_for_registers call to block handling
+ DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS.
+ (EXTRACT_RETURN_VALUE): Do not define.
+
2002-07-03 Grace Sainsbury <graces@redhat.com>
* config/mcore/tm-mcore.h (REGISTER_BYTES, NUM_REGS, PC_REGNUM)
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 2237fe1..b79a02a 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 8b997fb..7ceb8b7 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/gdbarch.c b/gdb/gdbarch.c
index 24a80ab..079c768 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -209,6 +209,7 @@ struct gdbarch
gdbarch_address_to_pointer_ftype *address_to_pointer;
gdbarch_integer_to_address_ftype *integer_to_address;
gdbarch_return_value_on_stack_ftype *return_value_on_stack;
+ gdbarch_extract_return_value_ftype *extract_return_value;
gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value;
gdbarch_push_arguments_ftype *push_arguments;
gdbarch_push_dummy_frame_ftype *push_dummy_frame;
@@ -216,6 +217,7 @@ struct gdbarch
gdbarch_pop_frame_ftype *pop_frame;
gdbarch_store_struct_return_ftype *store_struct_return;
gdbarch_store_return_value_ftype *store_return_value;
+ gdbarch_extract_struct_value_address_ftype *extract_struct_value_address;
gdbarch_deprecated_extract_struct_value_address_ftype *deprecated_extract_struct_value_address;
gdbarch_use_struct_convention_ftype *use_struct_convention;
gdbarch_frame_init_saved_regs_ftype *frame_init_saved_regs;
@@ -405,6 +407,8 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
+ 0,
generic_in_function_epilogue_p,
construct_inferior_arguments,
0,
@@ -512,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;
@@ -696,6 +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 */
+ /* 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");
@@ -713,6 +719,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
&& (gdbarch->store_return_value == 0))
fprintf_unfiltered (log, "\n\tstore_return_value");
+ /* Skip verify of extract_struct_value_address, has predicate */
/* Skip verify of deprecated_extract_struct_value_address, has predicate */
/* Skip verify of use_struct_convention, invalid_p == 0 */
if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
@@ -1138,6 +1145,31 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(long) current_gdbarch->elf_make_msymbol_special
/*ELF_MAKE_MSYMBOL_SPECIAL ()*/);
#endif
+#ifdef EXTRACT_RETURN_VALUE
+#if GDB_MULTI_ARCH
+ /* Macro might contain `[{}]' when not multi-arch */
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "EXTRACT_RETURN_VALUE(type, regcache, valbuf)",
+ XSTRING (EXTRACT_RETURN_VALUE (type, regcache, valbuf)));
+#endif
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: EXTRACT_RETURN_VALUE = 0x%08lx\n",
+ (long) current_gdbarch->extract_return_value
+ /*EXTRACT_RETURN_VALUE ()*/);
+#endif
+#ifdef EXTRACT_STRUCT_VALUE_ADDRESS
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "EXTRACT_STRUCT_VALUE_ADDRESS(regcache)",
+ XSTRING (EXTRACT_STRUCT_VALUE_ADDRESS (regcache)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: EXTRACT_STRUCT_VALUE_ADDRESS = 0x%08lx\n",
+ (long) current_gdbarch->extract_struct_value_address
+ /*EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
+#endif
#ifdef EXTRA_STACK_ALIGNMENT_NEEDED
fprintf_unfiltered (file,
"gdbarch_dump: EXTRA_STACK_ALIGNMENT_NEEDED # %s\n",
@@ -3744,6 +3776,25 @@ set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch,
}
void
+gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, char *valbuf)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->extract_return_value == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_extract_return_value invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_return_value called\n");
+ gdbarch->extract_return_value (type, regcache, valbuf);
+}
+
+void
+set_gdbarch_extract_return_value (struct gdbarch *gdbarch,
+ gdbarch_extract_return_value_ftype extract_return_value)
+{
+ gdbarch->extract_return_value = extract_return_value;
+}
+
+void
gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf)
{
gdb_assert (gdbarch != NULL);
@@ -3884,6 +3935,32 @@ set_gdbarch_store_return_value (struct gdbarch *gdbarch,
}
int
+gdbarch_extract_struct_value_address_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->extract_struct_value_address != 0;
+}
+
+CORE_ADDR
+gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache)
+{
+ gdb_assert (gdbarch != NULL);
+ if (gdbarch->extract_struct_value_address == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_extract_struct_value_address invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_extract_struct_value_address called\n");
+ return gdbarch->extract_struct_value_address (regcache);
+}
+
+void
+set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch,
+ gdbarch_extract_struct_value_address_ftype extract_struct_value_address)
+{
+ gdbarch->extract_struct_value_address = extract_struct_value_address;
+}
+
+int
gdbarch_deprecated_extract_struct_value_address_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index aeb4747..c1443c8 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -46,6 +46,7 @@ struct frame_info;
struct value;
struct objfile;
struct minimal_symbol;
+struct regcache;
extern struct gdbarch *current_gdbarch;
@@ -1460,6 +1461,23 @@ 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);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRACT_RETURN_VALUE)
+#error "Non multi-arch definition of EXTRACT_RETURN_VALUE"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRACT_RETURN_VALUE)
+#define EXTRACT_RETURN_VALUE(type, regcache, valbuf) (gdbarch_extract_return_value (current_gdbarch, type, regcache, valbuf))
+#endif
+#endif
+
typedef void (gdbarch_deprecated_extract_return_value_ftype) (struct type *type, char *regbuf, char *valbuf);
extern void gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, struct type *type, char *regbuf, char *valbuf);
extern void set_gdbarch_deprecated_extract_return_value (struct gdbarch *gdbarch, gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value);
@@ -1574,6 +1592,43 @@ extern void set_gdbarch_store_return_value (struct gdbarch *gdbarch, gdbarch_sto
#endif
#endif
+#if defined (EXTRACT_STRUCT_VALUE_ADDRESS)
+/* Legacy for systems yet to multi-arch EXTRACT_STRUCT_VALUE_ADDRESS */
+#if !defined (EXTRACT_STRUCT_VALUE_ADDRESS_P)
+#define EXTRACT_STRUCT_VALUE_ADDRESS_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (EXTRACT_STRUCT_VALUE_ADDRESS_P)
+#define EXTRACT_STRUCT_VALUE_ADDRESS_P() (0)
+#endif
+
+extern int gdbarch_extract_struct_value_address_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRACT_STRUCT_VALUE_ADDRESS_P)
+#error "Non multi-arch definition of EXTRACT_STRUCT_VALUE_ADDRESS"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRACT_STRUCT_VALUE_ADDRESS_P)
+#define EXTRACT_STRUCT_VALUE_ADDRESS_P() (gdbarch_extract_struct_value_address_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (EXTRACT_STRUCT_VALUE_ADDRESS)
+#define EXTRACT_STRUCT_VALUE_ADDRESS(regcache) (internal_error (__FILE__, __LINE__, "EXTRACT_STRUCT_VALUE_ADDRESS"), 0)
+#endif
+
+typedef CORE_ADDR (gdbarch_extract_struct_value_address_ftype) (struct regcache *regcache);
+extern CORE_ADDR gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, struct regcache *regcache);
+extern void set_gdbarch_extract_struct_value_address (struct gdbarch *gdbarch, gdbarch_extract_struct_value_address_ftype *extract_struct_value_address);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (EXTRACT_STRUCT_VALUE_ADDRESS)
+#error "Non multi-arch definition of EXTRACT_STRUCT_VALUE_ADDRESS"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (EXTRACT_STRUCT_VALUE_ADDRESS)
+#define EXTRACT_STRUCT_VALUE_ADDRESS(regcache) (gdbarch_extract_struct_value_address (current_gdbarch, regcache))
+#endif
+#endif
+
#if defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS)
/* Legacy for systems yet to multi-arch DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS */
#if !defined (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS_P)
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index b4eb29b..2bdc387 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -528,6 +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:::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
@@ -536,6 +537,7 @@ f:2:POP_FRAME:void:pop_frame:void:-:::0
#
f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, char *valbuf:type, valbuf:::0
+F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:struct regcache *regcache:regcache:::0
F:2:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:char *regbuf:regbuf:::0
f:2:USE_STRUCT_CONVENTION:int:use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0
#
@@ -762,6 +764,7 @@ struct frame_info;
struct value;
struct objfile;
struct minimal_symbol;
+struct regcache;
extern struct gdbarch *current_gdbarch;
diff --git a/gdb/values.c b/gdb/values.c
index 3c577f3..debea40 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -1225,14 +1225,12 @@ value_from_double (struct type *type, DOUBLEST num)
/* ARGSUSED */
struct value *
-value_being_returned (struct type *valtype, struct regcache *buf,
+value_being_returned (struct type *valtype, struct regcache *retbuf,
int struct_return)
{
- char *retbuf = deprecated_grub_regcache_for_registers (buf);
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)
@@ -1242,13 +1240,13 @@ value_being_returned (struct type *valtype, struct regcache *buf,
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 *buf = deprecated_grub_regcache_for_registers (retbuf);
+ addr = DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS (buf);
if (!addr)
error ("Function return value unknown.");
return value_at (valtype, addr, NULL);
@@ -1256,7 +1254,6 @@ value_being_returned (struct type *valtype, struct regcache *buf,
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;