* inferior.h (read_sp): Remove prototype.
* regcache.c (read_sp): Remove. * gcore.c (derive_stack_segment): Use get_frame_sp instead of read_sp. * infcall.c (call_function_by_hand): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Use regcache instead of calling read_sp. * rs6000-tdep.c (rs6000_push_dummy_call): Likewise.
This commit is contained in:
parent
adc44effcb
commit
fb4443d8bc
|
@ -1,3 +1,13 @@
|
|||
2007-05-13 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* inferior.h (read_sp): Remove prototype.
|
||||
* regcache.c (read_sp): Remove.
|
||||
* gcore.c (derive_stack_segment): Use get_frame_sp instead of read_sp.
|
||||
* infcall.c (call_function_by_hand): Likewise.
|
||||
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Use regcache instead
|
||||
of calling read_sp.
|
||||
* rs6000-tdep.c (rs6000_push_dummy_call): Likewise.
|
||||
|
||||
2007-05-11 Ulrich Weigand <uweigand@de.ibm.com>
|
||||
|
||||
* i386-linux-nat.c (i386_linux_resume): Use regcache functions
|
||||
|
|
|
@ -187,8 +187,8 @@ derive_stack_segment (bfd_vma *bottom, bfd_vma *top)
|
|||
/* Save frame pointer of TOS frame. */
|
||||
*top = get_frame_base (fi);
|
||||
/* If current stack pointer is more "inner", use that instead. */
|
||||
if (INNER_THAN (read_sp (), *top))
|
||||
*top = read_sp ();
|
||||
if (INNER_THAN (get_frame_sp (fi), *top))
|
||||
*top = get_frame_sp (fi);
|
||||
|
||||
/* Find prev-most frame. */
|
||||
while ((tmp_fi = get_prev_frame (fi)) != NULL)
|
||||
|
|
|
@ -368,7 +368,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
|
|||
|
||||
/* Ensure that the initial SP is correctly aligned. */
|
||||
{
|
||||
CORE_ADDR old_sp = read_sp ();
|
||||
CORE_ADDR old_sp = get_frame_sp (get_current_frame ());
|
||||
if (gdbarch_frame_align_p (current_gdbarch))
|
||||
{
|
||||
sp = gdbarch_frame_align (current_gdbarch, old_sp);
|
||||
|
|
|
@ -174,8 +174,6 @@ extern void write_pc_pid (CORE_ADDR, ptid_t);
|
|||
|
||||
extern void generic_target_write_pc (CORE_ADDR, ptid_t);
|
||||
|
||||
extern CORE_ADDR read_sp (void);
|
||||
|
||||
extern CORE_ADDR unsigned_pointer_to_address (struct type *type,
|
||||
const gdb_byte *buf);
|
||||
extern void unsigned_address_to_pointer (struct type *type, gdb_byte *buf,
|
||||
|
|
|
@ -51,10 +51,12 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||
int struct_return, CORE_ADDR struct_addr)
|
||||
{
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
|
||||
const CORE_ADDR saved_sp = read_sp ();
|
||||
ULONGEST saved_sp;
|
||||
int argspace = 0; /* 0 is an initial wrong guess. */
|
||||
int write_pass;
|
||||
|
||||
regcache_cooked_read_unsigned (regcache, SP_REGNUM, &saved_sp);
|
||||
|
||||
/* Go through the argument list twice.
|
||||
|
||||
Pass 1: Figure out how much new stack space is required for
|
||||
|
@ -578,10 +580,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||
{
|
||||
CORE_ADDR func_addr = find_function_addr (function, NULL);
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
|
||||
/* By this stage in the proceedings, SP has been decremented by "red
|
||||
zone size" + "struct return size". Fetch the stack-pointer from
|
||||
before this and use that as the BACK_CHAIN. */
|
||||
const CORE_ADDR back_chain = read_sp ();
|
||||
ULONGEST back_chain;
|
||||
/* See for-loop comment below. */
|
||||
int write_pass;
|
||||
/* Size of the Altivec's vector parameter region, the final value is
|
||||
|
@ -599,6 +598,11 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||
the possible values of tdep->wordsize. */
|
||||
gdb_assert (tdep->wordsize == 8);
|
||||
|
||||
/* By this stage in the proceedings, SP has been decremented by "red
|
||||
zone size" + "struct return size". Fetch the stack-pointer from
|
||||
before this and use that as the BACK_CHAIN. */
|
||||
regcache_cooked_read_unsigned (regcache, SP_REGNUM, &back_chain);
|
||||
|
||||
/* Go through the argument list twice.
|
||||
|
||||
Pass 1: Compute the function call's stack space and register
|
||||
|
|
|
@ -867,8 +867,7 @@ regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
|
|||
}
|
||||
|
||||
|
||||
/* read_pc, write_pc, read_sp, etc. Special handling for registers
|
||||
PC, SP, and FP. */
|
||||
/* read_pc, write_pc, etc. Special handling for register PC. */
|
||||
|
||||
/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc() and
|
||||
read_sp(), will eventually be replaced by per-frame methods.
|
||||
|
@ -941,21 +940,6 @@ write_pc (CORE_ADDR pc)
|
|||
write_pc_pid (pc, inferior_ptid);
|
||||
}
|
||||
|
||||
/* Cope with strage ways of getting to the stack and frame pointers */
|
||||
|
||||
CORE_ADDR
|
||||
read_sp (void)
|
||||
{
|
||||
if (TARGET_READ_SP_P ())
|
||||
return TARGET_READ_SP ();
|
||||
else if (gdbarch_unwind_sp_p (current_gdbarch))
|
||||
return get_frame_sp (get_current_frame ());
|
||||
else if (SP_REGNUM >= 0)
|
||||
/* Try SP_REGNUM last: this makes all sorts of [wrong] assumptions
|
||||
about the architecture so put it at the end. */
|
||||
return read_register (SP_REGNUM);
|
||||
internal_error (__FILE__, __LINE__, _("read_sp: Unable to find SP"));
|
||||
}
|
||||
|
||||
static void
|
||||
reg_flush_command (char *command, int from_tty)
|
||||
|
|
|
@ -1591,7 +1591,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||
struct value *arg = 0;
|
||||
struct type *type;
|
||||
|
||||
CORE_ADDR saved_sp;
|
||||
ULONGEST saved_sp;
|
||||
|
||||
/* The calling convention this function implements assumes the
|
||||
processor has floating-point registers. We shouldn't be using it
|
||||
|
@ -1693,7 +1693,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||
|
||||
ran_out_of_registers_for_arguments:
|
||||
|
||||
saved_sp = read_sp ();
|
||||
regcache_cooked_read_unsigned (regcache, SP_REGNUM, &saved_sp);
|
||||
|
||||
/* Location for 8 parameters are always reserved. */
|
||||
sp -= wordsize * 8;
|
||||
|
|
Loading…
Reference in New Issue