From patchwork Sun Jan 29 16:21:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 63877 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D43DB385B531 for ; Sun, 29 Jan 2023 16:21:41 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from gproxy1-pub.mail.unifiedlayer.com (gproxy1-pub.mail.unifiedlayer.com [69.89.25.95]) by sourceware.org (Postfix) with ESMTPS id AEA463858D35 for ; Sun, 29 Jan 2023 16:21:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AEA463858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw12.mail.unifiedlayer.com (unknown [10.0.90.127]) by progateway3.mail.pro1.eigbox.com (Postfix) with ESMTP id C451E10048C1E for ; Sun, 29 Jan 2023 16:21:22 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id MAQkpaT5WIqHFMAQkpN8bV; Sun, 29 Jan 2023 16:21:22 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=d/AwdTvE c=1 sm=1 tr=0 ts=63d69d02 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=RvmDmJFTN0MA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=CCpqsmhAAAAA:8 a=peyYD-nQKP5d7ILD754A:9 a=ul9cdbp4aOFLsgKbc677:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=JWofi/NUWRUdPlj2J+o47EN7N1/7KFvyAgmPCNg6fps=; b=yjaFk7heUh3ENkauWn1OnXprpi D/lgeXURT9pk13lzBvCfEX6TtEvqx9BRQaqrOg3C9RFKRaXjsThump5JhcWG4NAAgLhLgSraei1DS jgXSWFdWAS3DpEC1l8oATykfZ; Received: from 75-166-146-144.hlrn.qwest.net ([75.166.146.144]:59376 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pMAQk-001fCo-C1; Sun, 29 Jan 2023 09:21:22 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/5] Save breakpoints so they are automatically pending Date: Sun, 29 Jan 2023 09:21:01 -0700 Message-Id: <20230129162105.526266-2-tom@tromey.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230129162105.526266-1-tom@tromey.com> References: <20230129162105.526266-1-tom@tromey.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.146.144 X-Source-L: No X-Exim-ID: 1pMAQk-001fCo-C1 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-146-144.hlrn.qwest.net (localhost.localdomain) [75.166.146.144]:59376 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" PR breakpoints/18183 points out that breakpoints saved with the "save breakpoints" command can be slightly inconvenient, depending on "set breakpoint pending". This patch makes use of the new "with" command to save breakpoints such that they will automatically be made pending, if necessary, when being restored. Unfortunately, reloading a breakpoint saved this way will also print: No symbol table is loaded. Use the "file" command. This seems strange to me, and also a bit useless, but changing create_breakpoint not to call exception_print in the AUTO_BOOLEAN_TRUE case caused other regressions, so I've left it as-is for the time being. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18183 --- gdb/breakpoint.c | 1 + gdb/testsuite/gdb.base/catch-signal.exp | 10 +++++----- gdb/testsuite/gdb.base/save-bp.exp | 20 ++++++++++++++++++++ gdb/testsuite/gdb.base/ui-redirect.exp | 7 ++++--- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 00cc2ab401c..bd11d26fca4 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -14170,6 +14170,7 @@ save_breakpoints (const char *filename, int from_tty, if (filter && !filter (tp)) continue; + fp.puts ("with breakpoint pending on -- "); tp->print_recreate (&fp); /* Note, we can't rely on tp->number for anything, as we can't diff --git a/gdb/testsuite/gdb.base/catch-signal.exp b/gdb/testsuite/gdb.base/catch-signal.exp index 774eb8ee856..2e3160c2a33 100644 --- a/gdb/testsuite/gdb.base/catch-signal.exp +++ b/gdb/testsuite/gdb.base/catch-signal.exp @@ -128,10 +128,10 @@ foreach {arg desc} {"" "standard signals" \ set data [split $file_data "\n"] close $fd - if {$arg == ""} { - set pattern "catch signal" - } else { - set pattern "catch signal $arg" + set prefix "with breakpoint pending on -- " + set pattern "${prefix}catch signal" + if {$arg != ""} { + append pattern " $arg" } gdb_assert {[expr [llength $data] == 3]} \ "Number of lines of save breakpoints for '$arg'" @@ -139,7 +139,7 @@ foreach {arg desc} {"" "standard signals" \ gdb_assert {[string match $pattern [lindex $data 0]]} \ "1st line of save breakpoints for '$arg'" # Check the second line. - gdb_assert {[string match "break main" [lindex $data 1]]} \ + gdb_assert {[string match "${prefix}break main" [lindex $data 1]]} \ "2nd line of save breakpoints for '$arg'" # Check the trailing newline. gdb_assert {[string match "" [lindex $data 2]]} \ diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp index a39712c7f5c..daa7509ae8e 100644 --- a/gdb/testsuite/gdb.base/save-bp.exp +++ b/gdb/testsuite/gdb.base/save-bp.exp @@ -89,3 +89,23 @@ gdb_test_sequence "info break" "info break" [list \ "\[\r\n\]+\[ \t\]+printf" \ "\[\r\n\]+$disabled_row_start main at \[^\r\n\]*$srcfile:$loc_bp8" \ ] + +clean_restart +gdb_test "source $bps" "" "source bps without symbol file" + +set pending "\[0-9\]+ +breakpoint +keep +y + +" +set disabled_pending "\[0-9\]+ +breakpoint +keep +n + +" +set dprintf_pending "\[0-9\]+ +dprintf +keep +y + +" +gdb_test_sequence "info break" "info break without symbol file" \ + [list \ + "\[\r\n\]+Num +Type +Disp +Enb +Address +What" \ + "\[\r\n\]+$pending break_me" \ + "\[\r\n\]+$pending $srcfile:$loc_bp2" \ + "\[\r\n\]+$pending $srcfile:$loc_bp3 +thread 1" \ + "\[\r\n\]+$pending $srcfile:$loc_bp4" \ + "\[\r\n\]+\[ \t\]+stop only if i == 1( \\((host|target) evals\\))?" \ + "\[\r\n\]+$pending $srcfile:$loc_bp5" \ + "\[\r\n\]+\[ \t\]+silent" \ + "\[\r\n\]+$dprintf_pending $srcfile:$loc_bp5," \ + "\[\r\n\]+$disabled_pending $srcfile:$loc_bp8" \ + ] diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp index c0ba4f11809..a95e4fa6e90 100644 --- a/gdb/testsuite/gdb.base/ui-redirect.exp +++ b/gdb/testsuite/gdb.base/ui-redirect.exp @@ -42,13 +42,14 @@ gdb_test_no_output "end" gdb_breakpoint "foo" gdb_breakpoint "bar" +set prefix "with breakpoint pending on -- " set cmds [multi_line_input \ - "break -qualified main" \ + "${prefix}break -qualified main" \ " commands" \ " print 1" \ " end" \ - "break foo" \ - "break bar"] + "${prefix}break foo" \ + "${prefix}break bar"] set cmds "$cmds\n" set outdir [standard_output_file {}] set cmds_file "$outdir/cmds.txt"