This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] struct regcache versions of EXTRACT_... methods
- From: Andrew Cagney <ac131313 at ges dot redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 03 Jul 2002 17:25:29 -0400
- Subject: [patch] struct regcache versions of EXTRACT_... methods
Hello,
Now that [almost] everything else for the regcache is done, I can add
the new, improved, EXTRACT_STRUCT_VALUE_ADDRESS and
EXTRACT_RETURN_VALUE. These methods take a ``struct regcache'' as the
parameter. Nothing defines EXTRACT_STRUCT_VALUE_ADDRESS so it has no
effect. EXTRACT_RETURN_VALUE is setup to call
DEPRECATED_EXTRACT_RETURN_VALUE so it to has no net effect.
Time for an architecture to convert to these new improved mechanisms I
guess.
committed,
Andrew
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.
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.61
diff -u -r1.61 arch-utils.c
--- arch-utils.c 17 Jun 2002 23:32:26 -0000 1.61
+++ arch-utils.c 3 Jul 2002 21:17:19 -0000
@@ -91,6 +91,16 @@
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)
{
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.36
diff -u -r1.36 arch-utils.h
--- arch-utils.h 17 Jun 2002 23:32:27 -0000 1.36
+++ arch-utils.h 3 Jul 2002 21:17:19 -0000
@@ -39,6 +39,10 @@
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;
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.147
diff -u -r1.147 gdbarch.sh
--- gdbarch.sh 17 Jun 2002 23:32:28 -0000 1.147
+++ gdbarch.sh 3 Jul 2002 21:17:23 -0000
@@ -528,6 +528,7 @@
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: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 value;
struct objfile;
struct minimal_symbol;
+struct regcache;
extern struct gdbarch *current_gdbarch;
Index: values.c
===================================================================
RCS file: /cvs/src/src/gdb/values.c,v
retrieving revision 1.37
diff -u -r1.37 values.c
--- values.c 3 Jul 2002 20:36:54 -0000 1.37
+++ values.c 3 Jul 2002 21:17:24 -0000
@@ -1225,14 +1225,12 @@
/* 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 @@
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 @@
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;