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 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
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)
#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: */
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;
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;
}
\f
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));
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));
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);
xfree (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)
{
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
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;
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
#if !defined (VALUE_H)
#define VALUE_H 1
+struct regcache;
+
#include "doublest.h"
/*
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);
#include "demangle.h"
#include "doublest.h"
#include "gdb_assert.h"
+#include "regcache.h"
/* Prototypes for exported functions. */
/* 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;