[PATCH 0/7 V2] Step over instruction branches to itself

Yao Qi
2016-03-23T16:10:01Z

Here is the V2 of this series, and V1 can be found in
https://sourceware.org/ml/gdb-patches/2016-03/msg00067.html

In V2, there are some changes,

- Add a new test case in patch 1,
- Add more comments in patch 2 and 3, to explain some scenarios may
happen,
- Decrease refcount rather than free the raw breapoint in patch 4,

The original description to this patch series is:

When I test arm linux range stepping patches, fails in
gdb.base/gdb-sigterm.exp lead me taking a look. I find gcc is quite
smart to genreate *single* branch instruction for such endless for
loop,

for (;;); /* loop-line */

the instruction branches to itself.

0x00008638 <+28>: b 0x8638 <main+28>

However, current GDB and GDBserver doesn't handle this kind of
instruction very well when stepping over breakpoint on top of it.
This patch series fixes the problems when stepping over
"branch to self" instruction, and it paves the way for arm linux range
stepping patches and tracepoint patches.

Yao Qi (7):
New test case gdb.trace/signal.exp
Deliver signal in hardware single step
Force to insert software single step breakpoint
Insert breakpoint even when the raw breakpoint is found
[GDBserver] Don't error in reinsert_raw_breakpoint if bp->inserted
Resume the inferior with signal rather than stepping over
New test case gdb.base/branch-to-self.exp

gdb/breakpoint.c | 9 +-
gdb/gdbarch.h | 5 +-
gdb/gdbarch.sh | 5 +-
gdb/gdbserver/linux-low.c | 22 +++-
gdb/gdbserver/mem-break.c | 19 +++-
gdb/testsuite/gdb.base/branch-to-self.c | 44 ++++++++
gdb/testsuite/gdb.base/branch-to-self.exp | 67 +++++++++++
gdb/testsuite/gdb.trace/signal.c | 68 +++++++++++
gdb/testsuite/gdb.trace/signal.exp | 180 ++++++++++++++++++++++++++++++
9 files changed, 411 insertions(+), 8 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/branch-to-self.c
create mode 100644 gdb/testsuite/gdb.base/branch-to-self.exp
create mode 100644 gdb/testsuite/gdb.trace/signal.c
create mode 100644 gdb/testsuite/gdb.trace/signal.exp

--
1.9.1