This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/in] Change SIGTRAMP_END to a predicate


Hello,

The recent SIGTRAMP_END changes broke the mn10200, SPARC and z8k builds. Those targets contain code like:

if (SIGTRAMP_START_P ())
SIGTRAMP_START()
SIGTRAMP_END()

which depends on there always being a definition of SIGTRAMP_END and with the way SIGTRAMP_END was multi-arched, this isn't true.

The attached changes SIGTRAMP_END() to a predicate function (like sigtramp start) as that is the best approximation to what is needed that I could see -- if a target doesn't set sigtramp_end(), and it is called, an internal error occurs. This shouldn't happen as any target setting sigtramp_end() will also set sigtramp_start().

committed,
Andrew
2002-09-13  Andrew Cagney  <cagney@redhat.com>

	* gdbarch.sh (SIGTRAMP_END): Change to a predicate function.
	* gdbarch.h, gdbarch.c: Regenerate.

Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.148
diff -u -r1.148 gdbarch.c
--- gdbarch.c	13 Sep 2002 00:38:48 -0000	1.148
+++ gdbarch.c	13 Sep 2002 23:12:55 -0000
@@ -794,7 +794,7 @@
   /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
   /* Skip verify of pc_in_sigtramp, invalid_p == 0 */
   /* Skip verify of sigtramp_start, has predicate */
-  /* Skip verify of sigtramp_end, invalid_p == 0 */
+  /* Skip verify of sigtramp_end, has predicate */
   /* 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 */
@@ -4844,6 +4844,13 @@
                             gdbarch_sigtramp_start_ftype sigtramp_start)
 {
   gdbarch->sigtramp_start = sigtramp_start;
+}
+
+int
+gdbarch_sigtramp_end_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->sigtramp_end != 0;
 }
 
 CORE_ADDR
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.116
diff -u -r1.116 gdbarch.h
--- gdbarch.h	13 Sep 2002 00:38:48 -0000	1.116
+++ gdbarch.h	13 Sep 2002 23:12:57 -0000
@@ -2422,6 +2422,31 @@
 #endif
 #endif
 
+#if defined (SIGTRAMP_END)
+/* Legacy for systems yet to multi-arch SIGTRAMP_END */
+#if !defined (SIGTRAMP_END_P)
+#define SIGTRAMP_END_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (SIGTRAMP_END_P)
+#define SIGTRAMP_END_P() (0)
+#endif
+
+extern int gdbarch_sigtramp_end_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (SIGTRAMP_END_P)
+#error "Non multi-arch definition of SIGTRAMP_END"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SIGTRAMP_END_P)
+#define SIGTRAMP_END_P() (gdbarch_sigtramp_end_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (SIGTRAMP_END)
+#define SIGTRAMP_END(pc) (internal_error (__FILE__, __LINE__, "SIGTRAMP_END"), 0)
+#endif
+
 typedef CORE_ADDR (gdbarch_sigtramp_end_ftype) (CORE_ADDR pc);
 extern CORE_ADDR gdbarch_sigtramp_end (struct gdbarch *gdbarch, CORE_ADDR pc);
 extern void set_gdbarch_sigtramp_end (struct gdbarch *gdbarch, gdbarch_sigtramp_end_ftype *sigtramp_end);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.160
diff -u -r1.160 gdbarch.sh
--- gdbarch.sh	13 Sep 2002 00:38:48 -0000	1.160
+++ gdbarch.sh	13 Sep 2002 23:12:58 -0000
@@ -637,7 +637,7 @@
 # does not.
 f:2:PC_IN_SIGTRAMP:int:pc_in_sigtramp:CORE_ADDR pc, char *name:pc, name:::legacy_pc_in_sigtramp::0
 F:2:SIGTRAMP_START:CORE_ADDR:sigtramp_start:CORE_ADDR pc:pc
-f:2:SIGTRAMP_END:CORE_ADDR:sigtramp_end:CORE_ADDR pc:pc:::::0
+F::SIGTRAMP_END:CORE_ADDR:sigtramp_end:CORE_ADDR pc:pc
 # 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]