This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] d10v dummy frame update
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 27 Mar 2003 10:12:20 -0500
- Subject: [commit] d10v dummy frame update
Hello,
This updates the d10v so that it uses push_dummy_call() instead of
push_arguments(), write_sp() and push_return_address().
committed,
Andrew
2003-03-27 Andrew Cagney <cagney at redhat dot com>
* d10v-tdep.c (d10v_gdbarch_init): Set push_dummy_call instead of
push_arguments. Don't set push_return_address or write_sp.
(d10v_push_dummy_call): Replace d10v_push_arguments.
(d10v_push_return_address, d10v_write_sp): Delete function,
handled by push_dummy_call.
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.91
diff -u -r1.91 d10v-tdep.c
--- d10v-tdep.c 26 Mar 2003 22:39:52 -0000 1.91
+++ d10v-tdep.c 27 Mar 2003 15:07:45 -0000
@@ -949,30 +949,12 @@
return (d10v_make_daddr (read_register (SP_REGNUM)));
}
-static void
-d10v_write_sp (CORE_ADDR val)
-{
- write_register (SP_REGNUM, d10v_convert_daddr_to_raw (val));
-}
-
static CORE_ADDR
d10v_read_fp (void)
{
return (d10v_make_daddr (read_register (FP_REGNUM)));
}
-/* Function: push_return_address (pc)
- Set up the return address for the inferior function call.
- Needed for targets where we don't actually execute a JSR/BSR instruction */
-
-static CORE_ADDR
-d10v_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
-{
- write_register (LR_REGNUM, d10v_convert_iaddr_to_raw (CALL_DUMMY_ADDRESS ()));
- return sp;
-}
-
-
/* When arguments must be pushed onto the stack, they go on in reverse
order. The below implements a FILO (stack) to do this. */
@@ -1010,20 +992,26 @@
static CORE_ADDR
-d10v_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
- int struct_return, CORE_ADDR struct_addr)
+d10v_push_dummy_call (struct gdbarch *gdbarch, struct regcache *regcache,
+ CORE_ADDR dummy_addr, int nargs, struct value **args,
+ CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
{
int i;
int regnum = ARG1_REGNUM;
struct stack_item *si = NULL;
long val;
+ /* Set the return address. For the d10v, the return breakpoint is
+ always at DUMMY_ADDR. */
+ regcache_cooked_write_unsigned (regcache, LR_REGNUM,
+ d10v_convert_iaddr_to_raw (dummy_addr));
+
/* If STRUCT_RETURN is true, then the struct return address (in
STRUCT_ADDR) will consume the first argument-passing register.
Both adjust the register count and store that value. */
if (struct_return)
{
- write_register (regnum, struct_addr);
+ regcache_cooked_write_unsigned (regcache, regnum, struct_addr);
regnum++;
}
@@ -1041,7 +1029,7 @@
/* fits in a single register, do not align */
{
val = extract_unsigned_integer (contents, len);
- write_register (regnum++, val);
+ regcache_cooked_write_unsigned (regcache, regnum++, val);
}
else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
/* value fits in remaining registers, store keeping left
@@ -1052,12 +1040,12 @@
for (b = 0; b < (len & ~1); b += 2)
{
val = extract_unsigned_integer (&contents[b], 2);
- write_register (regnum++, val);
+ regcache_cooked_write_unsigned (regcache, regnum++, val);
}
if (b < len)
{
val = extract_unsigned_integer (&contents[b], 1);
- write_register (regnum++, (val << 8));
+ regcache_cooked_write_unsigned (regcache, regnum++, (val << 8));
}
}
else
@@ -1075,6 +1063,10 @@
si = pop_stack_item (si);
}
+ /* Finally, update the SP register. */
+ regcache_cooked_write_unsigned (regcache, SP_REGNUM,
+ d10v_convert_daddr_to_raw (sp));
+
return sp;
}
@@ -1636,7 +1628,6 @@
set_gdbarch_write_pc (gdbarch, d10v_write_pc);
set_gdbarch_read_fp (gdbarch, d10v_read_fp);
set_gdbarch_read_sp (gdbarch, d10v_read_sp);
- set_gdbarch_write_sp (gdbarch, d10v_write_sp);
set_gdbarch_num_regs (gdbarch, d10v_num_regs);
set_gdbarch_sp_regnum (gdbarch, 15);
@@ -1692,9 +1683,7 @@
set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy);
set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value);
- set_gdbarch_deprecated_push_arguments (gdbarch, d10v_push_arguments);
- set_gdbarch_push_return_address (gdbarch, d10v_push_return_address);
-
+ set_gdbarch_push_dummy_call (gdbarch, d10v_push_dummy_call);
set_gdbarch_store_return_value (gdbarch, d10v_store_return_value);
set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, d10v_use_struct_convention);