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/3] fix permanent breakpoints


This series fixes a few permanent breakpoints things.

 - Adds a default method to gdbarch_skip_permanent_breakpoint, which
   should be right for most archs.

 - Makes permanent breakpoints be a detail of a breakpoint location
   rather than of the whole breakpoint.  Bad things happen today if a
   multi-location breakpoint happens to have some (but not all) of its
   locations on top of a breakpoint instruction.

 - Makes permanent breakpoints disablable.  If the user disables the
   breakpoint, she gets the random SIGTRAP as if she hadn't set the
   breakpoint in the first place.

 - Fixes the skip-permanent-breakpoint code to actually just skip the
   breakpoint.  GDB currently steps one instruction too much, along
   with getting other tricky details wrong.

But the reason I'm looking at this now is that a recent change of mine
regressed the gdb.arch/i386-bp_permanent.exp test.  See:

  https://sourceware.org/ml/gdb/2014-11/msg00001.html

Specifically, GDB is now hitting an assertion when skipping a
permanent breakpoint:

 (gdb) stepi
 ../../src/gdb/infrun.c:2237: internal-error: resume: Assertion `sig != GDB_SIGNAL_0' failed.
 A problem internal to GDB has been detected,
 further debugging may prove unreliable.
 Quit this debugging session? (y or n) FAIL: gdb.arch/i386-bp_permanent.exp: Single stepping past permanent breakpoint. (GDB internal error)

However, taking a closer look, the problem is in permanent
breakpoint's code, not on the assertion itself.  That is, the
assertion caught something bogus.

I've complained about permanent breakpoints being fundamentally broken
before, at:

  https://www.sourceware.org/ml/gdb-patches/2013-10/msg00574.html

And it turns out that the new test added by this series trips on
issues related to what I mentioned in that email, and I so I ended up
having to do the changes I proposed in that email...

Tested on x86-64 Fedora 20.

Pedro Alves (3):
  add a default method for gdbarch_skip_permanent_breakpoint
  make "permanent breakpoints" per location and disableable
  fix skipping permanent breakpoints

 gdb/arch-utils.c                             |  13 +-
 gdb/arch-utils.h                             |   8 +
 gdb/breakpoint.c                             |  71 +++----
 gdb/breakpoint.h                             |  13 +-
 gdb/gdbarch.c                                |  13 +-
 gdb/gdbarch.h                                |   2 -
 gdb/gdbarch.sh                               |   2 +-
 gdb/i386-tdep.c                              |  15 --
 gdb/infrun.c                                 | 153 +++++++++++++--
 gdb/testsuite/gdb.arch/i386-bp_permanent.c   |  57 ++++++
 gdb/testsuite/gdb.arch/i386-bp_permanent.exp |  49 ++---
 gdb/testsuite/gdb.base/bp-permanent.c        | 128 +++++++++++++
 gdb/testsuite/gdb.base/bp-permanent.exp      | 276 +++++++++++++++++++++++++++
 13 files changed, 672 insertions(+), 128 deletions(-)
 create mode 100644 gdb/testsuite/gdb.arch/i386-bp_permanent.c
 create mode 100644 gdb/testsuite/gdb.base/bp-permanent.c
 create mode 100644 gdb/testsuite/gdb.base/bp-permanent.exp

-- 
1.9.3


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