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]

[RFA] arch-utils.c: Fix IN_SIGTRAMP usage


Hi,

the latest multiarching of SIGTRAMP stuff introduced a problem
when multiarched targets neither define PC_IN_SIGTRAMP nor
SIGTRAMP_START.  In that case, legacy_pc_in_sigtramp() is called
which in turn uses a preprocessor expression which calls 
SIGTRAMP_START() and SIGTRAMP_END() if SIGTRAMP_START is defined.

That's wrong for multiarched targets since SIGTRAMP_START is then
always defined.  In turn, gdb fails in create_new_frame() due to
a NULL pointer in gdbarch->sigtramp_start.

The fix is to use the already existing predicate SIGTRAMP_START_P
to guard against usage of SIGTRAMP_START().

I took the freedom to rearrange that part of arch-utils.c to
make it a bit more readable.

Corinna

	* arch-utils.c (legacy_pc_in_sigtramp): Move preprocessor
	expression for IN_SIGTRAMP to here.  Use IN_SIGTRAMP only
	if it's defined.  Guard usage of SIGTRAMP_START() by using
	SIGTRAMP_START_P.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.67
diff -u -p -r1.67 arch-utils.c
--- arch-utils.c	24 Aug 2002 00:21:34 -0000	1.67
+++ arch-utils.c	13 Sep 2002 17:30:45 -0000
@@ -438,18 +438,6 @@ generic_register_size (int regnum)
   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
-
 /* Assume all registers are adjacent.  */
 
 int
@@ -470,7 +458,15 @@ generic_register_byte (int regnum)
 int
 legacy_pc_in_sigtramp (CORE_ADDR pc, char *name)
 {
+#if !defined (IN_SIGTRAMP)
+#if SIGTRAMP_START_P
+  return (pc) >= SIGTRAMP_START(pc) && (pc) < SIGTRAMP_END(pc);
+#else
+  return name && STREQ ("_sigtramp", name);
+#endif
+#else
   return IN_SIGTRAMP(pc, name);
+#endif
 }
 
 int

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]