From: Peter Schauer Date: Mon, 31 Jan 1994 16:23:48 +0000 (+0000) Subject: * mdebugread.c (parse_procedure): Remove _sigtramp kludges for X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0434c1a0c91e92d7a73affd5332583266b20b158;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fffe0ad5e10..6c9517d277d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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) * paread.c (read_unwind_info): Fix typo. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index a1b53e6e378..81061d35ae6 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -1,5 +1,5 @@ /* 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. @@ -165,7 +165,10 @@ alpha_frame_saved_pc(frame) FRAME frame; { 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)) return read_memory_integer(frame->frame - 8, 8); @@ -428,17 +431,23 @@ alpha_frame_chain(frame) we loop forever if we see a zero size frame. */ if (PROC_FRAME_REG (proc_desc) == SP_REGNUM && 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 and have frame size zero. */ && !frame->signal_handler_caller) - return 0; + { + /* 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; + } else return read_next_frame_reg(frame, PROC_FRAME_REG(proc_desc)) - + PROC_FRAME_OFFSET(proc_desc); + + PROC_FRAME_OFFSET(proc_desc); } void diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 352b4c4a8db..ad5d370be35 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1,6 +1,6 @@ /* Read a symbol table in ECOFF format (Third-Eye). - Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993 Free Software - Foundation, Inc. + Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994 + Free Software Foundation, Inc. Original version contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor at Cygnus Support. @@ -1815,14 +1815,6 @@ parse_procedure (pr, search_symtab, first_off) e->pdr.regmask = 0x80000000; 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))); e->numargs = 0; /* the kernel thinks otherwise */ - /* align_longword(sigcontext + SIGFRAME) */ - e->pdr.frameoffset = 0x150; + e->pdr.frameoffset = 32; 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.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.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.adr = sigtramp_address; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index f8a2732d47f..2bc9a038f97 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -1,5 +1,6 @@ /* 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 and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin. @@ -76,19 +77,21 @@ read_next_frame_reg(fi, regno) int regno; { /* 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 constants and the companion fixup_sigtramp in mdebugread.c */ #ifndef SIGFRAME_BASE -#define SIGFRAME_BASE 0x12c /* sizeof(sigcontext) */ -#define SIGFRAME_PC_OFF (-SIGFRAME_BASE + 2 * 4) -#define SIGFRAME_REGSAVE_OFF (-SIGFRAME_BASE + 3 * 4) +/* To satisfy alignment restrictions the sigcontext is located 4 bytes + above the sigtramp frame. */ +#define SIGFRAME_BASE 4 +#define SIGFRAME_PC_OFF (SIGFRAME_BASE + 2 * 4) +#define SIGFRAME_REGSAVE_OFF (SIGFRAME_BASE + 3 * 4) #endif #ifndef SIGFRAME_REG_SIZE #define SIGFRAME_REG_SIZE 4 #endif for (; fi; fi = fi->next) - if (in_sigtramp(fi->pc, 0)) { + if (fi->signal_handler_caller) { int offset; if (regno == PC_REGNUM) offset = SIGFRAME_PC_OFF; else if (regno < 32) offset = (SIGFRAME_REGSAVE_OFF @@ -107,7 +110,10 @@ mips_frame_saved_pc(frame) FRAME frame; { 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)) return read_memory_integer(frame->frame - 4, 4);