* [RFA] Multi-arch IN_SIGTRAMP
@ 2002-04-21 1:20 David S. Miller
2002-04-21 10:42 ` [rfc/rfa:doc] PC_IN_SIGTRAMP; Was: " Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2002-04-21 1:20 UTC (permalink / raw)
To: gdb-patches
I'm just basically walking one by one down the sparc-linux-tdep.c
non-multi-arch'able target routines and making them multi-arch
capable.
This time IN_SIGTRAMP, notes:
1) I chose the !stramp(name, "_sigtramp") version as the default.
2) Others wanting the default based upon SIGTRAMP_{START,END} got
a IN_SIGTRAMP define in their target header.
Ok to install?
2002-04-21 David S. Miller <davem@redhat.com>
* arch-utils.c (generic_in_sigtramp): New.
* arch-utils.h (generic_in_sigtramp): Declare.
* gdbarch.sh (IN_SIGTRAMP): Add, document, default to
generic_in_sigtramp.
* gdbarch.c, gdbarch.h: Regenerate.
* inferior.h (IN_SIGTRAMP): Kill.
* config/alpha/tm-alphalinux.h, config/i386/tm-fbsd.h,
config/i386/tm-i386bsd.h, config/i386/tm-i386os9k.h,
config/i386/tm-nbsd.h, config/i386/tm-obsd.h,
config/m68k/tm-hp300bsd.h, config/m68k/tm-nbsd.h (IN_SIGTRAMP):
Define non-multiarch version using SIGTRAMP_START and
SIGTRAMP_END.
* sparc-linux-tdep.c (sparc_linux_is_sigtramp): Mark it static.
(sparc_linux_gdbarch_os_init): Pass it to set_gdbarch_in_sigtramp.
* config/sparc/tm-linux.h config/sparc/tm-sp64linux.h
(sparc_linux_in_sigtramp, IN_SIGTRAMP): Delete.
--- ./config/alpha/tm-alphalinux.h.~1~ Sun Feb 24 14:56:04 2002
+++ ./config/alpha/tm-alphalinux.h Sun Apr 21 00:30:11 2002
@@ -38,6 +38,10 @@ extern long alpha_linux_sigtramp_offset
#define SIGTRAMP_START(pc) (pc - alpha_linux_sigtramp_offset (pc))
#define SIGTRAMP_END(pc) (SIGTRAMP_START(pc) + 3*4)
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
/* Number of traps that happen between exec'ing the shell to run an
inferior, and when we finally get to the inferior code. This is 2
--- ./config/i386/tm-fbsd.h.~1~ Sat Jul 28 10:03:38 2001
+++ ./config/i386/tm-fbsd.h Sun Apr 21 00:30:31 2002
@@ -68,6 +68,11 @@ extern int i386bsd_in_sigtramp (CORE_ADD
extern CORE_ADDR i386bsd_sigtramp_start;
extern CORE_ADDR i386bsd_sigtramp_end;
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
+
/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */
#undef FRAME_SAVED_PC
--- ./config/i386/tm-i386bsd.h.~1~ Tue Mar 6 00:21:29 2001
+++ ./config/i386/tm-i386bsd.h Sun Apr 21 00:30:52 2002
@@ -37,6 +37,11 @@
#define SIGTRAMP_START(pc) 0xfdbfdfc0
#define SIGTRAMP_END(pc) 0xfdbfe000
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
+
/* Saved Pc. Get it from sigcontext if within sigtramp. */
/* Offset to saved PC in sigcontext, from <sys/signal.h>. */
--- ./config/i386/tm-i386os9k.h.~1~ Wed Oct 31 14:24:06 2001
+++ ./config/i386/tm-i386os9k.h Sun Apr 21 00:30:59 2002
@@ -55,6 +55,11 @@
#define SIGTRAMP_START(pc) 0xfdbfdfc0
#define SIGTRAMP_END(pc) 0xfdbfe000
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
+
/* Saved Pc. Get it from sigcontext if within sigtramp. */
/* Offset to saved PC in sigcontext, from <sys/signal.h>. */
--- ./config/i386/tm-nbsd.h.~1~ Sat Jan 5 10:36:32 2002
+++ ./config/i386/tm-nbsd.h Sun Apr 21 00:31:08 2002
@@ -61,6 +61,11 @@ extern int i386bsd_in_sigtramp (CORE_ADD
extern CORE_ADDR i386bsd_sigtramp_start;
extern CORE_ADDR i386bsd_sigtramp_end;
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
+
/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */
#undef FRAME_SAVED_PC
--- ./config/i386/tm-obsd.h.~1~ Fri Nov 23 15:01:54 2001
+++ ./config/i386/tm-obsd.h Sun Apr 21 00:31:14 2002
@@ -60,6 +60,11 @@ extern int i386bsd_in_sigtramp (CORE_ADD
extern CORE_ADDR i386bsd_sigtramp_start;
extern CORE_ADDR i386bsd_sigtramp_end;
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
+
/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */
#undef FRAME_SAVED_PC
--- ./config/m68k/tm-hp300bsd.h.~1~ Tue Mar 6 00:21:30 2001
+++ ./config/m68k/tm-hp300bsd.h Sun Apr 21 00:31:24 2002
@@ -57,6 +57,11 @@
#define SIGTRAMP_START(pc) (STACK_END_ADDR - 20)
#define SIGTRAMP_END(pc) (STACK_END_ADDR + TARGET_UPAGES * TARGET_NBPG)
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
+
/* Address of end of stack space. */
#define STACK_END_ADDR 0xfff00000
--- ./config/m68k/tm-nbsd.h.~1~ Tue Mar 6 00:21:30 2001
+++ ./config/m68k/tm-nbsd.h Sun Apr 21 00:31:30 2002
@@ -36,6 +36,11 @@
#define SIGTRAMP_START(pc) (STACK_END_ADDR - 32)
#define SIGTRAMP_END(pc) (STACK_END_ADDR)
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
+
#include "m68k/tm-m68k.h"
#include "tm-nbsd.h"
--- ./config/sparc/tm-linux.h.~1~ Sat Apr 20 20:53:49 2002
+++ ./config/sparc/tm-linux.h Sun Apr 21 00:55:00 2002
@@ -29,14 +29,6 @@
#include "tm-linux.h"
-/* When the sparc Linux kernel calls a signal handler, the return
- address points to a bit of code on the stack. These definitions
- are used to identify this bit of code as a signal trampoline in
- order to support backtracing through calls to signal handlers. */
-
-#define IN_SIGTRAMP(pc, name) sparc_linux_in_sigtramp (pc, name)
-extern int sparc_linux_in_sigtramp (CORE_ADDR, char *);
-
/* When we call a function in a shared library, and the PLT sends us
into the dynamic linker to find the function's real address, we
need to skip over the dynamic linker call. This function decides
--- ./config/sparc/tm-sp64linux.h.~1~ Sat Apr 20 20:54:24 2002
+++ ./config/sparc/tm-sp64linux.h Sun Apr 21 00:55:05 2002
@@ -29,15 +29,6 @@ Foundation, Inc., 59 Temple Place - Suit
#include "tm-linux.h"
-
-/* When the sparc Linux kernel calls a signal handler, the return
- address points to a bit of code on the stack. These definitions
- are used to identify this bit of code as a signal trampoline in
- order to support backtracing through calls to signal handlers. */
-
-#define IN_SIGTRAMP(pc, name) sparc_linux_in_sigtramp (pc, name)
-extern int sparc_linux_in_sigtramp (CORE_ADDR, char *);
-
/* When we call a function in a shared library, and the PLT sends us
into the dynamic linker to find the function's real address, we
need to skip over the dynamic linker call. This function decides
--- ./config/vax/tm-vax.h.~1~ Mon Jan 28 20:42:45 2002
+++ ./config/vax/tm-vax.h Sun Apr 21 00:31:37 2002
@@ -49,6 +49,11 @@ extern CORE_ADDR vax_skip_prologue (CORE
#define SIGTRAMP_START(pc) STACK_END_ADDR
#define SIGTRAMP_END(pc) 0x80000000
+/* Whether we are in a sigtramp. */
+
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc))
+
/* Stack grows downward. */
#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
--- ./gdbarch.c.~1~ Sat Apr 20 10:41:18 2002
+++ ./gdbarch.c Sun Apr 21 00:57:19 2002
@@ -250,6 +250,7 @@ struct gdbarch
gdbarch_print_insn_ftype *print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline;
+ gdbarch_in_sigtramp_ftype *in_sigtramp;
gdbarch_in_function_epilogue_p_ftype *in_function_epilogue_p;
gdbarch_construct_inferior_arguments_ftype *construct_inferior_arguments;
gdbarch_dwarf2_build_frame_info_ftype *dwarf2_build_frame_info;
@@ -396,6 +397,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
generic_in_function_epilogue_p,
construct_inferior_arguments,
0,
@@ -764,6 +766,8 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of print_insn, invalid_p == 0 */
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
/* Skip verify of in_solib_call_trampoline, invalid_p == 0 */
+ if (gdbarch->in_sigtramp == 0)
+ gdbarch->in_sigtramp = generic_in_sigtramp;
/* Skip verify of in_function_epilogue_p, invalid_p == 0 */
/* Skip verify of construct_inferior_arguments, invalid_p == 0 */
/* Skip verify of dwarf2_build_frame_info, has predicate */
@@ -1361,6 +1365,17 @@ gdbarch_dump (struct gdbarch *gdbarch, s
(long) current_gdbarch->integer_to_address
/*INTEGER_TO_ADDRESS ()*/);
#endif
+#ifdef IN_SIGTRAMP
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "IN_SIGTRAMP(pc, name)",
+ XSTRING (IN_SIGTRAMP (pc, name)));
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: IN_SIGTRAMP = 0x%08lx\n",
+ (long) current_gdbarch->in_sigtramp
+ /*IN_SIGTRAMP ()*/);
+#endif
#ifdef IN_SOLIB_CALL_TRAMPOLINE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -4406,6 +4421,24 @@ set_gdbarch_in_solib_call_trampoline (st
gdbarch_in_solib_call_trampoline_ftype in_solib_call_trampoline)
{
gdbarch->in_solib_call_trampoline = in_solib_call_trampoline;
+}
+
+int
+gdbarch_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
+{
+ if (gdbarch->in_sigtramp == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_in_sigtramp invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_in_sigtramp called\n");
+ return gdbarch->in_sigtramp (pc, name);
+}
+
+void
+set_gdbarch_in_sigtramp (struct gdbarch *gdbarch,
+ gdbarch_in_sigtramp_ftype in_sigtramp)
+{
+ gdbarch->in_sigtramp = in_sigtramp;
}
int
--- ./sparc-linux-tdep.c.~1~ Sat Apr 20 21:50:48 2002
+++ ./sparc-linux-tdep.c Sun Apr 21 00:54:02 2002
@@ -165,11 +165,9 @@ sparc_linux_rt_sigtramp_start (CORE_ADDR
return pc;
}
-/* Return whether PC is in a GNU/Linux sigtramp routine.
+/* Return whether PC is in a GNU/Linux sigtramp routine. */
- TODO Need to generically multi-arch this. */
-
-int
+static int
sparc_linux_in_sigtramp (CORE_ADDR pc, char *name)
{
int ret;
@@ -485,6 +483,7 @@ sparc_linux_gdbarch_os_init(struct gdbar
set_gdbarch_frame_chain (gdbarch, sparc_linux_frame_chain);
set_gdbarch_frame_saved_pc (gdbarch, sparc_linux_frame_saved_pc);
set_gdbarch_saved_pc_after_call (gdbarch, sparc_linux_saved_pc_after_call);
+ set_gdbarch_in_sigtramp (gdbarch, sparc_linux_in_sigtramp);
if (gdbarch_tdep (gdbarch)->intreg_size == 4)
{
--- ./inferior.h.~1~ Wed Apr 10 15:00:20 2002
+++ ./inferior.h Sun Apr 21 00:52:23 2002
@@ -403,29 +403,6 @@ extern char *stop_registers;
extern int attach_flag;
\f
-/* Sigtramp is a routine that the kernel calls (which then calls the
- signal handler). On most machines it is a library routine that
- is linked into the executable.
-
- This macro, given a program counter value and the name of the
- function in which that PC resides (which can be null if the
- name is not known), returns nonzero if the PC and name show
- that we are in sigtramp.
-
- On most machines just see if the name is sigtramp (and if we have
- no name, assume we are not in sigtramp). */
-#if !defined (IN_SIGTRAMP)
-#if defined (SIGTRAMP_START)
-#define IN_SIGTRAMP(pc, name) \
- ((pc) >= SIGTRAMP_START(pc) \
- && (pc) < SIGTRAMP_END(pc) \
- )
-#else
-#define IN_SIGTRAMP(pc, name) \
- (name && STREQ ("_sigtramp", name))
-#endif
-#endif
-\f
/* Possible values for CALL_DUMMY_LOCATION. */
#define ON_STACK 1
#define BEFORE_TEXT_END 2
--- ./gdbarch.sh.~1~ Sat Apr 20 10:41:18 2002
+++ ./gdbarch.sh Sun Apr 21 00:51:11 2002
@@ -608,6 +608,13 @@ f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_
# trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates
# to nonzero if we are current stopped in one of these.
f:2:IN_SOLIB_CALL_TRAMPOLINE:int:in_solib_call_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_call_trampoline::0
+# Sigtramp is a routine that the kernel calls (which then calls the
+# signal handler). On most machines it is a library routine that
+# is linked into the executable.
+# Say whether the program counter value PC is in a signal trampoline. The
+# NAME argument, if non-NULL, is the name of the function in which
+# PC resides.
+f:2:IN_SIGTRAMP:int:in_sigtramp:CORE_ADDR pc, char *name:pc, name::::generic_in_sigtramp::0
# A target might have problems with watchpoints as soon as the stack
# frame of the current function has been destroyed. This mostly happens
# as the first action in a funtion's epilogue. in_function_epilogue_p()
--- ./arch-utils.h.~1~ Wed Feb 6 05:00:44 2002
+++ ./arch-utils.h Sun Apr 21 00:52:05 2002
@@ -144,6 +144,8 @@ extern CORE_ADDR generic_skip_trampoline
extern int generic_in_solib_call_trampoline (CORE_ADDR pc, char *name);
+extern int generic_in_sigtramp (CORE_ADDR pc, char *name);
+
extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc);
extern void default_print_float_info (void);
--- ./arch-utils.c.~1~ Thu Apr 18 11:08:58 2002
+++ ./arch-utils.c Sun Apr 21 00:50:49 2002
@@ -115,6 +115,12 @@ generic_in_solib_call_trampoline (CORE_A
}
int
+generic_in_sigtramp (CORE_ADDR pc, char *name)
+{
+ return (name && STREQ ("_sigtramp", name));
+}
+
+int
generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{
return 0;
--- ./gdbarch.h.~1~ Sat Apr 20 10:41:18 2002
+++ ./gdbarch.h Sun Apr 21 00:56:38 2002
@@ -2268,6 +2268,30 @@ extern void set_gdbarch_in_solib_call_tr
#endif
#endif
+/* Sigtramp is a routine that the kernel calls (which then calls the
+ signal handler). On most machines it is a library routine that
+ is linked into the executable.
+ Say whether the program counter value PC is in a signal trampoline. The
+ NAME argument, if non-NULL, is the name of the function in which
+ PC resides. */
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (IN_SIGTRAMP)
+#define IN_SIGTRAMP(pc, name) (generic_in_sigtramp (pc, name))
+#endif
+
+typedef int (gdbarch_in_sigtramp_ftype) (CORE_ADDR pc, char *name);
+extern int gdbarch_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc, char *name);
+extern void set_gdbarch_in_sigtramp (struct gdbarch *gdbarch, gdbarch_in_sigtramp_ftype *in_sigtramp);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (IN_SIGTRAMP)
+#error "Non multi-arch definition of IN_SIGTRAMP"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (IN_SIGTRAMP)
+#define IN_SIGTRAMP(pc, name) (gdbarch_in_sigtramp (current_gdbarch, pc, name))
+#endif
+#endif
+
/* A target might have problems with watchpoints as soon as the stack
frame of the current function has been destroyed. This mostly happens
as the first action in a funtion's epilogue. in_function_epilogue_p()
^ permalink raw reply [flat|nested] 5+ messages in thread
* [rfc/rfa:doc] PC_IN_SIGTRAMP; Was: [RFA] Multi-arch IN_SIGTRAMP
2002-04-21 1:20 [RFA] Multi-arch IN_SIGTRAMP David S. Miller
@ 2002-04-21 10:42 ` Andrew Cagney
2002-04-21 12:16 ` Eli Zaretskii
2002-04-21 16:55 ` David S. Miller
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-04-21 10:42 UTC (permalink / raw)
To: David S. Miller; +Cc: gdb-patches, Eli Zaretskii
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
[Eli, note the doco update]
Try the attached.
It introduces a new macro PC_IN_SIGTRAMP that falls back to the existing
IN_SIGTRAMP behavour. This avoids the need to modify all the tm.h files.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 18239 bytes --]
2002-04-21 Andrew Cagney <ac131313@redhat.com>
* arch-utils.h: Update copyright.
* gdbarch.sh (PC_IN_SIGTRAMP): Add.
* gdbarch.h, gdbarch.c: Re-generate.
* inferior.h (IN_SIGTRAMP): Delete definition.
* arch-utils.c (legacy_pc_in_sigtramp): New function.
* arch-utils.h (legacy_pc_in_sigtramp): Declare.
* mips-tdep.c (mips_init_extra_frame_info): Use PC_IN_SIGTRAMP.
(mips_dump_tdep): Do not print value of IN_SIGTRAMP.
* hppa-tdep.c (pc_in_interrupt_handler): Use PC_IN_SIGTRAMP.
(find_proc_framesize): Ditto.
* alpha-tdep.c (alpha_osf_skip_sigtramp_frame): Ditto.
(alpha_init_extra_frame_info): Ditto.
* infrun.c (handle_inferior_event): Ditto.
(handle_inferior_event): Ditto.
(check_sigtramp2): Ditto.
* blockframe.c (create_new_frame): Ditto.
(get_prev_frame): Ditto.
* ppc-linux-tdep.c: Update comments.
* i386-linux-tdep.c: Update comments.
* breakpoint.c (bpstat_what): Update comment.
Index: doc/ChangeLog
2002-04-21 Andrew Cagney <ac131313@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Replace
IN_SIGTRAMP with PC_IN_SIGTRAMP.
Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.20
diff -u -r1.20 alpha-tdep.c
--- alpha-tdep.c 19 Apr 2002 05:11:52 -0000 1.20
+++ alpha-tdep.c 21 Apr 2002 17:18:34 -0000
@@ -236,7 +236,7 @@
{
char *name;
find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
- if (IN_SIGTRAMP (pc, name))
+ if (PC_IN_SIGTRAMP (pc, name))
return frame->frame;
else
return 0;
@@ -968,7 +968,7 @@
We can't use frame->signal_handler_caller, it is not yet set. */
find_pc_partial_function (frame->pc, &name,
(CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
- if (!IN_SIGTRAMP (frame->pc, name))
+ if (!PC_IN_SIGTRAMP (frame->pc, name))
{
frame->saved_regs = (CORE_ADDR *)
frame_obstack_alloc (SIZEOF_FRAME_SAVED_REGS);
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.52
diff -u -r1.52 arch-utils.c
--- arch-utils.c 18 Apr 2002 18:08:58 -0000 1.52
+++ arch-utils.c 21 Apr 2002 17:18:35 -0000
@@ -423,6 +423,24 @@
return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
}
+#if !defined (IN_SIGTRAMP)
+#if defined (SIGTRAMP_START)
+#define IN_SIGTRAMP(pc, name) \
+ ((pc) >= SIGTRAMP_START(pc) \
+ && (pc) < SIGTRAMP_END(pc) \
+ )
+#else
+#define IN_SIGTRAMP(pc, name) \
+ (name && STREQ ("_sigtramp", name))
+#endif
+#endif
+\f
+int
+legacy_pc_in_sigtramp (CORE_ADDR pc, char *name)
+{
+ return IN_SIGTRAMP(pc, name);
+}
+
\f
/* Functions to manipulate the endianness of the target. */
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.29
diff -u -r1.29 arch-utils.h
--- arch-utils.h 6 Feb 2002 13:00:44 -0000 1.29
+++ arch-utils.h 21 Apr 2002 17:18:35 -0000
@@ -1,5 +1,6 @@
/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+
+ Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of GDB.
@@ -155,6 +156,9 @@
/* Assume the virtual size of registers corresponds to the virtual type. */
extern int generic_register_virtual_size (int regnum);
+
+/* Prop up old targets that use various IN_SIGTRAMP() macros. */
+extern int legacy_pc_in_sigtramp (CORE_ADDR pc, char *name);
/* Initialize a ``struct info''. Can't use memset(0) since some
default values are not zero. */
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.49
diff -u -r1.49 arm-tdep.c
--- arm-tdep.c 21 Apr 2002 03:46:44 -0000 1.49
+++ arm-tdep.c 21 Apr 2002 17:18:46 -0000
@@ -1075,20 +1075,20 @@
sp = (fi->next->frame - fi->next->extra_info->frameoffset
+ fi->next->extra_info->framesize);
- /* Determine whether or not we're in a sigtramp frame.
+ /* 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 IN_SIGTRAMP to determine if we need
- to use the sigcontext addresses for the saved registers.
+ fi->signal_handler_caller and PC_IN_SIGTRAMP to determine if we
+ need to use the sigcontext addresses for the saved registers.
- Note: If an ARM 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 IN_SIGTRAMP. */
+ 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. */
if (SIGCONTEXT_REGISTER_ADDRESS_P ()
- && (fi->signal_handler_caller || IN_SIGTRAMP (fi->pc, (char *)0)))
+ && (fi->signal_handler_caller || 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);
Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.24
diff -u -r1.24 blockframe.c
--- blockframe.c 14 Apr 2002 13:38:06 -0000 1.24
+++ blockframe.c 21 Apr 2002 17:18:58 -0000
@@ -227,7 +227,7 @@
fi->frame = addr;
fi->pc = pc;
find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
- fi->signal_handler_caller = IN_SIGTRAMP (fi->pc, name);
+ fi->signal_handler_caller = PC_IN_SIGTRAMP (fi->pc, name);
if (INIT_EXTRA_FRAME_INFO_P ())
INIT_EXTRA_FRAME_INFO (0, fi);
@@ -458,7 +458,7 @@
find_pc_partial_function (prev->pc, &name,
(CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
- if (IN_SIGTRAMP (prev->pc, name))
+ if (PC_IN_SIGTRAMP (prev->pc, name))
prev->signal_handler_caller = 1;
return prev;
@@ -747,7 +747,7 @@
/* If sigtramp is in the u area, it counts as a function (especially
important for step_1). */
#if defined SIGTRAMP_START
- if (IN_SIGTRAMP (mapped_pc, (char *) NULL))
+ if (PC_IN_SIGTRAMP (mapped_pc, (char *) NULL))
{
cache_pc_function_low = SIGTRAMP_START (mapped_pc);
cache_pc_function_high = SIGTRAMP_END (mapped_pc);
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.72
diff -u -r1.72 breakpoint.c
--- breakpoint.c 9 Apr 2002 22:33:25 -0000 1.72
+++ breakpoint.c 21 Apr 2002 17:19:16 -0000
@@ -2850,7 +2850,7 @@
/* step_resume entries: a step resume breakpoint overrides another
breakpoint of signal handling (see comment in wait_for_inferior
- at first IN_SIGTRAMP where we set the step_resume breakpoint). */
+ at first PC_IN_SIGTRAMP where we set the step_resume breakpoint). */
/* We handle the through_sigtramp_breakpoint the same way; having both
one of those and a step_resume_breakpoint is probably very rare (?). */
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.128
diff -u -r1.128 gdbarch.sh
--- gdbarch.sh 20 Apr 2002 17:41:18 -0000 1.128
+++ gdbarch.sh 21 Apr 2002 17:19:34 -0000
@@ -608,6 +608,27 @@
# trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates
# to nonzero if we are current stopped in one of these.
f:2:IN_SOLIB_CALL_TRAMPOLINE:int:in_solib_call_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_call_trampoline::0
+# Sigtramp is a routine that the kernel calls (which then calls the
+# signal handler). On most machines it is a library routine that is
+# linked into the executable.
+#
+# This macro, given a program counter value and the name of the
+# function in which that PC resides (which can be null if the name is
+# not known), returns nonzero if the PC and name show that we are in
+# sigtramp.
+#
+# On most machines just see if the name is sigtramp (and if we have
+# no name, assume we are not in sigtramp).
+#
+# FIXME: cagney/2002-04-21: The function find_pc_partial_function
+# calls find_pc_sect_partial_function() which calls PC_IN_SIGTRAMP.
+# This means PC_IN_SIGTRAMP function can't be implemented by doing its
+# own local NAME lookup.
+#
+# FIXME: cagney/2002-04-21: PC_IN_SIGTRAMP is something of a mess.
+# Some code also depends on SIGTRAMP_START and SIGTRAMP_END but other
+# does not.
+f:2:PC_IN_SIGTRAMP:int:pc_in_sigtramp:CORE_ADDR pc, char *name:pc, name:::legacy_pc_in_sigtramp::0
# A target might have problems with watchpoints as soon as the stack
# frame of the current function has been destroyed. This mostly happens
# as the first action in a funtion's epilogue. in_function_epilogue_p()
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.25
diff -u -r1.25 hppa-tdep.c
--- hppa-tdep.c 12 Apr 2002 18:18:57 -0000 1.25
+++ hppa-tdep.c 21 Apr 2002 17:19:49 -0000
@@ -633,7 +633,8 @@
its frame isn't a pure interrupt frame. Deal with this. */
msym_us = lookup_minimal_symbol_by_pc (pc);
- return u->HP_UX_interrupt_marker && !IN_SIGTRAMP (pc, SYMBOL_NAME (msym_us));
+ return (u->HP_UX_interrupt_marker
+ && !PC_IN_SIGTRAMP (pc, SYMBOL_NAME (msym_us)));
}
/* Called when no unwind descriptor was found for PC. Returns 1 if it
@@ -751,7 +752,7 @@
if (u->Save_SP
&& !pc_in_interrupt_handler (pc)
&& msym_us
- && !IN_SIGTRAMP (pc, SYMBOL_NAME (msym_us)))
+ && !PC_IN_SIGTRAMP (pc, SYMBOL_NAME (msym_us)))
return -1;
return u->Total_frame_size << 3;
Index: i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.11
diff -u -r1.11 i386-linux-tdep.c
--- i386-linux-tdep.c 24 Feb 2002 22:31:19 -0000 1.11
+++ i386-linux-tdep.c 21 Apr 2002 17:19:49 -0000
@@ -92,7 +92,7 @@
It kind of sucks that we have to read memory from the process in
order to identify a signal trampoline, but there doesn't seem to be
- any other way. The IN_SIGTRAMP macro in tm-linux.h arranges to
+ any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to
only call us if no function name could be identified, which should
be the case since the code is on the stack.
@@ -317,7 +317,7 @@
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 IN_SIGTRAMP.
+ field, 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,
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.26
diff -u -r1.26 inferior.h
--- inferior.h 10 Apr 2002 22:00:20 -0000 1.26
+++ inferior.h 21 Apr 2002 17:19:52 -0000
@@ -403,29 +403,6 @@
extern int attach_flag;
\f
-/* Sigtramp is a routine that the kernel calls (which then calls the
- signal handler). On most machines it is a library routine that
- is linked into the executable.
-
- This macro, given a program counter value and the name of the
- function in which that PC resides (which can be null if the
- name is not known), returns nonzero if the PC and name show
- that we are in sigtramp.
-
- On most machines just see if the name is sigtramp (and if we have
- no name, assume we are not in sigtramp). */
-#if !defined (IN_SIGTRAMP)
-#if defined (SIGTRAMP_START)
-#define IN_SIGTRAMP(pc, name) \
- ((pc) >= SIGTRAMP_START(pc) \
- && (pc) < SIGTRAMP_END(pc) \
- )
-#else
-#define IN_SIGTRAMP(pc, name) \
- (name && STREQ ("_sigtramp", name))
-#endif
-#endif
-\f
/* Possible values for CALL_DUMMY_LOCATION. */
#define ON_STACK 1
#define BEFORE_TEXT_END 2
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.56
diff -u -r1.56 infrun.c
--- infrun.c 18 Mar 2002 02:26:31 -0000 1.56
+++ infrun.c 21 Apr 2002 17:20:24 -0000
@@ -2640,8 +2640,8 @@
ecs->update_step_sp = 1;
/* Did we just take a signal? */
- if (IN_SIGTRAMP (stop_pc, ecs->stop_func_name)
- && !IN_SIGTRAMP (prev_pc, prev_func_name)
+ if (PC_IN_SIGTRAMP (stop_pc, ecs->stop_func_name)
+ && !PC_IN_SIGTRAMP (prev_pc, prev_func_name)
&& INNER_THAN (read_sp (), step_sp))
{
/* We've just taken a signal; go until we are back to
@@ -2752,7 +2752,7 @@
{
/* We're doing a "next". */
- if (IN_SIGTRAMP (stop_pc, ecs->stop_func_name)
+ if (PC_IN_SIGTRAMP (stop_pc, ecs->stop_func_name)
&& INNER_THAN (step_frame_address, read_sp()))
/* We stepped out of a signal handler, and into its
calling trampoline. This is misdetected as a
@@ -2961,8 +2961,8 @@
check_sigtramp2 (struct execution_control_state *ecs)
{
if (trap_expected
- && IN_SIGTRAMP (stop_pc, ecs->stop_func_name)
- && !IN_SIGTRAMP (prev_pc, prev_func_name)
+ && PC_IN_SIGTRAMP (stop_pc, ecs->stop_func_name)
+ && !PC_IN_SIGTRAMP (prev_pc, prev_func_name)
&& INNER_THAN (read_sp (), step_sp))
{
/* What has happened here is that we have just stepped the
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.70
diff -u -r1.70 mips-tdep.c
--- mips-tdep.c 18 Apr 2002 18:09:02 -0000 1.70
+++ mips-tdep.c 21 Apr 2002 17:20:29 -0000
@@ -2108,7 +2108,7 @@
We can't use fci->signal_handler_caller, it is not yet set. */
find_pc_partial_function (fci->pc, &name,
(CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
- if (!IN_SIGTRAMP (fci->pc, name))
+ if (!PC_IN_SIGTRAMP (fci->pc, name))
{
frame_saved_regs_zalloc (fci);
memcpy (fci->saved_regs, temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
@@ -4576,9 +4576,6 @@
fprintf_unfiltered (file,
"mips_dump_tdep: IGNORE_HELPER_CALL # %s\n",
XSTRING (IGNORE_HELPER_CALL (PC)));
- fprintf_unfiltered (file,
- "mips_dump_tdep: IN_SIGTRAMP # %s\n",
- XSTRING (IN_SIGTRAMP (PC, NAME)));
fprintf_unfiltered (file,
"mips_dump_tdep: IN_SOLIB_CALL_TRAMPOLINE # %s\n",
XSTRING (IN_SOLIB_CALL_TRAMPOLINE (PC, NAME)));
Index: ppc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
retrieving revision 1.15
diff -u -r1.15 ppc-linux-tdep.c
--- ppc-linux-tdep.c 18 Apr 2002 18:09:06 -0000 1.15
+++ ppc-linux-tdep.c 21 Apr 2002 17:20:29 -0000
@@ -106,10 +106,11 @@
/* Determine if pc is in a signal trampoline...
Ha! That's not what this does at all. wait_for_inferior in
- infrun.c calls IN_SIGTRAMP in order to detect entry into a signal
- trampoline just after delivery of a signal. But on GNU/Linux,
- signal trampolines are used for the return path only. The kernel
- sets things up so that the signal handler is called directly.
+ infrun.c calls PC_IN_SIGTRAMP in order to detect entry into a
+ signal trampoline just after delivery of a signal. But on
+ GNU/Linux, signal trampolines are used for the return path only.
+ The kernel sets things up so that the signal handler is called
+ directly.
If we use in_sigtramp2() in place of in_sigtramp() (see below)
we'll (often) end up with stop_pc in the trampoline and prev_pc in
@@ -141,11 +142,11 @@
first instruction long after the fact, just in case the observed
behavior is ever fixed.)
- IN_SIGTRAMP is called from blockframe.c as well in order to set
+ 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 getting
- set correctly from within blockframe.c. This is why we take pains
- to set it in init_extra_frame_info(). */
+ of in_sigtramp below, we can't rely on signal_handler_caller
+ getting set correctly from within blockframe.c. This is why we
+ take pains to set it in init_extra_frame_info(). */
int
ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name)
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.77
diff -u -r1.77 gdbint.texinfo
--- doc/gdbint.texinfo 21 Apr 2002 15:52:35 -0000 1.77
+++ doc/gdbint.texinfo 21 Apr 2002 17:21:26 -0000
@@ -3095,11 +3095,6 @@
the stack frame of the function already has been destroyed up to the
final `return from function call' instruction.
-@item IN_SIGTRAMP (@var{pc}, @var{name})
-@findex IN_SIGTRAMP
-Define this to return non-zero if the given @var{pc} and/or @var{name}
-indicates that the current function is a @code{sigtramp}.
-
@item SIGTRAMP_START (@var{pc})
@findex SIGTRAMP_START
@itemx SIGTRAMP_END (@var{pc})
@@ -3297,6 +3292,16 @@
@item PC_IN_CALL_DUMMY
@findex PC_IN_CALL_DUMMY
See @file{inferior.h}.
+
+@item PC_IN_SIGTRAMP (@var{pc}, @var{name})
+@findex PC_IN_SIGTRAMP
+Sigtramp is a routine that the kernel calls (which then calls the signal
+handler). On most machines it is a library routine that is linked into
+the executable.
+
+This function, given a program counter value and the (possibly NULL)
+name of the function in which that @var{pc} resides, returns nonzero if
+the @var{pc} and/or @var{name} show that we are in sigtramp.
@item PC_LOAD_SEGMENT
@findex PC_LOAD_SEGMENT
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc/rfa:doc] PC_IN_SIGTRAMP; Was: [RFA] Multi-arch IN_SIGTRAMP
2002-04-21 10:42 ` [rfc/rfa:doc] PC_IN_SIGTRAMP; Was: " Andrew Cagney
@ 2002-04-21 12:16 ` Eli Zaretskii
2002-04-24 9:23 ` Andrew Cagney
2002-04-21 16:55 ` David S. Miller
1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2002-04-21 12:16 UTC (permalink / raw)
To: ac131313; +Cc: davem, gdb-patches
> Date: Sun, 21 Apr 2002 13:42:28 -0400
> From: Andrew Cagney <ac131313@cygnus.com>
>
> [Eli, note the doco update]
Thanks for the heads-up.
> * gdbint.texinfo (Target Architecture Definition): Replace
> IN_SIGTRAMP with PC_IN_SIGTRAMP.
Approved, with a few minor comments:
> +@item PC_IN_SIGTRAMP (@var{pc}, @var{name})
> +@findex PC_IN_SIGTRAMP
> +Sigtramp is a routine that the kernel calls
Here you introduce a new term. It is best to give it a @dfn markup,
so that it stands out, and add an index entry for it, so that someone
who bumps into this term elsewhere in the manual could find its
definition. So:
@item PC_IN_SIGTRAMP (@var{pc}, @var{name})
@findex PC_IN_SIGTRAMP
@cindex sigtramp
A @dfn{sigtramp} is a routine that the kernel calls...
> +This function, given a program counter value and the (possibly NULL)
"NULL" should be in @code, since it's a C symbol.
Also, it's better to say "... given a program counter value in
@var{pc}...", since this immediately explains what is @var{pc}.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc/rfa:doc] PC_IN_SIGTRAMP; Was: [RFA] Multi-arch IN_SIGTRAMP
2002-04-21 10:42 ` [rfc/rfa:doc] PC_IN_SIGTRAMP; Was: " Andrew Cagney
2002-04-21 12:16 ` Eli Zaretskii
@ 2002-04-21 16:55 ` David S. Miller
1 sibling, 0 replies; 5+ messages in thread
From: David S. Miller @ 2002-04-21 16:55 UTC (permalink / raw)
To: ac131313; +Cc: gdb-patches, eliz
From: Andrew Cagney <ac131313@cygnus.com>
Date: Sun, 21 Apr 2002 13:42:28 -0400
Try the attached.
It introduces a new macro PC_IN_SIGTRAMP that falls back to the existing
IN_SIGTRAMP behavour. This avoids the need to modify all the tm.h files.
I'm find with this.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [rfc/rfa:doc] PC_IN_SIGTRAMP; Was: [RFA] Multi-arch IN_SIGTRAMP
2002-04-21 12:16 ` Eli Zaretskii
@ 2002-04-24 9:23 ` Andrew Cagney
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-04-24 9:23 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: davem, gdb-patches
> Date: Sun, 21 Apr 2002 13:42:28 -0400
>> From: Andrew Cagney <ac131313@cygnus.com>
>>
>> [Eli, note the doco update]
>
>
Eli, thanks.
It's going in with:
> @item PC_IN_SIGTRAMP (@var{pc}, @var{name})
> @findex PC_IN_SIGTRAMP
> @cindex sigtramp
> The @dfn{sigtramp} is a routine that the kernel calls (which then calls
> the signal handler). On most machines it is a library routine that is
> linked into the executable.
>
> This function, given a program counter value in @var{pc} and the
> (possibly NULL) name of the function in which that @var{pc} resides,
> returns nonzero if the @var{pc} and/or @var{name} show that we are in
> sigtramp.
Andrew
> Thanks for the heads-up.
>
>
>> * gdbint.texinfo (Target Architecture Definition): Replace
>> IN_SIGTRAMP with PC_IN_SIGTRAMP.
>
>
> Approved, with a few minor comments:
>
>
>> +@item PC_IN_SIGTRAMP (@var{pc}, @var{name})
>> +@findex PC_IN_SIGTRAMP
>> +Sigtramp is a routine that the kernel calls
>
>
> Here you introduce a new term. It is best to give it a @dfn markup,
> so that it stands out, and add an index entry for it, so that someone
> who bumps into this term elsewhere in the manual could find its
> definition. So:
>
> @item PC_IN_SIGTRAMP (@var{pc}, @var{name})
> @findex PC_IN_SIGTRAMP
> @cindex sigtramp
> A @dfn{sigtramp} is a routine that the kernel calls...
>
>
>> +This function, given a program counter value and the (possibly NULL)
>
>
> "NULL" should be in @code, since it's a C symbol.
>
> Also, it's better to say "... given a program counter value in
> @var{pc}...", since this immediately explains what is @var{pc}.
>
> Thanks.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-04-24 16:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-21 1:20 [RFA] Multi-arch IN_SIGTRAMP David S. Miller
2002-04-21 10:42 ` [rfc/rfa:doc] PC_IN_SIGTRAMP; Was: " Andrew Cagney
2002-04-21 12:16 ` Eli Zaretskii
2002-04-24 9:23 ` Andrew Cagney
2002-04-21 16:55 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox