Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <alves.ped@gmail.com>
To: GDB Patches <gdb-patches@sourceware.org>
Subject: PR13473 - step N/next N does not trigger gdb.events.stop
Date: Wed, 04 Jan 2012 15:34:00 -0000	[thread overview]
Message-ID: <4F047180.5040004@gmail.com> (raw)

This patch from Khoo Yit Phang (attached to the PR) fixes PR13473.

I've just fixed formatting, added a ChangeLog entry and wrote a test.

The bug was that we'd always skip the normal stop observers if the
thread that caused a stopped was involved in a multi-step, even if
it stopped for some other reason than a step.  Checking stop_step
in addition fixes that, because that's set when the thread stopped
for stepping.  The same check is done a bit above already.

Comments on the test?

No regressions on f16/x86_64.  Test fails without the fix.

gdb/
2011-12-04  Khoo Yit Phang  <khooyp@cs.umd.edu>

	* infrun.c (normal_stop): Don't skip calling the normal_stop
	observers if the thread was doing a multi-step, but stopped for
	some reason other than stepping.

gdb/testsuite/
2011-12-04  Pedro Alves  <alves.ped@gmail.com>

	* gdb.python/py-events.c (first): Add bits for new "step N" test.
	* gdb.python/py-events.exp: Test that "step N" tripping on a
	breakpoint emits a breakpoint event.
---

  gdb/testsuite/gdb.python/py-events.c   |    5 +++++
  gdb/testsuite/gdb.python/py-events.exp |   12 ++++++++++++
  2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index a6e1af7..29db420 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6068,7 +6068,8 @@ done:
        || last.kind == TARGET_WAITKIND_SIGNALLED
        || last.kind == TARGET_WAITKIND_EXITED
        || last.kind == TARGET_WAITKIND_NO_RESUMED
-      || (!inferior_thread ()->step_multi
+      || (!(inferior_thread ()->step_multi
+	    && inferior_thread ()->control.stop_step)
  	  && !(inferior_thread ()->control.stop_bpstat
  	       && inferior_thread ()->control.proceed_to_finish)
  	  && !inferior_thread ()->control.in_infcall))
diff --git a/gdb/testsuite/gdb.python/py-events.c b/gdb/testsuite/gdb.python/py-events.c
index 00490c6..5b9a0c5 100644
--- a/gdb/testsuite/gdb.python/py-events.c
+++ b/gdb/testsuite/gdb.python/py-events.c
@@ -24,6 +24,11 @@ int second(){
  }

  int first(){
+  int i;
+
+  for (i = 0; i < 2; i++)
+    do_nothing ();
+
    return second();
  }

diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 0b5c1cf..0715d3c 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -73,6 +73,18 @@ gdb_test "continue" ".*event type: continue.*
  .*breakpoint number: 3.*
  all threads stopped"

+# Test that when "step N" trips on a breakpoint, we get a stop event
+# with breakpoint stop reason.
+gdb_breakpoint "do_nothing"
+gdb_test "step 3" ".*event type: continue.*
+.*event type: stop.*
+.*stop reason: breakpoint.*
+.*first breakpoint number: 4.*
+.*breakpoint number: 4.*
+all threads stopped"
+
+delete_breakpoints
+
  #test exited event.
  gdb_test "continue" ".*event type: continue.*
  .*event type: exit.*


             reply	other threads:[~2012-01-04 15:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-04 15:34 Pedro Alves [this message]
2012-01-04 16:17 ` Tom Tromey
2012-01-05 13:13   ` 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=4F047180.5040004@gmail.com \
    --to=alves.ped@gmail.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