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

[PATCH 0/8] Step over instruction branches to itself


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.

Patch 1 and 2 are refactor patch.  Patch 4 is a GDB patch, and the rest
of them are GDBserver patches.  Test case is in the last patch.  Patch 3
and patch 7 are about signal delivery when stepping over, I am not very
sure about them, so these two can be treated as RFC.

Regression tested on x86_64-linux and arm-linux.

*** BLURB HERE ***

Yao Qi (8):
  Set signal to 0 after enqueue_pending_signal
  Check LWP_SIGNAL_CAN_BE_DELIVERED for enqueue/dequeue pending signals
  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                          |  5 ++-
 gdb/gdbserver/linux-low.c                 | 66 +++++++++++++++++-------------
 gdb/gdbserver/mem-break.c                 | 19 ++++++++-
 gdb/testsuite/gdb.base/branch-to-self.c   | 44 ++++++++++++++++++++
 gdb/testsuite/gdb.base/branch-to-self.exp | 67 +++++++++++++++++++++++++++++++
 5 files changed, 171 insertions(+), 30 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/branch-to-self.c
 create mode 100644 gdb/testsuite/gdb.base/branch-to-self.exp

-- 
1.9.1


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