From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45328 invoked by alias); 7 Dec 2017 18:13:28 -0000 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 Received: (qmail 45319 invoked by uid 89); 7 Dec 2017 18:13:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*RU:sk:cm15.we, Hx-spam-relays-external:100.42.49.9, H*RU:100.42.49.9, Hx-spam-relays-external:sk:cm15.we X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.179.30) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Dec 2017 18:13:24 +0000 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 397DE7038 for ; Thu, 7 Dec 2017 12:13:23 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id N0fjeGjH6mzEzN0fjeoj7Y; Thu, 07 Dec 2017 12:13:23 -0600 Received: from 71-218-90-63.hlrn.qwest.net ([71.218.90.63]:42786 helo=pokyo) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eN0fi-002FeQ-UZ; Thu, 07 Dec 2017 12:13:23 -0600 From: Tom Tromey To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [RFA] Fix regression in "commands" References: <20171103190747.389-1-tom@tromey.com> <3a860acf-6e64-b2ba-e3fd-560406077259@redhat.com> <87vahq5rcw.fsf@tromey.com> <58677519-fc2d-457d-34b9-3014d24dc147@redhat.com> Date: Thu, 07 Dec 2017 18:13:00 -0000 In-Reply-To: <58677519-fc2d-457d-34b9-3014d24dc147@redhat.com> (Pedro Alves's message of "Mon, 4 Dec 2017 15:49:58 +0000") Message-ID: <87mv2u4da5.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Source-L: No X-Exim-ID: 1eN0fi-002FeQ-UZ X-Source-Sender: 71-218-90-63.hlrn.qwest.net (pokyo) [71.218.90.63]:42786 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2017-12/txt/msg00143.txt.bz2 Pedro> But I'd start with making "commands" not-error like the Pedro> others. Ok, how about this? Tom commit 657cbb04bd450d2217679d33a91d2342fe02c4b9 Author: Tom Tromey Date: Fri Nov 3 10:26:11 2017 -0600 Fix regression in "commands" Pedro pointed out a regression in "commands", where trying to clear a breakpoint's command list would fail: (top-gdb) commands Type commands for breakpoint(s) 3, one per line. End with a line saying just "end". >end No breakpoints specified. (top-gdb) I believe the bug was introduced by my patch that changes counted_command_line to be a shared_ptr. This causes the problem because now the counted_command_line in commands_command_1 can be NULL, whereas previously it never could be. After some discussion, we agreed to simply remove the error case from commands_command_1. 2017-12-07 Tom Tromey PR breakpoints/22511: * breakpoint.c (commands_command_1): Don't throw an exception when no commands have been read. 2017-12-07 Tom Tromey * gdb.base/break.exp: Add test for empty "commands". diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 54aec7f7d9..7c1dff1c35 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-12-07 Tom Tromey + + PR breakpoints/22511: + * breakpoint.c (commands_command_1): Don't throw an exception when + no commands have been read. + 2017-12-07 Simon Marchi * common/selftest.h (struct selftest): Add virtual destructor. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 76bfd53a43..59a4dad3cf 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1272,9 +1272,6 @@ commands_command_1 (const char *arg, int from_tty, observer_notify_breakpoint_modified (b); } }); - - if (cmd == NULL) - error (_("No breakpoints specified.")); } static void diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 87547cbe13..d52625bd74 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-12-07 Tom Tromey + + * gdb.base/break.exp: Add test for empty "commands". + 2017-12-07 Phil Muldoon * gdb.python/py-breakpoint.exp (test_bkpt_explicit_loc): Add new diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 96e2f35003..87db2dc0d3 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -854,3 +854,15 @@ gdb_test_no_output "set \$foo=81.5" \ gdb_test "break $srcfile:\$foo" \ "Convenience variables used in line specs must have integer values.*" \ "set breakpoint via non-integer convenience variable disallowed" + + +# +# Test that commands can be cleared without error. +# + +gdb_test "commands\nprint 232323\nend" ">end" "set some breakpoint commands" +gdb_test "commands\nend" ">end" "clear breakpoint commands" +# We verify that the commands were cleared by ensuring that the last +# breakpoint's location ends the output -- if there were commands, +# they would have been printed after the location. +gdb_test "info break" "$srcfile:$line" "verify that they were cleared"