This is the mail archive of the gdb-patches@sourceware.cygnus.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]

[RFA] longjmp() breakpoints on Linux/x86


I'm having some difficulties with getting longjmp() breakpoints to
work on Linux/x86.  GDB tries to set longjmp() breakpoints at the
following symbols: longjmp, _longjmp, siglongjmp, _siglongjmp.  In
glibc 2.1.3, the adresses of longjmp, _longjmp and siglongjmp are
identical, which means that GDB creates multiple longjmp() breakpoints
at one address.  Later when we hit the breakpoint and bpstat_what() is
called this leads to some problems.  bpstat_what() iterates over all
breakpoints that were hit (i.e. all three of them in the Linux case)
and determines the appropriate action.  On the first breakpoint it
decides on BPSTAT_WHAT_SET_LONGJMP_RESUME.  But on the second it
decides that hitting multiple longjmp() breakpoints can't happen,
which is translated into BPSTAT_WHAT_STOP_NOISY.  The effect is that
GDB stops in longjmp() instead of stepping over it.

The simplest, and IMHO right solution is to keep returning
BPSTAT_WHAT_SET_LONGJMP_RESUME if we hit multiple longjmp()
breakpoints.

Another option would be to avoid duplicate longjmp() breakpoints, but
I think that would be more involving and probably less fool-proof.

OK to check the attached patch in?

Mark


2000-07-07  Mark Kettenis  <kettenis@gnu.org>

	* breakpoint.c (bpstat_what): Keep returning
	BPSTAT_WHAT_SET_LONGJMP_RESUME when hitting multiple longjmp()
	breakpoints instead of signalling an error by returning
	BPSTAT_WHAT_STOP_NOISY.


Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.13
diff -u -p -r1.13 breakpoint.c
--- breakpoint.c	2000/06/12 21:17:21	1.13
+++ breakpoint.c	2000/07/06 22:44:02
@@ -2868,7 +2868,7 @@ bpstat_what (bs)
 /*bp_noisy */
     {sn, sn, sn, sn, sn, sn, sn, sr, ts, shl, shlr},
 /*long_jump */
-    {slr, ss, sn, slr, err, err, err, sr, ts, shl, shlr},
+    {slr, ss, sn, slr, slr, err, err, sr, ts, shl, shlr},
 /*long_resume */
     {clr, ss, sn, clrs, err, err, err, sr, ts, shl, shlr},
 /*step_resume */



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