* mdebugread.c (parse_procedure): Remove _sigtramp kludges for

alpha and irix. The _sigtramp case has to be handled properly
	in the tdep files if we have no ecoff debugging info.
	* alpha-tdep.c (alpha_frame_saved_pc, alpha_frame_chain),
	mips-tdep.c (mips_frame_saved_pc):  Handle signal handler frames
	without PC_REGNUM kludge.
	* mdebugread.c (fixup_sigtramp), mips-tdep.c (read_next_frame_reg):
	Clean up handling of mips sigtramp frames, improve comments.
This commit is contained in:
Peter Schauer
1994-01-31 16:23:48 +00:00
parent ede7bc1c60
commit 0434c1a0c9
4 changed files with 54 additions and 30 deletions

View File

@@ -1,3 +1,14 @@
Mon Jan 31 09:40:33 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* mdebugread.c (parse_procedure): Remove _sigtramp kludges for
alpha and irix. The _sigtramp case has to be handled properly
in the tdep files if we have no ecoff debugging info.
* alpha-tdep.c (alpha_frame_saved_pc, alpha_frame_chain),
mips-tdep.c (mips_frame_saved_pc): Handle signal handler frames
without PC_REGNUM kludge.
* mdebugread.c (fixup_sigtramp), mips-tdep.c (read_next_frame_reg):
Clean up handling of mips sigtramp frames, improve comments.
Sat Jan 29 23:25:57 1994 Jeffrey A. Law (law@snake.cs.utah.edu) Sat Jan 29 23:25:57 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
* paread.c (read_unwind_info): Fix typo. * paread.c (read_unwind_info): Fix typo.

View File

@@ -1,5 +1,5 @@
/* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger. /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
Copyright 1993 Free Software Foundation, Inc. Copyright 1993, 1994 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@@ -165,7 +165,10 @@ alpha_frame_saved_pc(frame)
FRAME frame; FRAME frame;
{ {
alpha_extra_func_info_t proc_desc = frame->proc_desc; alpha_extra_func_info_t proc_desc = frame->proc_desc;
int pcreg = proc_desc ? PROC_PC_REG(proc_desc) : RA_REGNUM; /* 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
: (proc_desc ? PROC_PC_REG(proc_desc) : RA_REGNUM);
if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc)) if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc))
return read_memory_integer(frame->frame - 8, 8); return read_memory_integer(frame->frame - 8, 8);
@@ -428,14 +431,20 @@ alpha_frame_chain(frame)
we loop forever if we see a zero size frame. */ we loop forever if we see a zero size frame. */
if (PROC_FRAME_REG (proc_desc) == SP_REGNUM if (PROC_FRAME_REG (proc_desc) == SP_REGNUM
&& PROC_FRAME_OFFSET (proc_desc) == 0 && PROC_FRAME_OFFSET (proc_desc) == 0
/* The alpha __sigtramp routine is frameless and has a frame size
of zero. Luckily it is the only procedure which has PC_REGNUM
as PROC_PC_REG. */
&& PROC_PC_REG (proc_desc) != PC_REGNUM
/* The previous frame from a sigtramp frame might be frameless /* The previous frame from a sigtramp frame might be frameless
and have frame size zero. */ and have frame size zero. */
&& !frame->signal_handler_caller) && !frame->signal_handler_caller)
{
/* The alpha __sigtramp routine is frameless and has a frame size
of zero, but we are able to backtrace through it. */
char *name;
find_pc_partial_function (saved_pc, &name,
(CORE_ADDR *)NULL, (CORE_ADDR *)NULL);
if (IN_SIGTRAMP (saved_pc, name))
return frame->frame;
else
return 0; return 0;
}
else else
return read_next_frame_reg(frame, PROC_FRAME_REG(proc_desc)) return read_next_frame_reg(frame, PROC_FRAME_REG(proc_desc))
+ PROC_FRAME_OFFSET(proc_desc); + PROC_FRAME_OFFSET(proc_desc);

View File

