+2002-11-18 Andrew Cagney <ac131313@redhat.com>
+
+ * frame.h (enum frame_type): Define.
+ (get_frame_type): Declare.
+ (struct frame_info): Add field `type'. Delete field
+ signal_handler_caller.
+ (deprecated_set_frame_signal_handler_caller): Declare.
+ * frame.c (get_frame_type): New function.
+ (deprecated_set_frame_type): New function.
+ (create_new_frame): Set the frame's type.
+ (get_prev_frame): Similar.
+ * sparc-tdep.c: Use get_frame_type instead of signal_handler_caller.
+ * s390-tdep.c: Ditto.
+ * m68klinux-nat.c: Ditto.
+ * ns32k-tdep.c: Ditto.
+ * x86-64-linux-tdep.c: Ditto.
+ * vax-tdep.c: Ditto.
+ * rs6000-tdep.c: Ditto.
+ * ppc-linux-tdep.c: Ditto.
+ * i386-interix-tdep.c: Ditto.
+ * mips-tdep.c: Ditto.
+ * m68k-tdep.c: Ditto.
+ * hppa-tdep.c: Ditto.
+ * ia64-tdep.c: Ditto.
+ * cris-tdep.c: Ditto.
+ * arm-tdep.c: Ditto.
+ * alpha-tdep.c: Ditto.
+ * i386-tdep.c: Ditto.
+ * stack.c: Ditto.
+ * ada-lang.c: Ditto.
+ * blockframe.c: Update.
+ * i386-interix-tdep.c (i386_interix_back_one_frame): Use
+ deprecated_set_frame_type instead of signal_handler_caller.
+ * ppc-linux-tdep.c (ppc_linux_init_extra_frame_info): Ditto.
+ * rs6000-tdep.c (rs6000_init_extra_frame_info): Ditto.
+ * breakpoint.h: Delete FIXME suggesting get_frame_type.
+
2002-11-18 Klee Dienes <kdienes@apple.com>
* Makefile.in (buildsym.o): Add dependency for gdb_assert.h.
for (; fi != NULL; level += 1, fi = get_prev_frame (fi))
{
- /* If fi is not the innermost frame, that normally means that fi->pc
- points to *after* the call instruction, and we want to get the line
- containing the call, never the next line. But if the next frame is
- a signal_handler_caller or a dummy frame, then the next frame was
- not entered as the result of a call, and we want to get the line
- containing fi->pc. */
+ /* If fi is not the innermost frame, that normally means that
+ fi->pc points at the return instruction (which is *after* the
+ call instruction), and we want to get the line containing the
+ call (because the call is where the user thinks the program
+ is). However, if the next frame is either a SIGTRAMP_FRAME
+ or a DUMMY_FRAME, then the next frame will contain a saved
+ interrupt PC and such a PC indicates the current (rather than
+ next) instruction/line, consequently, for such cases, want to
+ get the line containing fi->pc. */
sal =
find_pc_line (fi->pc,
fi->next != NULL
- && !fi->next->signal_handler_caller
+ && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
&& !deprecated_frame_in_dummy (fi->next));
if (sal.symtab && !is_ada_runtime_file (sal.symtab->filename))
{
#define SIGFRAME_REGSAVE_OFF (4 * 8)
#define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_REGSAVE_OFF + 32 * 8 + 8)
#endif
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
{
CORE_ADDR sigcontext_addr;
{
/* We have to get the saved sp from the sigcontext
if it is a signal handler frame. */
- if (regno == SP_REGNUM && !fi->signal_handler_caller)
+ if (regno == SP_REGNUM && !(get_frame_type (fi) == SIGTRAMP_FRAME))
return fi->frame;
else
{
alpha_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
/* We have to get the saved pc from the sigcontext
if it is a signal handler frame. */
- int pcreg = frame->signal_handler_caller ? PC_REGNUM
+ int pcreg = (get_frame_type (frame) == SIGTRAMP_FRAME) ? PC_REGNUM
: frame->extra_info->pc_reg;
if (proc_desc && PROC_DESC_IS_DUMMY (proc_desc))
proc_desc = find_proc_desc (pc, frame->next);
pcreg = proc_desc ? PROC_PC_REG (proc_desc) : ALPHA_RA_REGNUM;
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return alpha_frame_saved_pc (frame);
else
return read_register (pcreg);
&& PROC_FRAME_OFFSET (proc_desc) == 0
/* The previous frame from a sigtramp frame might be frameless
and have frame size zero. */
- && !frame->signal_handler_caller)
+ && !(get_frame_type (frame) == SIGTRAMP_FRAME))
return alpha_frame_past_sigtramp_frame (frame, saved_pc);
else
return read_next_frame_reg (frame, PROC_FRAME_REG (proc_desc))
char *name;
/* Do not set the saved registers for a sigtramp frame,
- alpha_find_saved_registers will do that for us.
- We can't use frame->signal_handler_caller, it is not yet set. */
+ alpha_find_saved_registers will do that for us. We can't
+ use (get_frame_type (frame) == SIGTRAMP_FRAME), it is not
+ yet set. */
+ /* FIXME: cagney/2002-11-18: This problem will go away once
+ frame.c:get_prev_frame() is modified to set the frame's
+ type before calling functions like this. */
find_pc_partial_function (frame->pc, &name,
(CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
if (!PC_IN_SIGTRAMP (frame->pc, name))
+ fi->next->extra_info->framesize);
/* Determine whether or not we're in a sigtramp frame.
- Unfortunately, it isn't sufficient to test
- fi->signal_handler_caller because this value is sometimes set
- after invoking INIT_EXTRA_FRAME_INFO. So we test *both*
- fi->signal_handler_caller and PC_IN_SIGTRAMP to determine if we
- need to use the sigcontext addresses for the saved registers.
+ Unfortunately, it isn't sufficient to test (get_frame_type (fi)
+ == SIGTRAMP_FRAME) because this value is sometimes set after
+ invoking INIT_EXTRA_FRAME_INFO. So we test *both*
+ (get_frame_type (fi) == SIGTRAMP_FRAME) and PC_IN_SIGTRAMP to
+ determine if we need to use the sigcontext addresses for the
+ saved registers.
Note: If an ARM PC_IN_SIGTRAMP method ever needs to compare
against the name of the function, the code below will have to be
changed to first fetch the name of the function and then pass
this name to PC_IN_SIGTRAMP. */
+ /* FIXME: cagney/2002-11-18: This problem will go away once
+ frame.c:get_prev_frame() is modified to set the frame's type
+ before calling functions like this. */
+
if (SIGCONTEXT_REGISTER_ADDRESS_P ()
- && (fi->signal_handler_caller || PC_IN_SIGTRAMP (fi->pc, (char *)0)))
+ && ((get_frame_type (fi) == SIGTRAMP_FRAME) || PC_IN_SIGTRAMP (fi->pc, (char *)0)))
{
for (reg = 0; reg < NUM_REGS; reg++)
fi->saved_regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
instruction. Unfortunately, this is not straightforward to do, so
we just use the address minus one, which is a good enough
approximation. */
- if (frame->next != 0 && frame->next->signal_handler_caller == 0)
+ /* FIXME: cagney/2002-11-10: Should this instead test for
+ NORMAL_FRAME? A dummy frame (in fact all the abnormal frames)
+ save the PC value in the block. */
+ if (frame->next != 0
+ && get_frame_type (frame->next) != SIGTRAMP_FRAME)
--pc;
return pc;
implements a functional superset of this function. The only reason
it hasn't been removed is because some architectures still don't
use the new framework. Once they have been fixed, this can go. */
-/* FIXME: cagney/2002-11-10: There should be a function (hmm,
- something like, enum { NORMAL_FRAME, DUMMY_FRAME, SIGTRAMP_FRAME }
- get_frame_type() ...) that the caller can use to determine the
- frame's type. This could replace this function, PC_IN_CALL_DUMMY,
- and fi->signal_handler_caller. */
extern int deprecated_frame_in_dummy (struct frame_info *);
extern int breakpoint_thread_match (CORE_ADDR, ptid_t);
CORE_ADDR frame
CORE_ADDR pc
- int signal_handler_caller
+ enum frame_type type;
CORE_ADDR return_pc
int leaf_function
of the register PC. All other frames contain the content of the
register PC in the next frame.
- The variable signal_handler_caller is non-zero when the frame is
- associated with the call of a signal handler.
+ The variable `type' indicates the frame's type: normal, SIGTRAMP
+ (associated with a signal handler), dummy (associated with a dummy
+ frame).
The variable return_pc contains the address where execution should be
resumed when the present frame has finished, the return address.
int
cris_frameless_function_invocation (struct frame_info *fi)
{
- if (fi->signal_handler_caller)
+ if ((get_frame_type (fi) == SIGTRAMP_FRAME))
return 0;
else
return frameless_look_for_prologue (fi);
create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
{
struct frame_info *fi;
- char *name;
+ enum frame_type type;
fi = (struct frame_info *)
obstack_alloc (&frame_cache_obstack,
fi->frame = addr;
fi->pc = pc;
- find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
- fi->signal_handler_caller = PC_IN_SIGTRAMP (fi->pc, name);
+ /* NOTE: cagney/2002-11-18: The code segments, found in
+ create_new_frame and get_prev_frame(), that initializes the
+ frames type is subtly different. The latter only updates ->type
+ when it encounters a SIGTRAMP_FRAME or DUMMY_FRAME. This stops
+ get_prev_frame() overriding the frame's type when the INIT code
+ has previously set it. This is really somewhat bogus. The
+ initialization, as seen in create_new_frame(), should occur
+ before the INIT function has been called. */
+ if (USE_GENERIC_DUMMY_FRAMES && PC_IN_CALL_DUMMY (fi->pc, 0, 0))
+ /* NOTE: cagney/2002-11-11: Does this even occure? */
+ type = DUMMY_FRAME;
+ else
+ {
+ char *name;
+ find_pc_partial_function (pc, &name, NULL, NULL);
+ if (PC_IN_SIGTRAMP (fi->pc, name))
+ type = SIGTRAMP_FRAME;
+ else
+ type = NORMAL_FRAME;
+ }
+ fi->type = type;
if (INIT_EXTRA_FRAME_INFO_P ())
INIT_EXTRA_FRAME_INFO (0, fi);
CORE_ADDR address = 0;
struct frame_info *prev;
int fromleaf;
- char *name;
/* Return the inner-most frame, when the caller passes in NULL. */
/* NOTE: cagney/2002-11-09: Not sure how this would happen. The
prev->next = next_frame;
prev->frame = address;
prev->level = next_frame->level + 1;
+ /* FIXME: cagney/2002-11-18: Should be setting the frame's type
+ here, before anything else, and not last. Various INIT functions
+ are full of work-arounds for the frames type not being set
+ correctly from the word go. Ulgh! */
+ prev->type = NORMAL_FRAME;
/* This change should not be needed, FIXME! We should determine
whether any targets *need* INIT_FRAME_PC to happen after
set_unwind_by_pc (prev->pc, prev->frame, &prev->register_unwind,
&prev->pc_unwind);
- find_pc_partial_function (prev->pc, &name,
- (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
- if (PC_IN_SIGTRAMP (prev->pc, name))
- prev->signal_handler_caller = 1;
+ /* NOTE: cagney/2002-11-18: The code segments, found in
+ create_new_frame and get_prev_frame(), that initializes the
+ frames type is subtly different. The latter only updates ->type
+ when it encounters a SIGTRAMP_FRAME or DUMMY_FRAME. This stops
+ get_prev_frame() overriding the frame's type when the INIT code
+ has previously set it. This is really somewhat bogus. The
+ initialization, as seen in create_new_frame(), should occur
+ before the INIT function has been called. */
+ if (USE_GENERIC_DUMMY_FRAMES
+ && PC_IN_CALL_DUMMY (prev->pc, 0, 0))
+ prev->type = DUMMY_FRAME;
+ else
+ {
+ /* FIXME: cagney/2002-11-10: This should be moved to before the
+ INIT code above so that the INIT code knows what the frame's
+ type is (in fact, for a [generic] dummy-frame, the type can
+ be set and then the entire initialization can be skipped.
+ Unforunatly, its the INIT code that sets the PC (Hmm, catch
+ 22). */
+ char *name;
+ find_pc_partial_function (prev->pc, &name, NULL, NULL);
+ if (PC_IN_SIGTRAMP (prev->pc, name))
+ prev->type = SIGTRAMP_FRAME;
+ /* FIXME: cagney/2002-11-11: Leave prev->type alone. Some
+ architectures are forcing the frame's type in INIT so we
+ don't want to override it here. Remember, NORMAL_FRAME == 0,
+ so it all works (just :-/). Once this initialization is
+ moved to the start of this function, all this nastness will
+ go away. */
+ }
return prev;
}
return frame->pc;
}
+enum frame_type
+get_frame_type (struct frame_info *frame)
+{
+ /* Some targets still don't use [generic] dummy frames. Catch them
+ here. */
+ if (!USE_GENERIC_DUMMY_FRAMES
+ && deprecated_frame_in_dummy (frame))
+ return DUMMY_FRAME;
+ return frame->type;
+}
+
+void
+deprecated_set_frame_type (struct frame_info *frame, enum frame_type type)
+{
+ /* Arrrg! See comment in "frame.h". */
+ frame->type = type;
+}
+
#ifdef FRAME_FIND_SAVED_REGS
/* XXX - deprecated. This is a compatibility function for targets
that do not yet implement FRAME_INIT_SAVED_REGS. */
for an invalid frame). */
extern int frame_relative_level (struct frame_info *fi);
+/* Return the frame's type. Some are real, some are signal
+ trampolines, and some are completly artificial (dummy). */
+
+enum frame_type
+{
+ /* A true stack frame, created by the target program during normal
+ execution. */
+ NORMAL_FRAME,
+ /* A fake frame, created by GDB when performing an inferior function
+ call. */
+ DUMMY_FRAME,
+ /* In a signal handler, various OSs handle this in various ways.
+ The main thing is that the frame may be far from normal. */
+ SIGTRAMP_FRAME
+};
+extern enum frame_type get_frame_type (struct frame_info *);
+
+/* FIXME: cagney/2002-11-10: Some targets want to directly mark a
+ frame as being of a specific type. This shouldn't be necessary.
+ PC_IN_SIGTRAMP() indicates a SIGTRAMP_FRAME and PC_IN_CALL_DUMMY()
+ indicates a DUMMY_FRAME. I suspect the real problem here is that
+ get_prev_frame() only sets initialized after INIT_EXTRA_FRAME_INFO
+ as been called. Consequently, some targets found that the frame's
+ type was wrong and tried to fix it. The correct fix is to modify
+ get_prev_frame() so that it initializes the frame's type before
+ calling any other functions. */
+extern void deprecated_set_frame_type (struct frame_info *,
+ enum frame_type type);
+
/* Unwind the stack frame so that the value of REGNUM, in the previous
(up, older) frame is returned. If VALUEP is NULL, don't
fetch/compute the value. Instead just return the location of the
moment leave this as speculation. */
int level;
- /* Nonzero if this is a frame associated with calling a signal handler.
-
- Set by machine-dependent code. On some machines, if
- the machine-dependent code fails to check for this, the backtrace
- will look relatively normal. For example, on the i386
- #3 0x158728 in sighold ()
- On other machines (e.g. rs6000), the machine-dependent code better
- set this to prevent us from trying to print it like a normal frame. */
- int signal_handler_caller;
+ /* The frame's type. */
+ enum frame_type type;
/* For each register, address of where it was saved on entry to
the frame, or zero if it was not saved on entry to this frame.
#ifdef FRAME_SAVED_PC_IN_SIGTRAMP
/* Deal with signal handler caller frames too. */
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
{
CORE_ADDR rp;
FRAME_SAVED_PC_IN_SIGTRAMP (frame, &rp);
register area to get the return pointer (the values
in the registers may not correspond to anything useful). */
if (frame->next
- && (frame->next->signal_handler_caller
+ && ((get_frame_type (frame->next) == SIGTRAMP_FRAME)
|| pc_in_interrupt_handler (frame->next->pc)))
{
struct frame_saved_regs saved_regs;
information out of the saved register info. */
if (rp_offset == 0
&& frame->next
- && (frame->next->signal_handler_caller
+ && ((get_frame_type (frame->next) == SIGTRAMP_FRAME)
|| pc_in_interrupt_handler (frame->next->pc)))
{
struct frame_saved_regs saved_regs;
frame_base = read_memory_integer (frame->frame + SP_REGNUM * 4,
TARGET_PTR_BIT / 8);
#ifdef FRAME_BASE_BEFORE_SIGTRAMP
- else if (frame->signal_handler_caller)
+ else if ((get_frame_type (frame) == SIGTRAMP_FRAME))
{
FRAME_BASE_BEFORE_SIGTRAMP (frame, &frame_base);
}
}
if (u->Save_SP
- || tmp_frame->signal_handler_caller
+ || (get_frame_type (tmp_frame) == SIGTRAMP_FRAME)
|| pc_in_interrupt_handler (tmp_frame->pc))
break;
/* We may have walked down the chain into a function with a frame
pointer. */
if (u->Save_SP
- && !tmp_frame->signal_handler_caller
+ && !(get_frame_type (tmp_frame) == SIGTRAMP_FRAME)
&& !pc_in_interrupt_handler (tmp_frame->pc))
{
return read_memory_integer (tmp_frame->frame, TARGET_PTR_BIT / 8);
and doesn't "call" an interrupt routine or signal handler caller,
then its not valid. */
if (u->Save_SP || u->Total_frame_size || u->stub_unwind.stub_type != 0
- || (thisframe->next && thisframe->next->signal_handler_caller)
+ || (thisframe->next && (get_frame_type (thisframe->next) == SIGTRAMP_FRAME))
|| (next_u && next_u->HP_UX_interrupt_marker))
return 1;
#ifdef FRAME_FIND_SAVED_REGS_IN_SIGTRAMP
/* Handle signal handler callers. */
- if (frame_info->signal_handler_caller)
+ if ((get_frame_type (frame_info) == SIGTRAMP_FRAME))
{
FRAME_FIND_SAVED_REGS_IN_SIGTRAMP (frame_info, frame_saved_regs);
return;
be a signal handler caller). If we're dealing with a signal
handler caller, this will return valid, which is fine. If not,
it'll make the correct test. */
- return (thisframe->signal_handler_caller
+ return ((get_frame_type (thisframe) == SIGTRAMP_FRAME)
|| (chain != 0
&& !inside_entry_file (read_memory_integer
(thisframe->frame + 4, 4))));
}
-/* We want to find the previous frame, which on Interix is tricky when signals
- are involved; set frame->frame appropriately, and also get the pc
- and tweak signal_handler_caller; this replaces a boatload of nested
- macros, as well. */
+/* We want to find the previous frame, which on Interix is tricky when
+ signals are involved; set frame->frame appropriately, and also get
+ the pc and tweak tye frame's type; this replaces a boatload of
+ nested macros, as well. */
static void
i386_interix_back_one_frame (int fromleaf, struct frame_info *frame)
{
NullApi or something else? */
ra = SAVED_PC_AFTER_CALL (frame);
if (ra >= null_start && ra < null_end)
- frame->signal_handler_caller = 1;
+ deprecated_set_frame_type (frame, SIGTRAMP_FRAME);
/* There might also be an indirect call to the mini-frame,
putting one more return address on the stack. (XP only,
I think?) This can't (reasonably) return the address of the
is safe. */
ra = read_memory_unsigned_integer (read_register (SP_REGNUM) + 4, 4);
if (ra >= null_start && ra < null_end)
- frame->signal_handler_caller = 1;
+ deprecated_set_frame_type (frame, SIGTRAMP_FRAME);
}
return;
}
- if (!frame->next->signal_handler_caller)
+ if (!(get_frame_type (frame->next) == SIGTRAMP_FRAME))
{
frame->pc = read_memory_integer (frame->next->frame + 4, 4);
return;
/* Assume that we've already unwound enough to have the caller's address
if we're dealing with a signal handler caller (And if that fails,
return 0). */
- if (fi->signal_handler_caller)
+ if ((get_frame_type (fi) == SIGTRAMP_FRAME))
return fi->next ? fi->next->pc : 0;
else
return read_memory_integer (fi->frame + 4, 4);
frame -- that is, the frame which was in progress when the signal
trampoline was entered. GDB mostly treats this frame pointer value
as a magic cookie. We detect the case of a signal trampoline by
- looking at the SIGNAL_HANDLER_CALLER field, which is set based on
- PC_IN_SIGTRAMP.
+ testing for get_frame_type() == SIGTRAMP_FRAME, which is set based
+ on PC_IN_SIGTRAMP.
When a signal trampoline is invoked from a frameless function, we
essentially have two frameless functions in a row. In this case,
we use the same magic cookie for three frames in a row. We detect
- this case by seeing whether the next frame has
- SIGNAL_HANDLER_CALLER set, and, if it does, checking whether the
- current frame is actually frameless. In this case, we need to get
- the PC by looking at the SP register value stored in the signal
- context.
+ this case by seeing whether the next frame is a SIGTRAMP_FRAME,
+ and, if it does, checking whether the current frame is actually
+ frameless. In this case, we need to get the PC by looking at the
+ SP register value stored in the signal context.
This should work in most cases except in horrible situations where
a signal occurs just as we enter a function but before the frame
int
i386_frameless_signal_p (struct frame_info *frame)
{
- return (frame->next && frame->next->signal_handler_caller
+ return (frame->next && get_frame_type (frame->next) == SIGTRAMP_FRAME
&& (frameless_look_for_prologue (frame)
|| frame->pc == get_pc_function_start (frame->pc)));
}
if (PC_IN_CALL_DUMMY (frame->pc, 0, 0))
return frame->frame;
- if (frame->signal_handler_caller
+ if (get_frame_type (frame) == SIGTRAMP_FRAME
|| i386_frameless_signal_p (frame))
return frame->frame;
static int
i386_frameless_function_invocation (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if (get_frame_type (frame) == SIGTRAMP_FRAME)
return 0;
return frameless_look_for_prologue (frame);
return pc;
}
- if (frame->signal_handler_caller)
+ if (get_frame_type (frame) == SIGTRAMP_FRAME)
return i386_sigtramp_saved_pc (frame);
if (i386_frameless_signal_p (frame))
static CORE_ADDR
i386_saved_pc_after_call (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if (get_frame_type (frame) == SIGTRAMP_FRAME)
return i386_sigtramp_saved_pc (frame);
return read_memory_unsigned_integer (read_register (SP_REGNUM), 4);
if (frame == NULL)
internal_error (__FILE__, __LINE__,
"read_sigcontext_register: NULL frame");
- if (!frame->signal_handler_caller)
+ if (!(get_frame_type (frame) == SIGTRAMP_FRAME))
internal_error (__FILE__, __LINE__,
- "read_sigcontext_register: frame not a signal_handler_caller");
+ "read_sigcontext_register: frame not a signal trampoline");
if (SIGCONTEXT_REGISTER_ADDRESS == 0)
internal_error (__FILE__, __LINE__,
"read_sigcontext_register: SIGCONTEXT_REGISTER_ADDRESS is 0");
CORE_ADDR
ia64_frame_chain (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return read_sigcontext_register (frame, sp_regnum);
else if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
return frame->frame;
CORE_ADDR
ia64_frame_saved_pc (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return read_sigcontext_register (frame, pc_regnum);
else if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
return deprecated_read_register_dummy (frame->pc, frame->frame, pc_regnum);
if (frame->saved_regs[IA64_VRAP_REGNUM])
return read_memory_integer (frame->saved_regs[IA64_VRAP_REGNUM], 8);
- else if (frame->next && frame->next->signal_handler_caller)
+ else if (frame->next && (get_frame_type (frame->next) == SIGTRAMP_FRAME))
return read_sigcontext_register (frame->next, IA64_BR0_REGNUM);
else /* either frameless, or not far enough along in the prologue... */
return ia64_saved_pc_after_call (frame);
if (frame->saved_regs)
return;
- if (frame->signal_handler_caller && SIGCONTEXT_REGISTER_ADDRESS)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME) && SIGCONTEXT_REGISTER_ADDRESS)
{
int regno;
cfm = read_register (IA64_CFM_REGNUM);
}
- else if (frame->next->signal_handler_caller)
+ else if ((get_frame_type (frame->next) == SIGTRAMP_FRAME))
{
bsp = read_sigcontext_register (frame->next, IA64_BSP_REGNUM);
cfm = read_sigcontext_register (frame->next, IA64_CFM_REGNUM);
if (frn->saved_regs[IA64_CFM_REGNUM] != 0)
cfm = read_memory_integer (frn->saved_regs[IA64_CFM_REGNUM], 8);
- else if (frn->next && frn->next->signal_handler_caller)
+ else if (frn->next && (get_frame_type (frn->next) == SIGTRAMP_FRAME))
cfm = read_sigcontext_register (frn->next, IA64_PFS_REGNUM);
else if (frn->next
&& PC_IN_CALL_DUMMY (frn->next->pc, frn->next->frame,
frame->extra_info->sof = cfm & 0x7f;
frame->extra_info->sol = (cfm >> 7) & 0x7f;
if (frame->next == 0
- || frame->next->signal_handler_caller
+ || (get_frame_type (frame->next) == SIGTRAMP_FRAME)
|| next_frame_is_call_dummy)
frame->extra_info->bsp = rse_address_add (bsp, -frame->extra_info->sof);
else
static CORE_ADDR
m68k_frame_chain (struct frame_info *thisframe)
{
- if (thisframe->signal_handler_caller)
+ if ((get_frame_type (thisframe) == SIGTRAMP_FRAME))
return thisframe->frame;
else if (!inside_entry_file ((thisframe)->pc))
return read_memory_integer ((thisframe)->frame, 4);
static int
m68k_frameless_function_invocation (struct frame_info *fi)
{
- if (fi->signal_handler_caller)
+ if ((get_frame_type (fi) == SIGTRAMP_FRAME))
return 0;
else
return frameless_look_for_prologue (fi);
static CORE_ADDR
m68k_frame_saved_pc (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
{
if (frame->next)
return read_memory_integer (frame->next->frame + SIG_PC_FP_OFFSET, 4);
{
/* we assume here that the only frameless functions are the system calls
or other functions who do not put anything on the stack. */
- if (frame_info->signal_handler_caller)
+ if ((get_frame_type (frame_info) == SIGTRAMP_FRAME))
return frame_info->frame + 12;
else if (frameless_look_for_prologue (frame_info))
{
/* Check for an interrupted system call */
- if (frame_info->next && frame_info->next->signal_handler_caller)
+ if (frame_info->next && (get_frame_type (frame_info->next) == SIGTRAMP_FRAME))
return frame_info->next->frame + 16;
else
return frame_info->frame + 4;
frame_info->saved_regs[PC_REGNUM] = (frame_info)->frame + 4;
#ifdef SIG_SP_FP_OFFSET
/* Adjust saved SP_REGNUM for fake _sigtramp frames. */
- if (frame_info->signal_handler_caller && frame_info->next)
+ if ((get_frame_type (frame_info) == SIGTRAMP_FRAME) && frame_info->next)
frame_info->saved_regs[SP_REGNUM] =
frame_info->next->frame + SIG_SP_FP_OFFSET;
#endif
CORE_ADDR
m68k_linux_frame_saved_pc (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return m68k_linux_sigtramp_saved_pc (frame);
return read_memory_integer (frame->frame + 4, 4);
/* FIXME! Is this correct?? */
#define SIGFRAME_REG_SIZE MIPS_REGSIZE
#endif
- if (fci->signal_handler_caller)
+ if ((get_frame_type (fci) == SIGTRAMP_FRAME))
{
for (ireg = 0; ireg < MIPS_NUMREGS; ireg++)
{
a signal, we assume that all registers have been saved.
This assumes that all register saves in a function happen before
the first function call. */
- (fci->next == NULL || fci->next->signal_handler_caller)
+ (fci->next == NULL || (get_frame_type (fci->next) == SIGTRAMP_FRAME))
/* In a dummy frame we know exactly where things are saved. */
&& !PROC_DESC_IS_DUMMY (proc_desc)
mips_extra_func_info_t proc_desc = frame->extra_info->proc_desc;
/* We have to get the saved pc from the sigcontext
if it is a signal handler frame. */
- int pcreg = frame->signal_handler_caller ? PC_REGNUM
+ int pcreg = (get_frame_type (frame) == SIGTRAMP_FRAME) ? PC_REGNUM
: (proc_desc ? PROC_PC_REG (proc_desc) : RA_REGNUM);
if (USE_GENERIC_DUMMY_FRAMES
&& PROC_FRAME_OFFSET (proc_desc) == 0
/* The previous frame from a sigtramp frame might be frameless
and have frame size zero. */
- && !frame->signal_handler_caller
+ && !(get_frame_type (frame) == SIGTRAMP_FRAME)
/* For a generic dummy frame, let get_frame_pointer() unwind a
register value saved as part of the dummy frame call. */
&& !(USE_GENERIC_DUMMY_FRAMES
char *name;
/* Do not set the saved registers for a sigtramp frame,
- mips_find_saved_registers will do that for us.
- We can't use fci->signal_handler_caller, it is not yet set. */
+ mips_find_saved_registers will do that for us. We can't
+ use (get_frame_type (fci) == SIGTRAMP_FRAME), it is not
+ yet set. */
+ /* FIXME: cagney/2002-11-18: This problem will go away once
+ frame.c:get_prev_frame() is modified to set the frame's
+ type before calling functions like this. */
find_pc_partial_function (fci->pc, &name,
(CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
if (!PC_IN_SIGTRAMP (fci->pc, name))
static CORE_ADDR
ns32k_frame_saved_pc (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return (ns32k_sigtramp_saved_pc (frame)); /* XXXJRT */
return (read_memory_integer (frame->frame + 4, 4));
behavior is ever fixed.)
PC_IN_SIGTRAMP is called from blockframe.c as well in order to set
- the signal_handler_caller flag. Because of our strange definition
- of in_sigtramp below, we can't rely on signal_handler_caller
+ the frame's type (if a SIGTRAMP_FRAME). Because of our strange
+ definition of in_sigtramp below, we can't rely on the frame's type
getting set correctly from within blockframe.c. This is why we
- take pains to set it in init_extra_frame_info(). */
+ take pains to set it in init_extra_frame_info().
+
+ NOTE: cagney/2002-11-10: I suspect the real problem here is that
+ the get_prev_frame() only initializes the frame's type after the
+ call to INIT_FRAME_INFO. get_prev_frame() should be fixed, this
+ code shouldn't be working its way around a bug :-(. */
int
ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name)
CORE_ADDR
ppc_linux_frame_saved_pc (struct frame_info *fi)
{
- if (fi->signal_handler_caller)
+ if ((get_frame_type (fi) == SIGTRAMP_FRAME))
{
CORE_ADDR regs_addr =
read_memory_integer (fi->frame + 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 (fi->next && fi->next->signal_handler_caller)
+ else if (fi->next && (get_frame_type (fi->next) == SIGTRAMP_FRAME))
{
CORE_ADDR regs_addr =
read_memory_integer (fi->next->frame + PPC_LINUX_REGS_PTR_OFFSET, 4);
this is a signal frame by looking to see if the pc points
at trampoline code */
if (ppc_linux_at_sigtramp_return_path (fi->pc))
- fi->signal_handler_caller = 1;
+ deprecated_set_frame_type (fi, SIGTRAMP_FRAME);
else
- fi->signal_handler_caller = 0;
+ /* 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);
}
}
void
ppc_linux_frame_init_saved_regs (struct frame_info *fi)
{
- if (fi->signal_handler_caller)
+ if ((get_frame_type (fi) == SIGTRAMP_FRAME))
{
CORE_ADDR regs_addr;
int i;
ppc_linux_frame_chain (struct frame_info *thisframe)
{
/* Kernel properly constructs the frame chain for the handler */
- if (thisframe->signal_handler_caller)
+ if ((get_frame_type (thisframe) == SIGTRAMP_FRAME))
return read_memory_integer ((thisframe)->frame, 4);
else
return rs6000_frame_chain (thisframe);
/* and this is a special signal frame. */
/* (fi->pc will be some low address in the kernel, */
/* to which the signal handler returns). */
- fi->signal_handler_caller = 1;
+ deprecated_set_frame_type (fi, SIGTRAMP_FRAME);
}
/* Put here the code to store, into a struct frame_saved_regs,
/* Don't even think about framelessness except on the innermost frame
or if the function was interrupted by a signal. */
- if (fi->next != NULL && !fi->next->signal_handler_caller)
+ if (fi->next != NULL && !(get_frame_type (fi->next) == SIGTRAMP_FRAME))
return 0;
func_start = get_pc_function_start (fi->pc);
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
int wordsize = tdep->wordsize;
- if (fi->signal_handler_caller)
+ if ((get_frame_type (fi) == SIGTRAMP_FRAME))
return read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET, wordsize);
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
if (fdata.lr_offset == 0 && fi->next != NULL)
{
- if (fi->next->signal_handler_caller)
+ if ((get_frame_type (fi->next) == SIGTRAMP_FRAME))
return read_memory_addr (fi->next->frame + SIG_FRAME_LR_OFFSET,
wordsize);
else if (PC_IN_CALL_DUMMY (get_next_frame (fi)->pc, 0, 0))
thisframe->pc == entry_point_address ())
return 0;
- if (thisframe->signal_handler_caller)
+ if ((get_frame_type (thisframe) == SIGTRAMP_FRAME))
fp = read_memory_addr (thisframe->frame + SIG_FRAME_FP_OFFSET,
wordsize);
else if (thisframe->next != NULL
- && thisframe->next->signal_handler_caller
+ && (get_frame_type (thisframe->next) == SIGTRAMP_FRAME)
&& FRAMELESS_FUNCTION_INVOCATION (thisframe))
/* A frameless function interrupted by a signal did not change the
frame pointer. */
-/* We want backtraces out of signal handlers so we don't
- set thisframe->signal_handler_caller to 1 */
+/* We want backtraces out of signal handlers so we don't set
+ (get_frame_type (thisframe) == SIGTRAMP_FRAME) to 1 */
CORE_ADDR
s390_frame_chain (struct frame_info *thisframe)
/* Compute ->frame as if not flat. If it is flat, we'll change
it later. */
if (fi->next->next != NULL
- && (fi->next->next->signal_handler_caller
+ && ((get_frame_type (fi->next->next) == SIGTRAMP_FRAME)
|| deprecated_frame_in_dummy (fi->next->next))
&& frameless_look_for_prologue (fi->next))
{
CORE_ADDR addr;
buf = alloca (MAX_REGISTER_RAW_SIZE);
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
{
/* This is the signal trampoline frame.
Get the saved PC from the sigcontext structure. */
}
else if (frame->extra_info->in_prologue ||
(frame->next != NULL &&
- (frame->next->signal_handler_caller ||
+ ((get_frame_type (frame->next) == SIGTRAMP_FRAME) ||
deprecated_frame_in_dummy (frame->next)) &&
frameless_look_for_prologue (frame)))
{
annotate_frame_end ();
return;
}
- if (fi->signal_handler_caller)
+ if ((get_frame_type (fi) == SIGTRAMP_FRAME))
{
annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
}
/* If fi is not the innermost frame, that normally means that fi->pc
- points to *after* the call instruction, and we want to get the line
- containing the call, never the next line. But if the next frame is
- a signal_handler_caller or a dummy frame, then the next frame was
- not entered as the result of a call, and we want to get the line
- containing fi->pc. */
+ points to *after* the call instruction, and we want to get the
+ line containing the call, never the next line. But if the next
+ frame is a SIGTRAMP_FRAME or a DUMMY_FRAME, then the next frame
+ was not entered as the result of a call, and we want to get the
+ line containing fi->pc. */
sal =
find_pc_line (fi->pc,
fi->next != NULL
- && !fi->next->signal_handler_caller
+ && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
&& !deprecated_frame_in_dummy (fi->next));
location_print = (source == LOCATION
sal = find_pc_line (fi->pc,
fi->next != NULL
- && !fi->next->signal_handler_caller
+ && !(get_frame_type (fi->next) == SIGTRAMP_FRAME)
&& !deprecated_frame_in_dummy (fi->next));
func = get_frame_function (fi);
s = find_pc_symtab (fi->pc);
+2002-11-18 Andrew Cagney <ac131313@redhat.com>
+
+ * tuiStack.c (tuiShowFrameInfo): Use get_frame_type instead of
+ signal_handler_caller.
+
2002-11-10 Andrew Cagney <ac131313@redhat.com>
* tuiStack.c (tuiShowFrameInfo): Replace frame_in_dummy with
sal = find_pc_line (fi->pc,
(fi->next != (struct frame_info *) NULL &&
- !fi->next->signal_handler_caller &&
+ !(get_frame_type (fi->next) == SIGTRAMP_FRAME) &&
!deprecated_frame_in_dummy (fi->next)));
sourceAlreadyDisplayed = sal.symtab != 0
static CORE_ADDR
vax_frame_saved_pc (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return (vax_sigtramp_saved_pc (frame)); /* XXXJRT */
return (read_memory_integer (frame->frame + 16, 4));
CORE_ADDR
x86_64_linux_saved_pc_after_call (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return x86_64_linux_sigtramp_saved_pc (frame);
return read_memory_integer (read_register (SP_REGNUM), 8);
CORE_ADDR
x86_64_linux_frame_saved_pc (struct frame_info *frame)
{
- if (frame->signal_handler_caller)
+ if ((get_frame_type (frame) == SIGTRAMP_FRAME))
return x86_64_linux_sigtramp_saved_pc (frame);
return cfi_get_ra (frame);
}
ULONGEST addr;
CORE_ADDR fp, pc;
- if (!fi->signal_handler_caller)
+ if (!(get_frame_type (fi) == SIGTRAMP_FRAME))
{
fp = cfi_frame_chain (fi);
if (fp)
{
CORE_ADDR addr;
- if (fi->next && fi->next->signal_handler_caller)
+ if (fi->next && (get_frame_type (fi->next) == SIGTRAMP_FRAME))
{
addr = fi->next->next->frame
+ LINUX_SIGINFO_SIZE + LINUX_UCONTEXT_SIGCONTEXT_OFFSET;