This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PR13473 - step N/next N does not trigger gdb.events.stop
- From: Pedro Alves <alves dot ped at gmail dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Date: Wed, 04 Jan 2012 15:34:24 +0000
- Subject: PR13473 - step N/next N does not trigger gdb.events.stop
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.*