From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28339 invoked by alias); 4 Jan 2012 15:34:43 -0000 Received: (qmail 28032 invoked by uid 22791); 4 Jan 2012 15:34:41 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-wi0-f169.google.com (HELO mail-wi0-f169.google.com) (209.85.212.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 04 Jan 2012 15:34:28 +0000 Received: by wibhq12 with SMTP id hq12so13477092wib.0 for ; Wed, 04 Jan 2012 07:34:27 -0800 (PST) Received: by 10.180.80.164 with SMTP id s4mr52022515wix.7.1325691267170; Wed, 04 Jan 2012 07:34:27 -0800 (PST) Received: from [192.168.0.103] (bl22-165-22.dsl.telepac.pt. [2.83.165.22]) by mx.google.com with ESMTPS id g26sm33788541wbo.16.2012.01.04.07.34.25 (version=SSLv3 cipher=OTHER); Wed, 04 Jan 2012 07:34:26 -0800 (PST) Message-ID: <4F047180.5040004@gmail.com> Date: Wed, 04 Jan 2012 15:34:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: GDB Patches Subject: PR13473 - step N/next N does not trigger gdb.events.stop Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00144.txt.bz2 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 * 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 * 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.*