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]

Re: [RFA] longjmp() breakpoints on Linux/x86


Mark Kettenis wrote:
> 
> 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?

If it works, OK.  Although I would have prefered the second option.
If this breaks some other target, will you undertake to do the other?

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