@@ -1,6 +1,6 @@
/* Read a symbol table in ECOFF format (Third-Eye). /* Read a symbol table in ECOFF format (Third-Eye).
Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993 Free Software Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994
Foundation, Inc. Free Software Foundation, Inc.
Original version contributed by Alessandro Forin (af@cs.cmu.edu) at Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor
at Cygnus Support. at Cygnus Support.
@@ -1815,14 +1815,6 @@ parse_procedure (pr, search_symtab, first_off)
e->pdr.regmask = 0x80000000; e->pdr.regmask = 0x80000000;
e->pdr.regoffset = -4; e->pdr.regoffset = -4;
} }
/* Fake PC_REGNUM for alpha __sigtramp so that read_next_frame_reg
will use the saved user pc from the sigcontext. */
if (STREQ (sh_name, "__sigtramp"))
e->pdr.pcreg = PC_REGNUM;
/* Make the same patch for Irix. */
if (STREQ (sh_name, "_sigtramp"))
e->pdr.pcreg = PC_REGNUM;
} }
} }
@@ -3669,15 +3661,21 @@ fixup_sigtramp ()
xzalloc (sizeof (struct mips_extra_func_info))); xzalloc (sizeof (struct mips_extra_func_info)));
e->numargs = 0; /* the kernel thinks otherwise */ e->numargs = 0; /* the kernel thinks otherwise */
/* align_longword(sigcontext + SIGFRAME) */ e->pdr.frameoffset = 32;
e->pdr.frameoffset = 0x150;
e->pdr.framereg = SP_REGNUM; e->pdr.framereg = SP_REGNUM;
/* read_next_frame_reg provides the true pc at the time of signal */ /* Note that setting pcreg is no longer strictly necessary as
mips_frame_saved_pc is now aware of signal handler frames. */
e->pdr.pcreg = PC_REGNUM; e->pdr.pcreg = PC_REGNUM;
e->pdr.regmask = -2; e->pdr.regmask = -2;
e->pdr.regoffset = -(41 * sizeof (int)); /* Offset to saved r31, in the sigtramp case the saved registers
are above the frame in the sigcontext.
We have 4 alignment bytes, 12 bytes for onstack, mask and pc,
32 * 4 bytes for the general registers, 12 bytes for mdhi, mdlo, ownedfp
and 32 * 4 bytes for the floating point registers. */
e->pdr.regoffset = 4 + 12 + 31 * 4;
e->pdr.fregmask = -1; e->pdr.fregmask = -1;
e->pdr.fregoffset = -(7 * sizeof (int)); /* Offset to saved f30 (first saved *double* register). */
e->pdr.fregoffset = 4 + 12 + 32 * 4 + 12 + 30 * 4;
e->pdr.isym = (long) s; e->pdr.isym = (long) s;
e->pdr.adr = sigtramp_address; e->pdr.adr = sigtramp_address;

View File

@@ -1,5 +1,6 @@
/* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger. /* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
Copyright 1988, 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994
Free Software Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin. and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
@@ -76,19 +77,21 @@ read_next_frame_reg(fi, regno)
int regno; int regno;
{ {
/* If it is the frame for sigtramp we have a complete sigcontext /* If it is the frame for sigtramp we have a complete sigcontext
immediately below the frame and we get the saved registers from there. somewhere above the frame and we get the saved registers from there.
If the stack layout for sigtramp changes we might have to change these If the stack layout for sigtramp changes we might have to change these
constants and the companion fixup_sigtramp in mdebugread.c */ constants and the companion fixup_sigtramp in mdebugread.c */
#ifndef SIGFRAME_BASE #ifndef SIGFRAME_BASE
#define SIGFRAME_BASE 0x12c /* sizeof(sigcontext) */ /* To satisfy alignment restrictions the sigcontext is located 4 bytes
#define SIGFRAME_PC_OFF (-SIGFRAME_BASE + 2 * 4) above the sigtramp frame. */
#define SIGFRAME_REGSAVE_OFF (-SIGFRAME_BASE + 3 * 4) #define SIGFRAME_BASE 4
#define SIGFRAME_PC_OFF (SIGFRAME_BASE + 2 * 4)
#define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 3 * 4)
#endif #endif
#ifndef SIGFRAME_REG_SIZE #ifndef SIGFRAME_REG_SIZE
#define SIGFRAME_REG_SIZE 4 #define SIGFRAME_REG_SIZE 4
#endif #endif
for (; fi; fi = fi->next) for (; fi; fi = fi->next)
if (in_sigtramp(fi->pc, 0)) { if (fi->signal_handler_caller) {
int offset; int offset;
if (regno == PC_REGNUM) offset = SIGFRAME_PC_OFF; if (regno == PC_REGNUM) offset = SIGFRAME_PC_OFF;
else if (regno < 32) offset = (SIGFRAME_REGSAVE_OFF else if (regno < 32) offset = (SIGFRAME_REGSAVE_OFF
@@ -107,7 +110,10 @@ mips_frame_saved_pc(frame)
FRAME frame; FRAME frame;
{ {
mips_extra_func_info_t proc_desc = frame->proc_desc; mips_extra_func_info_t proc_desc = frame->proc_desc;
int pcreg = proc_desc ? PROC_PC_REG(proc_desc) : RA_REGNUM; /* 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
: (proc_desc ? PROC_PC_REG(proc_desc) : RA_REGNUM);
if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc)) if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc))
return read_memory_integer(frame->frame - 4, 4); return read_memory_integer(frame->frame - 4, 4);