public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/3] fix permanent breakpoints
Date: Tue, 04 Nov 2014 19:03:00 -0000	[thread overview]
Message-ID: <1415127790-15091-1-git-send-email-palves@redhat.com> (raw)

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

             reply	other threads:[~2014-11-04 19:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04 19:03 Pedro Alves [this message]
2014-11-04 19:03 ` [PATCH 1/3] add a default method for gdbarch_skip_permanent_breakpoint Pedro Alves
2014-11-04 19:03 ` [PATCH 2/3] make "permanent breakpoints" per location and disableable Pedro Alves
2014-11-05  6:37   ` Yao Qi
2014-11-12 10:55     ` Pedro Alves
2014-11-20 16:41       ` [RFA] Always consider infcall breakpoints as non-permanent Joel Brobecker
2014-11-21 11:38         ` Pedro Alves
2014-11-23 10:44           ` Joel Brobecker
2014-11-04 19:03 ` [PATCH 3/3] fix skipping permanent breakpoints Pedro Alves
2014-11-05 12:26   ` Yao Qi
2014-11-07 19:53     ` Pedro Alves
2014-11-12  0:54       ` Yao Qi
2014-11-12 10:53         ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415127790-15091-1-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).