aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2004-03-20 04:58:13 +0000
committerKevin Buettner <kevinb@redhat.com>2004-03-20 04:58:13 +0000
commit81332287ebbad13ab3460c01b84a1abd2b7e23b8 (patch)
tree36db2ef1ba9295aa8553803e0f18acc5a69aab6b /gdb
parent61a650991d2ab71dc4b78e665e3fb53b41346c81 (diff)
downloadgdb-81332287ebbad13ab3460c01b84a1abd2b7e23b8.zip
gdb-81332287ebbad13ab3460c01b84a1abd2b7e23b8.tar.gz
gdb-81332287ebbad13ab3460c01b84a1abd2b7e23b8.tar.bz2
Remove old frame code. Enable new frame code for AIX.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog24
-rw-r--r--gdb/ppc-linux-tdep.c118
-rw-r--r--gdb/ppc-tdep.h10
-rw-r--r--gdb/rs6000-tdep.c284
4 files changed, 29 insertions, 407 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c0d7178..442af68 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,27 @@
+2004-03-19 Kevin Buettner <kevinb@redhat.com>
+
+ * ppc_tdep.h (ppc_linux_frame_saved_pc)
+ (ppc_linux_init_extra_frame_info)
+ (ppc_linux_frameless_function_invocation)
+ (ppc_linux_frame_init_saved_regs, ppc_linux_frame_chain)
+ (rs6000_frame_saved_pc, rs6000_init_extra_frame_info)
+ (rs6000_frameless_function_invocation, rs6000_frame_init_saved_regs)
+ (rs6000_frame_chain): Delete declarations.
+ * ppc-linux-tdep.c (ppc_linux_frame_saved_pc)
+ (ppc_linux_init_extra_frame_info)
+ (ppc_linux_frameless_function_invocation)
+ (ppc_linux_frame_init_saved_regs, ppc_linux_frame_chain): Delete.
+ (ppc_linux_init_abi): Remove registration of above deleted functions.
+ * rs6000-tdep.c (rs6000_init_extra_frame_info)
+ (rs6000_frame_init_saved_regs, rs6000_init_frame_pc_first)
+ (rs6000_frame_args_address, rs6000_saved_pc_after_call)
+ (rs6000_pop_frame, rs6000_frameless_function_invocation)
+ (rs6000_frame_saved_pc, rs6000_frame_chain): Delete.
+ (rs6000_gdbarch_init): Remove registration of above deleted functions.
+ Use rs6000_unwind_pc(), rs6000_frame_sniffer(),
+ rs6000_unwind_dummy_id(), and rs6000_frame_base_sniffer() for
+ frame management for all OSABIs.
+
2004-03-19 Andrew Cagney <cagney@redhat.com>
Committed by Kevin Buettner <kevinb@redhat.com>.
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 901ae5c..86271e2 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -340,111 +340,6 @@ ppc_linux_skip_trampoline_code (CORE_ADDR pc)
return SYMBOL_VALUE_ADDRESS (msymbol);
}
-/* The rs6000 version of FRAME_SAVED_PC will almost work for us. The
- signal handler details are different, so we'll handle those here
- and call the rs6000 version to do the rest. */
-CORE_ADDR
-ppc_linux_frame_saved_pc (struct frame_info *fi)
-{
- if ((get_frame_type (fi) == SIGTRAMP_FRAME))
- {
- CORE_ADDR regs_addr =
- read_memory_integer (get_frame_base (fi)
- + PPC_LINUX_REGS_PTR_OFFSET, 4);
- /* return the NIP in the regs array */
- return read_memory_integer (regs_addr + 4 * PPC_LINUX_PT_NIP, 4);
- }
- else if (get_next_frame (fi)
- && (get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
- {
- CORE_ADDR regs_addr =
- read_memory_integer (get_frame_base (get_next_frame (fi))
- + PPC_LINUX_REGS_PTR_OFFSET, 4);
- /* return LNK in the regs array */
- return read_memory_integer (regs_addr + 4 * PPC_LINUX_PT_LNK, 4);
- }
- else
- return rs6000_frame_saved_pc (fi);
-}
-
-void
-ppc_linux_init_extra_frame_info (int fromleaf, struct frame_info *fi)
-{
- rs6000_init_extra_frame_info (fromleaf, fi);
-
- if (get_next_frame (fi) != 0)
- {
- /* We're called from get_prev_frame_info; check to see if
- this is a signal frame by looking to see if the pc points
- at trampoline code */
- if (ppc_linux_at_sigtramp_return_path (get_frame_pc (fi)))
- deprecated_set_frame_type (fi, SIGTRAMP_FRAME);
- else
- /* FIXME: cagney/2002-11-10: Is this double bogus? What
- happens if the frame has previously been marked as a dummy? */
- deprecated_set_frame_type (fi, NORMAL_FRAME);
- }
-}
-
-int
-ppc_linux_frameless_function_invocation (struct frame_info *fi)
-{
- /* We'll find the wrong thing if we let
- rs6000_frameless_function_invocation () search for a signal trampoline */
- if (ppc_linux_at_sigtramp_return_path (get_frame_pc (fi)))
- return 0;
- else
- return rs6000_frameless_function_invocation (fi);
-}
-
-void
-ppc_linux_frame_init_saved_regs (struct frame_info *fi)
-{
- if ((get_frame_type (fi) == SIGTRAMP_FRAME))
- {
- CORE_ADDR regs_addr;
- int i;
- if (deprecated_get_frame_saved_regs (fi))
- return;
-
- frame_saved_regs_zalloc (fi);
-
- regs_addr =
- read_memory_integer (get_frame_base (fi)
- + PPC_LINUX_REGS_PTR_OFFSET, 4);
- deprecated_get_frame_saved_regs (fi)[PC_REGNUM] = regs_addr + 4 * PPC_LINUX_PT_NIP;
- deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ps_regnum] =
- regs_addr + 4 * PPC_LINUX_PT_MSR;
- deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_cr_regnum] =
- regs_addr + 4 * PPC_LINUX_PT_CCR;
- deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_lr_regnum] =
- regs_addr + 4 * PPC_LINUX_PT_LNK;
- deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_ctr_regnum] =
- regs_addr + 4 * PPC_LINUX_PT_CTR;
- deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_xer_regnum] =
- regs_addr + 4 * PPC_LINUX_PT_XER;
- deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_mq_regnum] =
- regs_addr + 4 * PPC_LINUX_PT_MQ;
- for (i = 0; i < 32; i++)
- deprecated_get_frame_saved_regs (fi)[gdbarch_tdep (current_gdbarch)->ppc_gp0_regnum + i] =
- regs_addr + 4 * PPC_LINUX_PT_R0 + 4 * i;
- for (i = 0; i < 32; i++)
- deprecated_get_frame_saved_regs (fi)[FP0_REGNUM + i] = regs_addr + 4 * PPC_LINUX_PT_FPR0 + 8 * i;
- }
- else
- rs6000_frame_init_saved_regs (fi);
-}
-
-CORE_ADDR
-ppc_linux_frame_chain (struct frame_info *thisframe)
-{
- /* Kernel properly constructs the frame chain for the handler */
- if ((get_frame_type (thisframe) == SIGTRAMP_FRAME))
- return read_memory_integer (get_frame_base (thisframe), 4);
- else
- return rs6000_frame_chain (thisframe);
-}
-
/* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint
in much the same fashion as memory_remove_breakpoint in mem-break.c,
but is careful not to write back the previous contents if the code
@@ -1190,19 +1085,6 @@ ppc_linux_init_abi (struct gdbarch_info info,
PowerOpen struct convention. */
set_gdbarch_return_value (gdbarch, ppc_linux_return_value);
-#if 0
- /* Note: kevinb/2002-04-12: See note in rs6000_gdbarch_init regarding
- *_push_arguments(). The same remarks hold for the methods below. */
- set_gdbarch_deprecated_frameless_function_invocation (gdbarch, ppc_linux_frameless_function_invocation);
- set_gdbarch_deprecated_frame_chain (gdbarch, ppc_linux_frame_chain);
- set_gdbarch_deprecated_frame_saved_pc (gdbarch, ppc_linux_frame_saved_pc);
-
- set_gdbarch_deprecated_frame_init_saved_regs (gdbarch,
- ppc_linux_frame_init_saved_regs);
- set_gdbarch_deprecated_init_extra_frame_info (gdbarch,
- ppc_linux_init_extra_frame_info);
-#endif
-
set_gdbarch_memory_remove_breakpoint (gdbarch,
ppc_linux_memory_remove_breakpoint);
diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h
index cad5928..d570f79 100644
--- a/gdb/ppc-tdep.h
+++ b/gdb/ppc-tdep.h
@@ -30,11 +30,6 @@ struct regcache;
struct type;
/* From ppc-linux-tdep.c... */
-CORE_ADDR ppc_linux_frame_saved_pc (struct frame_info *fi);
-void ppc_linux_init_extra_frame_info (int fromleaf, struct frame_info *);
-int ppc_linux_frameless_function_invocation (struct frame_info *);
-void ppc_linux_frame_init_saved_regs (struct frame_info *);
-CORE_ADDR ppc_linux_frame_chain (struct frame_info *);
enum return_value_convention ppc_sysv_abi_return_value (struct gdbarch *gdbarch,
struct type *valtype,
struct regcache *regcache,
@@ -77,11 +72,6 @@ enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarc
const void *writebuf);
/* From rs6000-tdep.c... */
-CORE_ADDR rs6000_frame_saved_pc (struct frame_info *fi);
-void rs6000_init_extra_frame_info (int fromleaf, struct frame_info *);
-int rs6000_frameless_function_invocation (struct frame_info *);
-void rs6000_frame_init_saved_regs (struct frame_info *);
-CORE_ADDR rs6000_frame_chain (struct frame_info *);
int altivec_register_p (int regno);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index aefa629..a8e7023 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -183,68 +183,6 @@ struct frame_extra_info
CORE_ADDR initial_sp; /* initial stack pointer. */
};
-void
-rs6000_init_extra_frame_info (int fromleaf, struct frame_info *fi)
-{
- struct frame_extra_info *extra_info =
- frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
- extra_info->initial_sp = 0;
- if (get_next_frame (fi) != NULL
- && get_frame_pc (fi) < TEXT_SEGMENT_BASE)
- /* We're in get_prev_frame */
- /* and this is a special signal frame. */
- /* (fi->pc will be some low address in the kernel, */
- /* to which the signal handler returns). */
- deprecated_set_frame_type (fi, SIGTRAMP_FRAME);
-}
-
-/* Put here the code to store, into a struct frame_saved_regs,
- the addresses of the saved registers of frame described by FRAME_INFO.
- This includes special registers such as pc and fp saved in special
- ways in the stack frame. sp is even more special:
- the address we return for it IS the sp for the next frame. */
-
-/* In this implementation for RS/6000, we do *not* save sp. I am
- not sure if it will be needed. The following function takes care of gpr's
- and fpr's only. */
-
-void
-rs6000_frame_init_saved_regs (struct frame_info *fi)
-{
- frame_get_saved_regs (fi, NULL);
-}
-
-static CORE_ADDR
-rs6000_init_frame_pc_first (int fromleaf, struct frame_info *prev)
-{
- return (fromleaf
- ? DEPRECATED_SAVED_PC_AFTER_CALL (get_next_frame (prev))
- : frame_relative_level (prev) > 0
- ? DEPRECATED_FRAME_SAVED_PC (get_next_frame (prev))
- : read_pc ());
-}
-
-static CORE_ADDR
-rs6000_frame_args_address (struct frame_info *fi)
-{
- struct frame_extra_info *extra_info = get_frame_extra_info (fi);
- if (extra_info->initial_sp != 0)
- return extra_info->initial_sp;
- else
- return frame_initial_stack_address (fi);
-}
-
-/* Immediately after a function call, return the saved pc.
- Can't go through the frames for this because on some machines
- the new frame is not set up until the new function executes
- some instructions. */
-
-static CORE_ADDR
-rs6000_saved_pc_after_call (struct frame_info *fi)
-{
- return read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum);
-}
-
/* Get the ith function argument for the current function. */
static CORE_ADDR
rs6000_fetch_pointer_argument (struct frame_info *frame, int argi,
@@ -1038,79 +976,6 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata)
*************************************************************************/
-/* Pop the innermost frame, go back to the caller. */
-
-static void
-rs6000_pop_frame (void)
-{
- CORE_ADDR pc, lr, sp, prev_sp, addr; /* %pc, %lr, %sp */
- struct rs6000_framedata fdata;
- struct frame_info *frame = get_current_frame ();
- int ii, wordsize;
-
- pc = read_pc ();
- sp = get_frame_base (frame);
-
- if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (frame),
- get_frame_base (frame),
- get_frame_base (frame)))
- {
- generic_pop_dummy_frame ();
- flush_cached_frames ();
- return;
- }
-
- /* Make sure that all registers are valid. */
- deprecated_read_register_bytes (0, NULL, DEPRECATED_REGISTER_BYTES);
-
- /* Figure out previous %pc value. If the function is frameless, it is
- still in the link register, otherwise walk the frames and retrieve the
- saved %pc value in the previous frame. */
-
- addr = get_frame_func (frame);
- (void) skip_prologue (addr, get_frame_pc (frame), &fdata);
-
- wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
- if (fdata.frameless)
- prev_sp = sp;
- else
- prev_sp = read_memory_addr (sp, wordsize);
- if (fdata.lr_offset == 0)
- lr = read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum);
- else
- lr = read_memory_addr (prev_sp + fdata.lr_offset, wordsize);
-
- /* reset %pc value. */
- write_register (PC_REGNUM, lr);
-
- /* reset register values if any was saved earlier. */
-
- if (fdata.saved_gpr != -1)
- {
- addr = prev_sp + fdata.gpr_offset;
- for (ii = fdata.saved_gpr; ii <= 31; ++ii)
- {
- read_memory (addr, &deprecated_registers[DEPRECATED_REGISTER_BYTE (ii)],
- wordsize);
- addr += wordsize;
- }
- }
-
- if (fdata.saved_fpr != -1)
- {
- addr = prev_sp + fdata.fpr_offset;
- for (ii = fdata.saved_fpr; ii <= 31; ++ii)
- {
- read_memory (addr, &deprecated_registers[DEPRECATED_REGISTER_BYTE (ii + FP0_REGNUM)], 8);
- addr += 8;
- }
- }
-
- write_register (SP_REGNUM, prev_sp);
- target_store_registers (-1);
- flush_cached_frames ();
-}
-
/* All the ABI's require 16 byte alignment. */
static CORE_ADDR
rs6000_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
@@ -1510,99 +1375,6 @@ rs6000_skip_trampoline_code (CORE_ADDR pc)
return pc;
}
-/* Determines whether the function FI has a frame on the stack or not. */
-
-int
-rs6000_frameless_function_invocation (struct frame_info *fi)
-{
- CORE_ADDR func_start;
- struct rs6000_framedata fdata;
-
- /* Don't even think about framelessness except on the innermost frame
- or if the function was interrupted by a signal. */
- if (get_next_frame (fi) != NULL
- && !(get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
- return 0;
-
- func_start = get_frame_func (fi);
-
- /* If we failed to find the start of the function, it is a mistake
- to inspect the instructions. */
-
- if (!func_start)
- {
- /* A frame with a zero PC is usually created by dereferencing a NULL
- function pointer, normally causing an immediate core dump of the
- inferior. Mark function as frameless, as the inferior has no chance
- of setting up a stack frame. */
- if (get_frame_pc (fi) == 0)
- return 1;
- else
- return 0;
- }
-
- (void) skip_prologue (func_start, get_frame_pc (fi), &fdata);
- return fdata.frameless;
-}
-
-/* Return the PC saved in a frame. */
-
-CORE_ADDR
-rs6000_frame_saved_pc (struct frame_info *fi)
-{
- CORE_ADDR func_start;
- struct rs6000_framedata fdata;
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
- int wordsize = tdep->wordsize;
-
- if ((get_frame_type (fi) == SIGTRAMP_FRAME))
- return read_memory_addr (get_frame_base (fi) + SIG_FRAME_PC_OFFSET,
- wordsize);
-
- if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi),
- get_frame_base (fi),
- get_frame_base (fi)))
- return deprecated_read_register_dummy (get_frame_pc (fi),
- get_frame_base (fi), PC_REGNUM);
-
- func_start = get_frame_func (fi);
-
- /* If we failed to find the start of the function, it is a mistake
- to inspect the instructions. */
- if (!func_start)
- return 0;
-
- (void) skip_prologue (func_start, get_frame_pc (fi), &fdata);
-
- if (fdata.lr_offset == 0 && get_next_frame (fi) != NULL)
- {
- if ((get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME))
- return read_memory_addr ((get_frame_base (get_next_frame (fi))
- + SIG_FRAME_LR_OFFSET),
- wordsize);
- else if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (get_next_frame (fi)), 0, 0))
- /* The link register wasn't saved by this frame and the next
- (inner, newer) frame is a dummy. Get the link register
- value by unwinding it from that [dummy] frame. */
- {
- ULONGEST lr;
- frame_unwind_unsigned_register (get_next_frame (fi),
- tdep->ppc_lr_regnum, &lr);
- return lr;
- }
- else
- return read_memory_addr (DEPRECATED_FRAME_CHAIN (fi)
- + tdep->lr_frame_offset,
- wordsize);
- }
-
- if (fdata.lr_offset == 0)
- return read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum);
-
- return read_memory_addr (DEPRECATED_FRAME_CHAIN (fi) + fdata.lr_offset,
- wordsize);
-}
-
/* If saved registers of frame FI are not known yet, read and cache them.
&FDATAP contains rs6000_framedata; TDATAP can be NULL,
in which case the framedata are read. */
@@ -1780,47 +1552,6 @@ frame_initial_stack_address (struct frame_info *fi)
return get_frame_extra_info (fi)->initial_sp;
}
-/* Describe the pointer in each stack frame to the previous stack frame
- (its caller). */
-
-/* DEPRECATED_FRAME_CHAIN takes a frame's nominal address and produces
- the frame's chain-pointer. */
-
-/* In the case of the RS/6000, the frame's nominal address
- is the address of a 4-byte word containing the calling frame's address. */
-
-CORE_ADDR
-rs6000_frame_chain (struct frame_info *thisframe)
-{
- CORE_ADDR fp, fpp, lr;
- int wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
-
- if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (thisframe),
- get_frame_base (thisframe),
- get_frame_base (thisframe)))
- /* A dummy frame always correctly chains back to the previous
- frame. */
- return read_memory_addr (get_frame_base (thisframe), wordsize);
-
- if (deprecated_inside_entry_file (get_frame_pc (thisframe))
- || get_frame_pc (thisframe) == entry_point_address ())
- return 0;
-
- if ((get_frame_type (thisframe) == SIGTRAMP_FRAME))
- fp = read_memory_addr (get_frame_base (thisframe) + SIG_FRAME_FP_OFFSET,
- wordsize);
- else if (get_next_frame (thisframe) != NULL
- && (get_frame_type (get_next_frame (thisframe)) == SIGTRAMP_FRAME)
- && (DEPRECATED_FRAMELESS_FUNCTION_INVOCATION_P ()
- && DEPRECATED_FRAMELESS_FUNCTION_INVOCATION (thisframe)))
- /* A frameless function interrupted by a signal did not change the
- frame pointer. */
- fp = get_frame_base (thisframe);
- else
- fp = read_memory_addr (get_frame_base (thisframe), wordsize);
- return fp;
-}
-
/* Return the size of register REG when words are WORDSIZE bytes long. If REG
isn't available with that word size, return 0. */
@@ -3179,16 +2910,11 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
default:
set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
- set_gdbarch_deprecated_pop_frame (gdbarch, rs6000_pop_frame);
- set_gdbarch_deprecated_frame_args_address (gdbarch, rs6000_frame_args_address);
- set_gdbarch_deprecated_frame_locals_address (gdbarch, rs6000_frame_args_address);
- set_gdbarch_deprecated_saved_pc_after_call (gdbarch, rs6000_saved_pc_after_call);
- set_gdbarch_deprecated_frameless_function_invocation (gdbarch, rs6000_frameless_function_invocation);
- set_gdbarch_deprecated_frame_chain (gdbarch, rs6000_frame_chain);
- set_gdbarch_deprecated_frame_saved_pc (gdbarch, rs6000_frame_saved_pc);
- set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, rs6000_frame_init_saved_regs);
- set_gdbarch_deprecated_init_extra_frame_info (gdbarch, rs6000_init_extra_frame_info);
- set_gdbarch_deprecated_init_frame_pc_first (gdbarch, rs6000_init_frame_pc_first);
+
+ set_gdbarch_unwind_pc (gdbarch, rs6000_unwind_pc);
+ frame_unwind_append_sniffer (gdbarch, rs6000_frame_sniffer);
+ set_gdbarch_unwind_dummy_id (gdbarch, rs6000_unwind_dummy_id);
+ frame_base_append_sniffer (gdbarch, rs6000_frame_base_sniffer);
}
if (from_xcoff_exec)