Re: ugdb breakpoints

2010-09-14 Thread Roland McGrath
The traditional method is to restore the original instruction replaced by
the breakpoint in text, single-step over that instruction, then restore the
breakpoint in text, then continue.  That method requires all-stop so that
while you are stepping the thread that just hit the breakpoint, you can't
have another thread run past that instruction and miss the breakpoint.

Both this traditional in-place method, and the instruction-copying method,
depend on using single-step.  So stepi has to work before break can work.


Thanks,
Roland



Re: ugdb breakpoints

2010-09-10 Thread Tom Tromey
Oleg   Now, to continue the tracee, gdb does not restore the
Oleg   original instruction. Instead, it
Oleg   - writes this insn into _start code
Oleg   - changes regs-ip to point to this insn
Oleg   - does single-step to execute this insn
Oleg   - changes regs-ip again

This is what is done for non-stop.
I believe it is called displaced stepping in gdb.

I think eventually we would like it if uprobes did this work, instead of
gdb doing it.  Presumably that would yield better performance.  E.g., if
we have a thread-specific breakpoint, then other threads hitting that
breakpoint could simply do the displaced stepping via uprobes, and not
report a breakpoint hit to gdb at all.

For all-stop, breakpoints are handled differently, though I don't
remember how offhand.

Tom