aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog25
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/infcmd.c25
-rw-r--r--gdb/inferior.h2
-rw-r--r--gdb/regcache.c12
-rw-r--r--gdb/regcache.h1
-rw-r--r--gdb/valops.c6
-rw-r--r--gdb/value.h5
-rw-r--r--gdb/values.c5
9 files changed, 54 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e20d22d..915ab3e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,28 @@
+2002-07-03 Andrew Cagney <ac131313@redhat.com>
+
+ * infcmd.c (print_return_value): Remove compatibility code calling
+ deprecated_grub_regcache_for_registers.
+
+ * values.c: Include "regcache.h".
+ (value_being_returned): Update. Use
+ deprecated_grub_regcache_for_registers to extract the register
+ buffer address.
+ * value.h (value_being_returned): Change ``retbuf'' parameter to a
+ ``struct regcache''.
+ * Makefile.in (values.o): Add dependency on $(regcache_h).
+
+ * inferior.h (run_stack_dummy): Change type of second parameter to
+ a ``struct regcache''.
+ * valops.c (hand_function_call): Change type of retbuf to ``struct
+ regcache''. Allocate using regcache_xmalloc, clean using
+ make_cleanup_regcache_xfree.
+ * infcmd.c (run_stack_dummy): Update. Use
+ regcache_cpu_no_passthrough instead of memcpy to copy the buffer.
+
+ * regcache.c (do_regcache_xfree): New function.
+ (make_cleanup_regcache_xfree): New function.
+ * regcache.h (make_cleanup_regcache_xfree): Declare.
+
2002-07-03 Martin M. Hunt <hunt@redhat.com>
* event-top.c (command_line_handler): Don't read past
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index d62c4f8..99538e2 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2234,7 +2234,7 @@ valprint.o: valprint.c $(defs_h) $(expression_h) $(gdbcmd_h) \
values.o: values.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \
$(gdbcore_h) $(gdbtypes_h) $(symtab_h) $(target_h) $(value_h) \
- $(gdb_string_h) scm-lang.h $(doublest_h)
+ $(gdb_string_h) scm-lang.h $(doublest_h) $(regcache_h)
vax-tdep.o: vax-tdep.c $(OP_INCLUDE)/vax.h $(defs_h) $(symtab_h) \
$(arch_utils_h) $(inferior_h) $(vax_tdep_h)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index d3949d3..83267ad 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -40,8 +40,7 @@
#include "ui-out.h"
#include "event-top.h"
#include "parser-defs.h"
-
-#include "regcache.h" /* for deprecated_grub_regcache_for_registers(). */
+#include "regcache.h"
/* Functions exported for general use: */
@@ -971,7 +970,7 @@ breakpoint_auto_delete_contents (PTR arg)
will eventually be popped when we do hit the dummy end breakpoint). */
int
-run_stack_dummy (CORE_ADDR addr, char *buffer)
+run_stack_dummy (CORE_ADDR addr, struct regcache *buffer)
{
struct cleanup *old_cleanups = make_cleanup (null_cleanup, 0);
int saved_async = 0;
@@ -1044,9 +1043,7 @@ run_stack_dummy (CORE_ADDR addr, char *buffer)
return 2;
/* On normal return, the stack dummy has been popped already. */
-
- memcpy (buffer, deprecated_grub_regcache_for_registers (stop_registers),
- REGISTER_BYTES);
+ regcache_cpy_no_passthrough (buffer, stop_registers);
return 0;
}
@@ -1146,15 +1143,7 @@ print_return_value (int structure_return, struct type *value_type)
if (!structure_return)
{
-#if 0
value = value_being_returned (value_type, stop_registers, structure_return);
-#else
- /* FIXME: cagney/2002-06-22: Function value_being_returned()
- should take a regcache as a parameter. */
- value = value_being_returned
- (value_type, deprecated_grub_regcache_for_registers (stop_registers),
- structure_return);
-#endif
stb = ui_out_stream_new (uiout);
ui_out_text (uiout, "Value returned is ");
ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
@@ -1175,15 +1164,7 @@ print_return_value (int structure_return, struct type *value_type)
ui_out_text (uiout, ".");
ui_out_text (uiout, " Cannot determine contents\n");
#else
-#if 0
value = value_being_returned (value_type, stop_registers, structure_return);
-#else
- /* FIXME: cagney/2002-06-22: Function value_being_returned()
- should take a regcache as a parameter. */
- value = value_being_returned
- (value_type, deprecated_grub_regcache_for_registers (stop_registers),
- structure_return);
-#endif
stb = ui_out_stream_new (uiout);
ui_out_text (uiout, "Value returned is ");
ui_out_field_fmt (uiout, "gdb-result-var", "$%d", record_latest_value (value));
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 38c5b28..716daf9 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -154,7 +154,7 @@ extern void generic_mourn_inferior (void);
extern void terminal_ours (void);
-extern int run_stack_dummy (CORE_ADDR, char *);
+extern int run_stack_dummy (CORE_ADDR , struct regcache *);
extern CORE_ADDR read_pc (void);
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 70a75b5..6927f3e 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -269,6 +269,18 @@ regcache_xfree (struct regcache *regcache)
}
void
+do_regcache_xfree (void *data)
+{
+ regcache_xfree (data);
+}
+
+struct cleanup *
+make_cleanup_regcache_xfree (struct regcache *regcache)
+{
+ return make_cleanup (do_regcache_xfree, regcache);
+}
+
+void
regcache_cpy (struct regcache *dst, struct regcache *src)
{
int i;
diff --git a/gdb/regcache.h b/gdb/regcache.h
index c0f402e..108b3fa 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -29,6 +29,7 @@ struct gdbarch;
extern struct regcache *current_regcache;
void regcache_xfree (struct regcache *regcache);
+struct cleanup *make_cleanup_regcache_xfree (struct regcache *regcache);
struct regcache *regcache_xmalloc (struct gdbarch *gdbarch);
/* Transfer a raw register [0..NUM_REGS) between core-gdb and the
diff --git a/gdb/valops.c b/gdb/valops.c
index 3e72e94..df42e09 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1316,7 +1316,7 @@ hand_function_call (struct value *function, int nargs, struct value **args)
struct type *value_type;
unsigned char struct_return;
CORE_ADDR struct_addr = 0;
- char *retbuf;
+ struct regcache *retbuf;
struct cleanup *retbuf_cleanup;
struct inferior_status *inf_status;
struct cleanup *inf_status_cleanup;
@@ -1339,8 +1339,8 @@ hand_function_call (struct value *function, int nargs, struct value **args)
containing the register values). This chain is create BEFORE the
inf_status chain so that the inferior status can cleaned up
(restored or discarded) without having the retbuf freed. */
- retbuf = xmalloc (REGISTER_BYTES);
- retbuf_cleanup = make_cleanup (xfree, retbuf);
+ retbuf = regcache_xmalloc (current_gdbarch);
+ retbuf_cleanup = make_cleanup_regcache_xfree (retbuf);
/* A cleanup for the inferior status. Create this AFTER the retbuf
so that this can be discarded or applied without interfering with
diff --git a/gdb/value.h b/gdb/value.h
index a0eb990..a596f5b 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -23,6 +23,8 @@
#if !defined (VALUE_H)
#define VALUE_H 1
+struct regcache;
+
#include "doublest.h"
/*
@@ -406,7 +408,8 @@ extern struct value *value_repeat (struct value *arg1, int count);
extern struct value *value_subscript (struct value *array, struct value *idx);
extern struct value *value_being_returned (struct type *valtype,
- char *retbuf, int struct_return);
+ struct regcache *retbuf,
+ int struct_return);
extern struct value *value_in (struct value *element, struct value *set);
diff --git a/gdb/values.c b/gdb/values.c
index 28f0f4f..3c577f3 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. */
@@ -1224,8 +1225,10 @@ value_from_double (struct type *type, DOUBLEST num)
/* ARGSUSED */
struct value *
-value_being_returned (struct type *valtype, char *retbuf, int struct_return)
+value_being_returned (struct type *valtype, struct regcache *buf,
+ int struct_return)
{
+ char *retbuf = deprecated_grub_regcache_for_registers (buf);
struct value *val;
CORE_ADDR addr;