Insert breakpoint even when the raw breakpoint is found
authorYao Qi <yao.qi@linaro.org>
Mon, 25 Apr 2016 08:43:36 +0000 (09:43 +0100)
committerYao Qi <yao.qi@linaro.org>
Mon, 25 Apr 2016 08:43:36 +0000 (09:43 +0100)
commit20249ae4551ae7b2193caed73d9ce8d594f38754
tree859eda81067b67a19b37646c06dd386784289575
parent21edc42f4e1ec6fe8cfce171232bab27ad4af372
Insert breakpoint even when the raw breakpoint is found

When GDBserver inserts a breakpoint, it looks for raw breakpoint, if
the raw breakpoint is found, increase its refcount, and return.  This
doesn't work when it steps over a breakpoint using software single
step and the underneath instruction of breakpoint is branch to self.

When stepping over a breakpoint on ADDR using software single step,
GDBserver uninsert the breakpoint, so the corresponding raw breakpoint
RAW's 'inserted' flag is zero.  Then, GDBserver insert single step
breakpoint at the same address ADDR because the instruction is branch
to self, the same raw brekapoint RAW is found, and increase the
refcount.  However, the raw breakpoint is not inserted, and the
program won't stop.

gdb/gdbserver:

2016-04-25  Pedro Alves  <palves@redhat.com>
    Yao Qi  <yao.qi@linaro.org>

* mem-break.c (set_raw_breakpoint_at): Create a raw breakpoint
object.  Insert it if it is not inserted yet.  Increase the
refcount and link it into the proc's raw breakpoint list.
gdb/ChangeLog
gdb/gdbserver/mem-break.c