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

Re: A question about All-stop and Non-stop


On Tuesday 04 May 2010 09:55:16, xingxing pan wrote:
> Dose GDB in the All-stop mode has the same problem as in the Non-stop
> mode when continues over a breakpoint instruction?
> 
> When GDB continues over a breakpoint instruction in the Non-stop mode,
>  replacing the breakpoint instruction with the original instruction
> may cause the other running threads can't hit the breakpoint. That's
> why GDB needs the displaced instructions. 

That's only one way to solve that problem.  An efficient one though.

Another way is to pause all threads, remove breakpoints, single-step
the thread of interest, reinsert breakpoints, resume all threads again.

(This is what linux x86 gdbserver presently does to step over its
own internal breakpoints (breakpoints gdb doesn't know about), even
in non-stop mode.)

> But what about the All-stop
> mode, dose GDB has the same problem in this mode?
> If it does, how dose GDB solve the problem? It seems there's no trick
> like the displaced instructions before Non-stop's debut.

No.  It does the "pause all threads, remove breakpoints, single-step
the thread of interest, reinsert breakpoints, resume all threads again"
dance.  The "pause all threads" is implicit in all-stop, and so
all-threads-stopped is the state you start with anyway.

-- 
Pedro Alves


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