From patchwork Wed Nov 23 18:39:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61032 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 24D7838518BF for ; Wed, 23 Nov 2022 18:41:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24D7838518BF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669228862; bh=bOSTWqo3/IAW3QOkwDZwPm0nVakFLslIEyRD6OtzY6c=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=M9hg/Yo6ifRL8Y8G10nr3bQCwjKsWTOZcLelXitGxd5eXN5wm5BFmxFxBIsaUhWR9 XKZemip6wNagvhaLA4Luh02t8SHuImF1i7KqTevObfC1bh/wR4PA6y1cGDo45A+HAO 2nbgqiAmSTvPo9nOmZyu/duaZl0v1+fA4XJ35bYE= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id BDFEE38518A4 for ; Wed, 23 Nov 2022 18:40:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BDFEE38518A4 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIe3TE026651 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:40:07 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIe3TE026651 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id D75171E11F; Wed, 23 Nov 2022 13:40:02 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 01/14] gdb/testsuite/gdb.base/break.exp: split test_break_commands_clear Date: Wed, 23 Nov 2022 13:39:46 -0500 Message-Id: <20221123183959.2476477-2-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:40:03 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: Ia58f90117d52fc419fc494836d9b4ed5d902fe9b --- gdb/testsuite/gdb.base/break.exp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index cb5831ac6103..c0756cdccc23 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -897,13 +897,21 @@ with_test_prefix "set line:file breakpoint via convenience variable" { "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_actual" "verify that they were cleared" +proc_with_prefix test_break_commands_clear {} { + clean_restart breako2 + + set line [gdb_get_line_number "set breakpoint 1 here"] + gdb_breakpoint $line + + 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:$::decimal" "verify that they were cleared" +} + +test_break_commands_clear From patchwork Wed Nov 23 18:39:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61031 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 5B19F38518A8 for ; Wed, 23 Nov 2022 18:40:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B19F38518A8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669228841; bh=LiJu+/0nhPHBPnZwaDgNUPwqcfVsWxHtVVC44Z1OsSQ=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=AZSzotNtGFY1FPjMxzaFwg5gPvyTb2taCO9mWwojif2B+roACBIn9R3Ddp1XbP6a/ +ngiXMAiHKoTyApvfwfjgUn5hZd8NjUevVK2r/XOe4PNdBuWe6DWIPGhp4kwHMHDCZ 1wVi7OCG/FwBifYl3yakDLs68ynuz6LsPbFoh8cM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 1925038518A5 for ; Wed, 23 Nov 2022 18:40:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1925038518A5 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIe3gV026654 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:40:08 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIe3gV026654 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 3B68E1E124; Wed, 23 Nov 2022 13:40:03 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 02/14] gdb/testsuite/gdb.base/break.exp: split test_break_file_line_convenience_var Date: Wed, 23 Nov 2022 13:39:47 -0500 Message-Id: <20221123183959.2476477-3-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:40:03 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: I0c31b037669b2917e062bf431372fb6531f8f53c --- gdb/testsuite/gdb.base/break.exp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index c0756cdccc23..be349d9e7eaf 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -868,18 +868,18 @@ gdb_test_multiple "" $test { } } -# # Test break via convenience variable with file name -# -with_test_prefix "set line:file breakpoint via convenience variable" { +proc_with_prefix test_break_file_line_convenience_var {} { + clean_restart breako2 + set line [gdb_get_line_number "set breakpoint 1 here"] gdb_test_no_output "set \$l = $line" set line_actual "-1" - set test "break ${srcfile}:\$l" + set test "break $::srcfile:\$l" gdb_test_multiple "$test" $test { - -re "Breakpoint $decimal at $hex: file .*break\\.c, line ($decimal)\\.\r\n$gdb_prompt $" { + -re "Breakpoint $::decimal at $::hex: file .*break\\.c, line ($::decimal)\\.\r\n$::gdb_prompt $" { # Save the actual line number on which the breakpoint was # actually set. On some systems (Eg: Ubuntu 16.04 with GCC # version 5.4.0), that line gets completely inlined, including @@ -892,11 +892,13 @@ with_test_prefix "set line:file breakpoint via convenience variable" { gdb_test_no_output "set \$foo=81.5" \ "set convenience variable \$foo to 81.5" - gdb_test "break $srcfile:\$foo" \ + gdb_test "break $::srcfile:\$foo" \ "Convenience variables used in line specs must have integer values.*" \ "non-integer convenience variable disallowed" } +test_break_file_line_convenience_var + # Test that commands can be cleared without error. proc_with_prefix test_break_commands_clear {} { From patchwork Wed Nov 23 18:39:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61033 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 BD56838518BE for ; Wed, 23 Nov 2022 18:41:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BD56838518BE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669228889; bh=CCIcMEkPMJq5fjCTUU89BFl0CSDxAXTiHuRoyf85YV4=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=mMjJaacnfTdHglv8CKPpH3Gm14gtRIHbIQARFu/lQZIl+TrGC63/GsewCRFRGL+D9 u2c+fGhin0K6STHghJ1GU7xGk2Xejh5fY0y35dMGopSWfmQrd+TnzHmrx3WoK7VM9Y yD3zPsQAHRl8lC/R5xCgBK/cb+7FvCFsco6YhqBE= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 4FFBB38518A6 for ; Wed, 23 Nov 2022 18:40:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4FFBB38518A6 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIe3ot026662 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:40:08 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIe3ot026662 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6F4701E126; Wed, 23 Nov 2022 13:40:03 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 03/14] gdb/testsuite/gdb.base/break.exp: split test_rbreak_shlib Date: Wed, 23 Nov 2022 13:39:48 -0500 Message-Id: <20221123183959.2476477-4-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:40:03 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: I130e8914c2713095aab03e84aba1481b4c7af978 --- gdb/testsuite/gdb.base/break.exp | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index be349d9e7eaf..a9728798fab9 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -835,9 +835,6 @@ gdb_test_multiple "continue" \ } } -clean_restart breako2 - -# # test that 'rbreak' on a symbol that may be from a shared library doesn't # cause a "Junk at end of arguments." error. # @@ -846,28 +843,31 @@ clean_restart breako2 # Note that this test won't necessarily choke on all targets even if # all the rbreak issue is present. rbreak needs to match and set a # breakpoint on a symbol causes 'break' to choke. -# -gdb_test_no_output "set breakpoint pending on" "rbreak junk pending setup" +proc_with_prefix test_rbreak_shlib {} { + clean_restart breako2 -# We expect at least one breakpoint to be set when we "rbreak main". -gdb_test "rbreak main" \ - ".*Breakpoint.*at.* file .*$srcfile, line.*" \ - "rbreak junk set breakpoint" + gdb_test_no_output "set breakpoint pending on" "rbreak junk pending setup" -# Run to a breakpoint. Fail if we see "Junk at end of arguments". -gdb_run_cmd + # We expect at least one breakpoint to be set when we "rbreak main". + gdb_test "rbreak main" \ + ".*Breakpoint.*at.* file .*$::srcfile, line.*" -set test "rbreak junk" -gdb_test_multiple "" $test { - -re "Junk at end of arguments" { - fail $test - } - -re ".*Breakpoint \[0-9\]+,.*$gdb_prompt $" { - pass $test + # Run to a breakpoint. Fail if we see "Junk at end of arguments". + gdb_run_cmd + + gdb_test_multiple "" "rbreak junk" { + -re -wrap "Junk at end of arguments.*" { + fail $gdb_test_name + } + -re -wrap ".*Breakpoint \[0-9\]+,.*" { + pass $gdb_test_name + } } } +test_rbreak_shlib + # Test break via convenience variable with file name proc_with_prefix test_break_file_line_convenience_var {} { From patchwork Wed Nov 23 18:39:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61042 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 0AF6E384F6C1 for ; Wed, 23 Nov 2022 19:00:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AF6E384F6C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669230015; bh=fowY2okJEtJeKsh3+6Fi6a6adSC6KsWDQiyeFIOLLmQ=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=is2fV+DXynWdvv4SK9Gg0LiQKuvGepAPPLhYksVfXoMM6IuVAGT0XKoe994EIXggl 4Cey5xqOaAMtMj0BhP7YKm6XC+WYj2mA8BS7Np2KlhgQKyq+FgTgAOMPtZ/Qn9hylR uWiCGBOe5uOPMmyZ//UfG1PrjaTZwPJr9MgwBKzU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 894FD38518B5 for ; Wed, 23 Nov 2022 18:58:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 894FD38518B5 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIwpfG007706 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:58:55 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIwpfG007706 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id B91B11E128; Wed, 23 Nov 2022 13:40:03 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 04/14] gdb/testsuite/gdb.base/break.exp: split test_break_optimized_prologue Date: Wed, 23 Nov 2022 13:39:49 -0500 Message-Id: <20221123183959.2476477-5-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:58:51 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: Ibf17033c8ce72aa5cfe1b739be2902e84a5e945d --- gdb/testsuite/gdb.base/break.exp | 99 ++++++++++++++++---------------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index a9728798fab9..7e410b4adeec 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -773,68 +773,65 @@ test_next_with_recursion # build a new file with optimization enabled so that we can try breakpoints # on targets with optimized prologues -if { [prepare_for_testing "failed to prepare" "breako2" {break.c break1.c} {debug nowarnings optimize=-O2}] } { +if { [build_executable "failed to prepare" "breako2" {break.c break1.c} {debug nowarnings optimize=-O2}] } { return -1 } -# -# test break at function -# -gdb_test "break -q main" \ - "Breakpoint.*at.* file .*, line.*" \ - "breakpoint function, optimized file" - -# -# test break at function -# -gdb_test "break marker4" \ - "Breakpoint.*at.* file .*$srcfile1, line.*" \ - "breakpoint small function, optimized file" - -# -# run until the breakpoint at main is hit. For non-stubs-using targets. -# -gdb_run_cmd - -set test "run until function breakpoint, optimized file" -gdb_test_multiple "" $test { - -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" { - pass $test - } - -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $" { - pass "$test (code motion)" - } -} +proc_with_prefix test_break_optimized_prologue {} { + clean_restart breako2 -# -# run until the breakpoint at a small function -# + # test break at function + gdb_test "break -q main" \ + "Breakpoint.*at.* file .*, line.*" \ + "breakpoint function, optimized file" -# -# Add a second pass pattern. The behavior differs here between stabs -# and dwarf for one-line functions. Stabs preserves two line symbols -# (one before the prologue and one after) with the same line number, -# but dwarf regards these as duplicates and discards one of them. -# Therefore the address after the prologue (where the breakpoint is) -# has no exactly matching line symbol, and GDB reports the breakpoint -# as if it were in the middle of a line rather than at the beginning. + # test break at function + gdb_test "break marker4" \ + "Breakpoint.*at.* file .*$::srcfile1, line.*" \ + "breakpoint small function, optimized file" -set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] + # run until the breakpoint at main is hit. For non-stubs-using targets. + gdb_run_cmd -gdb_test_multiple "continue" \ - "run until breakpoint set at small function, optimized file" { - -re "Breakpoint $decimal, marker4 \\(d=(d@entry=)?177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { - pass "run until breakpoint set at small function, optimized file (line bp_location14)" + set test "run until function breakpoint, optimized file" + gdb_test_multiple "" $test { + -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$::srcfile:$::bp_location6.*$::bp_location6\[\t \]+if .argc.* \{.*$::gdb_prompt $" { + pass $test } - -re "Breakpoint $decimal, factorial \\(.*\\) .*\{\r\n$gdb_prompt" { - # GCC 4.3 emits bad line number information - see gcc/36748. - if { [test_compiler_info "gcc-4-3-*"] } { - setup_xfail *-*-* - } - fail "run until breakpoint set at small function, optimized file" + -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$::gdb_prompt $" { + pass "$test (code motion)" } } + # run until the breakpoint at a small function + # + # Add a second pass pattern. The behavior differs here between stabs + # and dwarf for one-line functions. Stabs preserves two line symbols + # (one before the prologue and one after) with the same line number, + # but dwarf regards these as duplicates and discards one of them. + # Therefore the address after the prologue (where the breakpoint is) + # has no exactly matching line symbol, and GDB reports the breakpoint + # as if it were in the middle of a line rather than at the beginning. + + set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $::srcfile1] + + gdb_test_multiple "continue" \ + "run until breakpoint set at small function, optimized file" { + -re "Breakpoint $::decimal, marker4 \\(d=(d@entry=)?177601976\\) at .*$::srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { + pass "run until breakpoint set at small function, optimized file (line bp_location14)" + } + -re "Breakpoint $::decimal, factorial \\(.*\\) .*\{\r\n$::gdb_prompt" { + # GCC 4.3 emits bad line number information - see gcc/36748. + if { [test_compiler_info "gcc-4-3-*"] } { + setup_xfail *-*-* + } + fail "run until breakpoint set at small function, optimized file" + } + } +} + +test_break_optimized_prologue + # test that 'rbreak' on a symbol that may be from a shared library doesn't # cause a "Junk at end of arguments." error. # From patchwork Wed Nov 23 18:39:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61044 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 D15963860742 for ; Wed, 23 Nov 2022 19:00:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D15963860742 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669230029; bh=RV042Cc7oMNxKOEvYQaTt6VQEYeUqLuNkF6u6kmpHMQ=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=mNqBxGWUQjYCDt3dEw4BLIv4nJYCoc+Td7IbIGemhXHqulbkNxlJ+LoOcPqc1UFLr YjFZZfMvHw9qNI50tAWHan+mCAoOQegB8LLoeFzkzAd7pE+fCa5qN+TR4fVpx8cd9L 3mX8tq26uVyLPHfBCW/wJrM6OMD3uiBtQLtjvzeA= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 85DEB38518AD for ; Wed, 23 Nov 2022 18:58:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 85DEB38518AD Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIwpa1007711 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:58:55 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIwpa1007711 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id E57621E129; Wed, 23 Nov 2022 13:40:03 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 05/14] gdb/testsuite/gdb.base/break.exp: use proc_with_prefix for test_next_with_recursion Date: Wed, 23 Nov 2022 13:39:50 -0500 Message-Id: <20221123183959.2476477-6-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:58:51 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This one is already in a proc, just make the proc use proc_with_prefix, for consistency. Change-Id: I313ecf5097ff04526c29396529baeba84e37df5a --- gdb/testsuite/gdb.base/break.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 7e410b4adeec..a888de8e2715 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -692,7 +692,7 @@ gdb_test_multiple "finish" "finish from outermost frame disallowed" { # Test "next" over recursive function call. # -proc test_next_with_recursion {} { +proc_with_prefix test_next_with_recursion {} { global gdb_prompt global decimal global binfile From patchwork Wed Nov 23 18:39:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61038 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 6D0E338518AD for ; Wed, 23 Nov 2022 18:49:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D0E338518AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669229359; bh=sx66g4/pr4cIRmSohidjMT3bhEWgJqxx3x8T7LD8+/A=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=RHKDb0fAp8PzEUl0VDQw1o18hRLvKTSNcC9QeQcj5n32UTenQ9bLixmrDjO4I1wln AaqHkXr6y4Ti2TIEgqUBGzVAM2MhoX/FIMoC9sQza5mvZrAM8KA07QK0rrJeco7NQ7 sYd6e3G6Yx517efaJx3ZMfZpgyKaquaJN+dpmIkA= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 52FBB38518AB for ; Wed, 23 Nov 2022 18:48:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 52FBB38518AB Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANImpMJ001022 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:48:56 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANImpMJ001022 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 3CF811E12A; Wed, 23 Nov 2022 13:40:04 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 06/14] gdb/testsuite/gdb.base/break.exp: split test_finish_arguments Date: Wed, 23 Nov 2022 13:39:51 -0500 Message-Id: <20221123183959.2476477-7-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:48:51 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: Id84babed1eeb3ce7d14b94ff332795964e8ead51 --- gdb/testsuite/gdb.base/break.exp | 50 ++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index a888de8e2715..1f6c620ee0cb 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -656,35 +656,41 @@ gdb_test_multiple "finish" "finish from called function" { # Verify that GDB responds gracefully to a "finish" command with # arguments. -# -if ![runto_main] then { - return -} -send_gdb "finish 123\n" -gdb_expect { - -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\ - {pass "finish with arguments disallowed"} - -re "$gdb_prompt $"\ - {fail "finish with arguments disallowed"} - timeout {fail "(timeout) finish with arguments disallowed"} -} +proc_with_prefix test_finish_arguments {} { + clean_restart break -# Verify that GDB responds gracefully to a request to "finish" from -# the outermost frame. On a stub that never exits, this will just -# run to the stubs routine, so we don't get this error... Thus the -# second condition. -# + if ![runto_main] then { + return + } -gdb_test_multiple "finish" "finish from outermost frame disallowed" { - -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $" { - pass "finish from outermost frame disallowed" + send_gdb "finish 123\n" + gdb_expect { + -re "The \"finish\" command does not take any arguments.\r\n$::gdb_prompt $"\ + {pass "finish with arguments disallowed"} + -re "$::gdb_prompt $"\ + {fail "finish with arguments disallowed"} + timeout {fail "(timeout) finish with arguments disallowed"} } - -re "Run till exit from.*\r\n$gdb_prompt $" { - pass "finish from outermost frame disallowed" + + # Verify that GDB responds gracefully to a request to "finish" from + # the outermost frame. On a stub that never exits, this will just + # run to the stubs routine, so we don't get this error... Thus the + # second condition. + # + + gdb_test_multiple "finish" "finish from outermost frame disallowed" { + -re "\"finish\" not meaningful in the outermost frame.\r\n$::gdb_prompt $" { + pass "finish from outermost frame disallowed" + } + -re "Run till exit from.*\r\n$::gdb_prompt $" { + pass "finish from outermost frame disallowed" + } } } +test_finish_arguments + #******** From patchwork Wed Nov 23 18:39:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61043 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 8BEE8384F6E5 for ; Wed, 23 Nov 2022 19:00:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BEE8384F6E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669230015; bh=ZH1PVRXr7yL/zRWYJnCohay61fH9sQ68M4CkypMViiI=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=I//Exh7ujHkW4niTFBPtRV+0XuMtI+pRAmbKG94gFFUA46Dmyz6cOsJ+j1UHU7jH2 JJ55eNOY21p2no8SGFFUWCM3Ty1QgF7MQoTt7zpjzznjaHIF38GHMRD4ScYTcLN0Xj JoKh0ea6tuS8vJoTT7S6+AMiuz9nJzFcKawDX29k= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 8606638518B3 for ; Wed, 23 Nov 2022 18:58:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8606638518B3 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIwpoE007708 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:58:55 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIwpoE007708 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 80A141E12C; Wed, 23 Nov 2022 13:40:04 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 07/14] gdb/testsuite/gdb.base/break.exp: split test_break_user_call Date: Wed, 23 Nov 2022 13:39:52 -0500 Message-Id: <20221123183959.2476477-8-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:58:51 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: I9151ce9db9435722b758f41c6606b461bf15f320 --- gdb/testsuite/gdb.base/break.exp | 54 +++++++++++++++++++------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 1f6c620ee0cb..d9cfeb9b21f0 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -626,34 +626,44 @@ with_test_prefix "set line breakpoint via convenience variable" { } # Verify that we can set and trigger a breakpoint in a user-called function. -# -gdb_test "break marker2" \ - "Breakpoint (\[0-9\]*) at .*, line $bp_location8.*" \ - "set breakpoint on to-be-called function" - -gdb_test "print marker2(99)" \ - "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.[func marker2]. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.*" \ - "hit breakpoint on called function" -# As long as we're stopped (breakpointed) in a called function, -# verify that we can successfully backtrace & such from here. -gdb_test "bt" \ - "#0\[ \t\]*($hex in )?marker2.*:$bp_location8\r\n#1\[ \t\]*.*" \ - "backtrace while in called function" +proc_with_prefix test_break_user_call {} { + clean_restart break -# Return from the called function. For remote targets, it's important to do -# this before runto_main, which otherwise may silently stop on the dummy -# breakpoint inserted by GDB at the program's entry point. -# -gdb_test_multiple "finish" "finish from called function" { - -re "Run till exit from .*marker2.* at .*$bp_location8\r\n.*function called from gdb.*$gdb_prompt $" { - pass "finish from called function" + if { ![runto_main] } { + return } - -re "Run till exit from .*marker2.* at .*$bp_location8\r\n.*Value returned.*$gdb_prompt $" { - pass "finish from called function" + + gdb_test "break marker2" \ + "Breakpoint (\[0-9\]*) at .*, line $::bp_location8.*" \ + "set breakpoint on to-be-called function" + + gdb_test "print marker2(99)" \ + "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.[func marker2]. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.*" \ + "hit breakpoint on called function" + + # As long as we're stopped (breakpointed) in a called function, + # verify that we can successfully backtrace & such from here. + gdb_test "bt" \ + "#0\[ \t\]*($::hex in )?marker2.*:$::bp_location8\r\n#1\[ \t\]*.*" \ + "backtrace while in called function" + + # Return from the called function. For remote targets, it's important to do + # this before runto_main, which otherwise may silently stop on the dummy + # breakpoint inserted by GDB at the program's entry point. + # + gdb_test_multiple "finish" "finish from called function" { + -re "Run till exit from .*marker2.* at .*$::bp_location8\r\n.*function called from gdb.*$::gdb_prompt $" { + pass "finish from called function" + } + -re "Run till exit from .*marker2.* at .*$::bp_location8\r\n.*Value returned.*$::gdb_prompt $" { + pass "finish from called function" + } } } +test_break_user_call + # Verify that GDB responds gracefully to a "finish" command with # arguments. From patchwork Wed Nov 23 18:39:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61034 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 987FA384F6D1 for ; Wed, 23 Nov 2022 18:42:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 987FA384F6D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669228955; bh=rli+B4tzRJkw7rwrUyBfISLtyQXxmCwzQbxzhPXIfbk=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=e83DX000i6V1pbTx7tgGHCgB1YD7GhxXuhxOgljAZ1O7mXGTVYvhZXxDOSrisjl3c cmdaPqYzjBaQcMWfRMX2nKx2+oTEtVBS5tSvcq6TtfX4XpJ55Gy91LPuXzldRqYiB5 YLylRs9m0jCfvL5S7/oU+VNIs954+FBB6zvoNsIY= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 6A42F38518A4 for ; Wed, 23 Nov 2022 18:42:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A42F38518A4 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIg5Od028135 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:42:10 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIg5Od028135 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6D82D1E0CB; Wed, 23 Nov 2022 13:42:05 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 08/14] gdb/testsuite/gdb.base/break.exp: split test_break_line_convenience_var Date: Wed, 23 Nov 2022 13:39:53 -0500 Message-Id: <20221123183959.2476477-9-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:42:05 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: I593002373da971a0a4d6b5355d3fe321873479ab --- gdb/testsuite/gdb.base/break.exp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index d9cfeb9b21f0..cc327c195f46 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -604,18 +604,22 @@ gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2" gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} # Verify that a breakpoint can be set via a convenience variable. -# -with_test_prefix "set line breakpoint via convenience variable" { - gdb_test_no_output "set \$foo=$bp_location11" \ +proc_with_prefix test_break_line_convenience_var {} { + clean_restart break + + if { ![runto_main] } { + return + } + + gdb_test_no_output "set \$foo=$::bp_location11" \ "set convenience variable \$foo to bp_location11" gdb_test "break \$foo" \ - "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*" + "Breakpoint (\[0-9\]*) at .*, line $::bp_location11.*" # Verify that GDB responds gracefully to an attempt to set a # breakpoint via a convenience variable whose type is not integer. - # gdb_test_no_output "set \$foo=81.5" \ "set convenience variable \$foo to 81.5" @@ -625,6 +629,8 @@ with_test_prefix "set line breakpoint via convenience variable" { "non-integer convenience variable disallowed" } +test_break_line_convenience_var + # Verify that we can set and trigger a breakpoint in a user-called function. proc_with_prefix test_break_user_call {} { From patchwork Wed Nov 23 18:39:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61035 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 27884386187E for ; Wed, 23 Nov 2022 18:42:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 27884386187E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669228957; bh=MypTuBChxv5yLlcBvrUaa3mldTOPHPB60LRJX/DtBhs=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=E2TvIzIZg8L79bVyxsdhZ3Bm/jNRdXJt14/oFpclJbVfVsYhKv7CG15sDp55n2dVz LkQBH/qNVdZyumCrrk88Nu/Sg8G0B0B7sGFVJG74nSzxVXQB43NFGYwPIFzd1EakB1 qHI1u4n2nj+jedI2JkNCle+W6+2Wddn1nUFLeYNQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id A850C38518A6 for ; Wed, 23 Nov 2022 18:42:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A850C38518A6 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIg608028140 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:42:10 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIg608028140 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CD7911E11F; Wed, 23 Nov 2022 13:42:05 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 09/14] gdb/testsuite/gdb.base/break.exp: split test_break_silent_and_more Date: Wed, 23 Nov 2022 13:39:54 -0500 Message-Id: <20221123183959.2476477-10-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:42:06 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This one is a bit tricky. The clear tests seem to depend on the various breakpoints that have been set before, starting with the "silent" breakpoints. So, move all this in a single chunk, it can always be split later if needed. Change-Id: I7ba61a5b130ade63eda0c4790534840339f8a72f --- gdb/testsuite/gdb.base/break.exp | 118 ++++++++++++++++--------------- 1 file changed, 62 insertions(+), 56 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index cc327c195f46..e8762ffa664c 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -533,75 +533,81 @@ gdb_test "break if (1)" \ # Verify that a "silent" breakpoint can be set, and that GDB is indeed # "silent" about its triggering. -# -if ![runto_main] then { - return -} -gdb_test_multiple "break $bp_location1" \ - "set to-be-silent break bp_location1" { - -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $" { - set bpno $expect_out(1,string) - pass "set to-be-silent break bp_location1" - } +proc_with_prefix test_break_silent_and_more {} { + clean_restart break + + if ![runto_main] then { + return } -gdb_test "commands $bpno\nsilent\nend" ">end" "set silent break bp_location1" + gdb_test_multiple "break $::bp_location1" \ + "set to-be-silent break bp_location1" { + -re "Breakpoint (\[0-9\]*) at .*, line $::bp_location1.*$::gdb_prompt $" { + set bpno $expect_out(1,string) + pass "set to-be-silent break bp_location1" + } + } -gdb_test "info break $bpno" \ - "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*" \ - "info silent break bp_location1" + gdb_test "commands $bpno\nsilent\nend" ">end" "set silent break bp_location1" -gdb_test "continue" "Continuing." \ - "hit silent break bp_location1" + gdb_test "info break $bpno" \ + "\[0-9\]*\[ \t\]*breakpoint.*:$::bp_location1\r\n\[ \t\]*silent.*" \ + "info silent break bp_location1" -gdb_test "bt" "#0 main .* at .*:$bp_location1.*" \ - "stopped for silent break bp_location1" + gdb_test "continue" "Continuing." \ + "hit silent break bp_location1" -# Verify the $_hit_bpnum convenience variable is set to the silent hit bpno. -gdb_test "printf \"%d\\n\", \$_hit_bpnum" "$bpno" \ - "Silent breakpoint hit \$_hit_bpnum is silent $bpno" - -# Verify that GDB can at least parse a breakpoint with the -# "thread" keyword. (We won't attempt to test here that a -# thread-specific breakpoint really triggers appropriately. -# The gdb.threads subdirectory contains tests for that.) -# -set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] -gdb_test "break $bp_location12 thread 999" "Unknown thread 999.*" \ - "thread-specific breakpoint on non-existent thread disallowed" + gdb_test "bt" "#0 main .* at .*:$::bp_location1.*" \ + "stopped for silent break bp_location1" -gdb_test "break $bp_location12 thread foo" \ - "Invalid thread ID: foo" \ - "thread-specific breakpoint on bogus thread ID disallowed" + # Verify the $_hit_bpnum convenience variable is set to the silent hit bpno. + gdb_test "printf \"%d\\n\", \$_hit_bpnum" "$bpno" \ + "Silent breakpoint hit \$_hit_bpnum is silent $bpno" -# Verify that GDB responds gracefully to a breakpoint command with -# trailing garbage. -# -gdb_test "break $bp_location12 foo" \ - "malformed linespec error: unexpected string, \"foo\".*" \ - "breakpoint with trailing garbage disallowed" + # Verify that GDB can at least parse a breakpoint with the + # "thread" keyword. (We won't attempt to test here that a + # thread-specific breakpoint really triggers appropriately. + # The gdb.threads subdirectory contains tests for that.) + # + set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] + gdb_test "break $bp_location12 thread 999" "Unknown thread 999.*" \ + "thread-specific breakpoint on non-existent thread disallowed" -# Verify that GDB responds gracefully to a "clear" command that has -# no matching breakpoint. (First, get us off the current source line, -# which we know has a breakpoint.) -# -gdb_test "next" "marker1.*" "step over breakpoint" + gdb_test "break $bp_location12 thread foo" \ + "Invalid thread ID: foo" \ + "thread-specific breakpoint on bogus thread ID disallowed" -gdb_test "clear 81" "No breakpoint at 81.*" \ - "clear line has no breakpoint disallowed" + # Verify that GDB responds gracefully to a breakpoint command with + # trailing garbage. + # + gdb_test "break $bp_location12 foo" \ + "malformed linespec error: unexpected string, \"foo\".*" \ + "breakpoint with trailing garbage disallowed" -gdb_test "clear" "No breakpoint at this line.*" \ - "clear current line has no breakpoint disallowed" + # Verify that GDB responds gracefully to a "clear" command that has + # no matching breakpoint. (First, get us off the current source line, + # which we know has a breakpoint.) + # + gdb_test "next" "marker1.*" "step over breakpoint" -# Verify that we can set and clear multiple breakpoints. -# -# We don't test that it deletes the correct breakpoints. We do at -# least test that it deletes more than one breakpoint. -# -gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1" -gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2" -gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} + gdb_test "clear 81" "No breakpoint at 81.*" \ + "clear line has no breakpoint disallowed" + + gdb_test "clear" "No breakpoint at this line.*" \ + "clear current line has no breakpoint disallowed" + + # Verify that we can set and clear multiple breakpoints. + # + # We don't test that it deletes the correct breakpoints. We do at + # least test that it deletes more than one breakpoint. + # + gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1" + gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2" + gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} +} + +test_break_silent_and_more # Verify that a breakpoint can be set via a convenience variable. From patchwork Wed Nov 23 18:39:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61037 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 82F3438518AA for ; Wed, 23 Nov 2022 18:43:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82F3438518AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669228987; bh=wYuKSpxUUCq5cNJpKcpZnYgF8sxxhIW4rk5ah18bJns=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=k2VmrutlqExkfgyjrwSQBa1IEiRK+IC6STZ31uFjwH4bynUWv0ivKYPsgp4SKVOyV lEaK5g20LayyE3HOl0ryTEZZuchAdpvOE+xKw0v2TeBzWtMhYsIRjRET7zcnRM1Eo9 snxMiGM4Hw84vrojkenxc6rhA6jvAnihYYdu4LpM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 4203638518A7 for ; Wed, 23 Nov 2022 18:42:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4203638518A7 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIg6Ts028150 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:42:11 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIg6Ts028150 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 4E0481E124; Wed, 23 Nov 2022 13:42:06 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 10/14] gdb/testsuite/gdb.base/break.exp: split test_break_default Date: Wed, 23 Nov 2022 13:39:55 -0500 Message-Id: <20221123183959.2476477-11-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:42:06 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" One special thing here is that the part just above this one, that sets catchpoints and verifies they are not hit, requires that we resume execution to verify that the catchpoints are indeed not hit. I guess it was previously achieved by the until command, but it doesn't happen now that the until is moved into test_break_default. Add a gdb_continue_to_end after setting the catchpoints. If any catchpoint were to be hit, it would catch the problem. Change-Id: I5d4b43da91886b1beda9f6e56b05aa04331a9c05 --- gdb/testsuite/gdb.base/break.exp | 62 +++++++++++++++++++------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index e8762ffa664c..b4d12cb56a92 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -492,6 +492,8 @@ gdb_test "catch vfork" "Catchpoint \[0-9\]+ \\(vfork\\)" \ gdb_test "catch exec" "Catchpoint \[0-9\]+ \\(exec\\)" \ "set catch exec, never expected to trigger" +gdb_continue_to_end + # Verify that GDB responds gracefully when asked to set a breakpoint # on a nonexistent source line. # @@ -500,36 +502,46 @@ gdb_test "break 999" \ "No line 999 in the current file." \ "break on non-existent source line" -# Run to the desired default location. If not positioned here, the -# tests below don't work. -# -gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" \ - "until bp_location1" +proc_with_prefix test_break_default {} { + clean_restart break -# Verify that GDB allows one to just say "break", which is treated -# as the "default" breakpoint. Note that GDB gets cute when printing -# the informational message about other breakpoints at the same -# location. We'll hit that bird with this stone too. -# -gdb_test "break" "Breakpoint \[0-9\]*.*" \ - "break on default location, 1st time" + if ![runto_main] then { + return + } -gdb_test "break" \ - "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \ - "break on default location, 2nd time" + # Run to the desired default location. If not positioned here, the + # tests below don't work. + # + gdb_test "until $::bp_location1" "main .* at .*:$::bp_location1.*" \ + "until bp_location1" + + # Verify that GDB allows one to just say "break", which is treated + # as the "default" breakpoint. Note that GDB gets cute when printing + # the informational message about other breakpoints at the same + # location. We'll hit that bird with this stone too. + # + gdb_test "break" "Breakpoint \[0-9\]*.*" \ + "break on default location, 1st time" -gdb_test "break" \ - "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \ - "break on default location, 3rd time" + gdb_test "break" \ + "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \ + "break on default location, 2nd time" -gdb_test "break" \ - "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \ - "break on default location, 4th time" + gdb_test "break" \ + "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \ + "break on default location, 3rd time" + + gdb_test "break" \ + "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \ + "break on default location, 4th time" + + # Check setting a breakpoint at the default location with a condition attached. + gdb_test "break if (1)" \ + "Note: breakpoints \[0-9\]*, \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \ + "break on the default location, 5th time, but with a condition" +} -# Check setting a breakpoint at the default location with a condition attached. -gdb_test "break if (1)" \ - "Note: breakpoints \[0-9\]*, \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*" \ - "break on the default location, 5th time, but with a condition" +test_break_default # Verify that a "silent" breakpoint can be set, and that GDB is indeed # "silent" about its triggering. From patchwork Wed Nov 23 18:39:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61036 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 BA2E138518B5 for ; Wed, 23 Nov 2022 18:42:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA2E138518B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669228959; bh=SgBbZcShoJz6dQWCBMQW8FdH5/m3qfpNNWfMUpUAKwY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=PkUoNA0qknVT0/0bMD/9Pj7u3W/6d251cf+tqAg1P7ZsX9jau5WN5vgSrcv95+2LI ys9Z0TEWWnab2s3Clrsk6XenGch/41o6amsGzyb7xKigHaF5dgdKNnTJb6JuQP3r71 NsQxa7lhb6/giZYsf+Ipvmi0/VV2Wv831VJoYI8g= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 655D638518A8 for ; Wed, 23 Nov 2022 18:42:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 655D638518A8 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANIg6Lu028153 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:42:11 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANIg6Lu028153 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 932FF1E126; Wed, 23 Nov 2022 13:42:06 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 11/14] gdb/testsuite/gdb.base/break.exp: split test_break_nonexistent_line Date: Wed, 23 Nov 2022 13:39:56 -0500 Message-Id: <20221123183959.2476477-12-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:42:06 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: I4390dd5da23bae83ccc513ad0de0169ddff7df12 --- gdb/testsuite/gdb.base/break.exp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index b4d12cb56a92..a5ef521a4b0a 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -496,11 +496,21 @@ gdb_continue_to_end # Verify that GDB responds gracefully when asked to set a breakpoint # on a nonexistent source line. -# -gdb_test_no_output "set breakpoint pending off" -gdb_test "break 999" \ - "No line 999 in the current file." \ - "break on non-existent source line" + +proc_with_prefix test_break_nonexistent_line {} { + clean_restart break + + if ![runto_main] then { + return + } + + gdb_test_no_output "set breakpoint pending off" + gdb_test "break 999" \ + "No line 999 in the current file." \ + "break on non-existent source line" +} + +test_break_nonexistent_line proc_with_prefix test_break_default {} { clean_restart break From patchwork Wed Nov 23 18:39:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61039 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 68C7B38518BC for ; Wed, 23 Nov 2022 18:49:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68C7B38518BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669229387; bh=l/H0mYlrw8sAtg9ES6CHwSjWxsDCK3+rDLzI46SJbuY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=RI1HPbCWGumSmMHSmsJLOfOuc8708vpyQx7FI2v5hygS8OAJKW2+IFaekD+CLLEkD W/li7zTpht4x12JlmnJV6YvMvJipH4ZSvZGbY2DUKPIdP4tFuui4EHu0KSYm3LsiIB SmDHBUmIef8P6Aim5GqIGEsBNaD5ZXfwjmlGbz1k= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 52DE838518AA for ; Wed, 23 Nov 2022 18:48:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 52DE838518AA Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANImpH6001021 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:48:56 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANImpH6001021 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CC1851E12D; Wed, 23 Nov 2022 13:42:06 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 12/14] gdb/testsuite/gdb.base/break.exp: split test_no_break_on_catchpoint Date: Wed, 23 Nov 2022 13:39:57 -0500 Message-Id: <20221123183959.2476477-13-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:48:51 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Change-Id: Ifa7070943f1de22c2839fedf5f346d6591bb5a76 --- gdb/testsuite/gdb.base/break.exp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index a5ef521a4b0a..4a2f130ff290 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -478,21 +478,27 @@ gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] # Verify that catchpoints for fork, vfork and exec don't trigger # inappropriately. (There are no calls to those system functions # in this test program.) -# -if ![runto_main] then { - return -} -gdb_test "catch fork" "Catchpoint \[0-9\]+ \\(fork\\)" \ - "set catch fork, never expected to trigger" +proc_with_prefix test_no_break_on_catchpoint {} { + clean_restart break + + if ![runto_main] then { + return + } + + gdb_test "catch fork" "Catchpoint \[0-9\]+ \\(fork\\)" \ + "set catch fork, never expected to trigger" -gdb_test "catch vfork" "Catchpoint \[0-9\]+ \\(vfork\\)" \ - "set catch vfork, never expected to trigger" + gdb_test "catch vfork" "Catchpoint \[0-9\]+ \\(vfork\\)" \ + "set catch vfork, never expected to trigger" -gdb_test "catch exec" "Catchpoint \[0-9\]+ \\(exec\\)" \ - "set catch exec, never expected to trigger" + gdb_test "catch exec" "Catchpoint \[0-9\]+ \\(exec\\)" \ + "set catch exec, never expected to trigger" + + gdb_continue_to_end +} -gdb_continue_to_end +test_no_break_on_catchpoint # Verify that GDB responds gracefully when asked to set a breakpoint # on a nonexistent source line. From patchwork Wed Nov 23 18:39:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61040 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 C504838518AD for ; Wed, 23 Nov 2022 18:50:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C504838518AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669229414; bh=PftWQXTP+wFUJx20pqpjFzQmMB15lCs8MXLLGTTKNOY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=AYPKokPCgLiMjtbbpYGJLeEaMFsnjWYo4S5DRWns6FtHwNhc31mcIISRpXYPtWo7V bpmm8lZSYjQYfOqjNKpTMbj5QFyU9BrG+vm4Yla8x+ej2eEM1jTXw072SyQxw+njod x/ibF+IiAffiHSDEYsBVkXKzBuGoa7XPzCCEXqBw= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 5A5ED38518AC for ; Wed, 23 Nov 2022 18:48:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5A5ED38518AC Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANImpO7001023 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:48:56 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANImpO7001023 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 08F431E12E; Wed, 23 Nov 2022 13:42:07 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 13/14] gdb/testsuite/gdb.base/break.exp: split test_tbreak Date: Wed, 23 Nov 2022 13:39:58 -0500 Message-Id: <20221123183959.2476477-14-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:48:51 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Leave setting bp_location11 in the global scope, so that it's accessible to other procs. Change-Id: I8928f01640d3a1e993649b2168b9eda0724ee1d9 --- gdb/testsuite/gdb.base/break.exp | 82 ++++++++++++++------------------ 1 file changed, 36 insertions(+), 46 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 4a2f130ff290..1aa9476c0cf9 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -423,55 +423,45 @@ gdb_test "continue" \ ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10a.*$bp_location10a\[\t \]+}.*breakpoint 10a here.*" \ "continue to breakpoint at }" -# -# delete all breakpoints so we can start over, course this can be a test too -# -delete_breakpoints - -# -# test temporary breakpoint at function -# - -gdb_test "tbreak -q main" "Temporary breakpoint.*at.* file .*$srcfile, line.*" "temporary breakpoint function" - -# -# test break at function in file -# - -gdb_test "tbreak $srcfile:factorial" "Temporary breakpoint.*at.* file .*$srcfile, line.*" \ - "Temporary breakpoint function in file" - -# -# test break at line number -# -gdb_test "tbreak $bp_location1" \ - "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location1.*" \ - "temporary breakpoint line number #1" - -gdb_test "tbreak $bp_location6" "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location6.*" "temporary breakpoint line number #2" - -# -# test break at line number in file -# -gdb_test "tbreak $srcfile:$bp_location2" \ - "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location2.*" \ - "temporary breakpoint line number in file #1" - set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] -gdb_test "tbreak $srcfile:$bp_location11" "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2" -# -# check to see what breakpoints are set (temporary this time) -# -gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$main_line.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in [func factorial] at .*$srcfile:$bp_location7.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$bp_location1.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$bp_location6.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$bp_location2.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$bp_location11.*" \ - "Temporary breakpoint info" +proc_with_prefix test_tbreak {} { + clean_restart break + + # test temporary breakpoint at function + gdb_test "tbreak -q main" "Temporary breakpoint.*at.* file .*$::srcfile, line.*" "temporary breakpoint function" + + # test break at function in file + gdb_test "tbreak $::srcfile:factorial" "Temporary breakpoint.*at.* file .*$::srcfile, line.*" \ + "Temporary breakpoint function in file" + + # test break at line number + gdb_test "tbreak $::bp_location1" \ + "Temporary breakpoint.*at.* file .*$::srcfile, line $::bp_location1.*" \ + "temporary breakpoint line number #1" + + gdb_test "tbreak $::bp_location6" "Temporary breakpoint.*at.* file .*$::srcfile, line $::bp_location6.*" "temporary breakpoint line number #2" + + # test break at line number in file + gdb_test "tbreak $::srcfile:$::bp_location2" \ + "Temporary breakpoint.*at.* file .*$::srcfile, line $::bp_location2.*" \ + "temporary breakpoint line number in file #1" + + gdb_test "tbreak $::srcfile:$::bp_location11" "Temporary breakpoint.*at.* file .*$::srcfile, line $::bp_location11.*" "Temporary breakpoint line number in file #2" + + # check to see what breakpoints are set (temporary this time) + gdb_test "info break" \ + [multi_line "Num Type.*Disp Enb Address.*What.*" \ + "$::decimal\[\t \]+breakpoint del.*y.*in [func main] at .*$::srcfile:$::main_line.*" \ + "$::decimal\[\t \]+breakpoint del.*y.*in [func factorial] at .*$::srcfile:$::bp_location7.*" \ + "$::decimal\[\t \]+breakpoint del.*y.*in [func main] at .*$::srcfile:$::bp_location1.*" \ + "$::decimal\[\t \]+breakpoint del.*y.*in [func main] at .*$::srcfile:$::bp_location6.*" \ + "$::decimal\[\t \]+breakpoint del.*y.*in [func main] at .*$::srcfile:$::bp_location2.*" \ + "$::decimal\[\t \]+breakpoint del.*y.*in [func main] at .*$::srcfile:$::bp_location11.*"] \ + "Temporary breakpoint info" +} +test_tbreak #*********** From patchwork Wed Nov 23 18:39:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 61041 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 919863851405 for ; Wed, 23 Nov 2022 18:50:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 919863851405 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669229442; bh=OZ2EbA2FhGeSHV1jsDBlPsvj8hnnrVXdS+xaPfndBEY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=uY+Gre6daI02YsyiPxxpt3fcghvFj2tOqpCbyngZWmlgvLTUGDBWKUEkJ+GvXvqtt 3z0LXci8v4JNZvWNc1ZdFWa90ZJ4fppQ5CJ+RonOMHalmPut3CvHCtluC+VWSSXU5Y whlJ/7x/x3J+RKZ92mv2OWeNdKgvgBEx8Z1IVPRI= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 5EEF638518AD for ; Wed, 23 Nov 2022 18:48:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5EEF638518AD Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 2ANImpiA001028 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Nov 2022 13:48:56 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2ANImpiA001028 Received: from simark.localdomain (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 457031E15D; Wed, 23 Nov 2022 13:42:07 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 14/14] gdb/testsuite/gdb.base/break.exp: split test_break Date: Wed, 23 Nov 2022 13:39:59 -0500 Message-Id: <20221123183959.2476477-15-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123183959.2476477-1-simon.marchi@polymtl.ca> References: <20221123183959.2476477-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:48:51 +0000 X-Spam-Status: No, score=-3189.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Move all the remaining tests to a single test_break proc. It's a bit big, but all of these are kind of tied together. The procs starts by setting breakpoints, checks that we can see them in "info breakpoints", and tries stopping on them. Move all the "set bp_locationX" calls together at the top. Change-Id: Id05f98957e1a3462532d2dbd577cd0a7c7263900 --- gdb/testsuite/gdb.base/break.exp | 600 +++++++++++++++---------------- 1 file changed, 293 insertions(+), 307 deletions(-) diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 1aa9476c0cf9..258c468ed001 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -15,111 +15,22 @@ # This file was written by Rob Savoye. (rob@cygnus.com) -if { [prepare_for_testing "failed to prepare" "break" {break.c break1.c} {debug nowarnings}] } { +if { [build_executable "failed to prepare" "break" {break.c break1.c} {debug nowarnings}] } { return -1 } set srcfile break.c set srcfile1 break1.c -# -# test simple breakpoint setting commands -# - -# Test deleting all breakpoints when there are none installed, -# GDB should not prompt for confirmation. -# Note that lib/gdb.exp provides a "delete_breakpoints" proc -# for general use elsewhere. - -send_gdb "delete breakpoints\n" -gdb_expect { - -re "Delete all breakpoints.*$" { - send_gdb "y\n" - gdb_expect { - -re "$gdb_prompt $" { - fail "delete all breakpoints when none (unexpected prompt)" - } - timeout { fail "delete all breakpoints when none (timeout after unexpected prompt)" } - } - } - -re ".*$gdb_prompt $" { pass "delete all breakpoints when none" } - timeout { fail "delete all breakpoints when none (timeout)" } -} - -# -# test break at function -# -gdb_test "break -q main" \ - "Breakpoint.*at.* file .*$srcfile, line.*" \ - "breakpoint function" - -# -# test break at quoted function -# -gdb_test "break \"marker2\"" \ - "Breakpoint.*at.* file .*$srcfile1, line.*" \ - "breakpoint quoted function" - -# -# test break at function in file -# -gdb_test "break $srcfile:factorial" \ - "Breakpoint.*at.* file .*$srcfile, line.*" \ - "breakpoint function in file" set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] - -# -# test break at line number -# -# Note that the default source file is the last one whose source text -# was printed. For native debugging, before we've executed the -# program, this is the file containing main, but for remote debugging, -# it's wherever the processor was stopped when we connected to the -# board. So, to be sure, we do a list command. -# -gdb_test "list -q main" \ - ".*main \\(int argc, char \\*\\*argv, char \\*\\*envp\\).*" \ - "use `list' to establish default source file" -gdb_test "break $bp_location1" \ - "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \ - "breakpoint line number" - -# -# test duplicate breakpoint -# -gdb_test "break $bp_location1" \ - "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \ - "breakpoint duplicate" - set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] - -# -# test break at line number in file -# -gdb_test "break $srcfile:$bp_location2" \ - "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \ - "breakpoint line number in file" - set bp_location3 [gdb_get_line_number "set breakpoint 3 here"] set bp_location4 [gdb_get_line_number "set breakpoint 4 here"] - -# -# Test putting a break at the start of a multi-line if conditional. -# Verify the breakpoint was put at the start of the conditional. -# -gdb_test "break multi_line_if_conditional" \ - "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \ - "breakpoint at start of multi line if conditional" - -gdb_test "break multi_line_while_conditional" \ - "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ - "breakpoint at start of multi line while conditional" - set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] - -set main_line $bp_location6 - set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] +set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] + +set main_line $bp_location6 # In C++ mode, we see a full prototype; in C mode, we only see the # function name, with no parameter info. @@ -127,120 +38,95 @@ proc func {name} { return "${name}(?:\(\[^\r\n\]*\))?" } -gdb_test "info break" \ - "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+breakpoint keep y.* in [func main] at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in [func marker2] at .*$srcfile1:$bp_location8.* -\[0-9\]+\[\t \]+breakpoint keep y.* in [func factorial] at .*$srcfile:$bp_location7.* -\[0-9\]+\[\t \]+breakpoint keep y.* in [func main] at .*$srcfile:$bp_location1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in [func main] at .*$srcfile:$bp_location1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in [func main] at .*$srcfile:$bp_location2.* -\[0-9\]+\[\t \]+breakpoint keep y.* in [func multi_line_if_conditional] at .*$srcfile:$bp_location3.* -\[0-9\]+\[\t \]+breakpoint keep y.* in [func multi_line_while_conditional] at .*$srcfile:$bp_location4" \ - "breakpoint info" +# test simple breakpoint setting commands -# -# Test info breakpoint with arguments -# +proc_with_prefix test_break {} { + clean_restart break -set see1 0 -set see2 0 -set see3 0 -set see4 0 -set see5 0 -set see6 0 - -gdb_test_multiple "info break 2 4 6" "info break 2 4 6" { - -re "1\[\t \]+breakpoint *keep y\[^\r\n\]*:$main_line\[^\r\n\]*" { - set see1 1 - exp_continue - } - -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { - set see2 1 - exp_continue - } - -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" { - set see3 1 - exp_continue - } - -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { - set see4 1 - exp_continue - } - -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { - set see5 1 - exp_continue - } - -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" { - set see6 1 - exp_continue - } - -re ".*$gdb_prompt $" { - if { !$see1 && $see2 && !$see3 && $see4 && !$see5 && $see6 } then { - pass "info break 2 4 6" - } else { - fail "info break 2 4 6" - } + # Test deleting all breakpoints when there are none installed, + # GDB should not prompt for confirmation. + # Note that lib/gdb.exp provides a "delete_breakpoints" proc + # for general use elsewhere. + send_gdb "delete breakpoints\n" + gdb_expect { + -re "Delete all breakpoints.*$" { + send_gdb "y\n" + gdb_expect { + -re "$::gdb_prompt $" { + fail "delete all breakpoints when none (unexpected prompt)" + } + timeout { fail "delete all breakpoints when none (timeout after unexpected prompt)" } + } + } + -re ".*$::gdb_prompt $" { pass "delete all breakpoints when none" } + timeout { fail "delete all breakpoints when none (timeout)" } } -} -set see1 0 -set see2 0 -set see3 0 -set see4 0 -set see5 0 -set see6 0 - -gdb_test_multiple "info break 3-5" "info break 3-5" { - -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { - set see1 1 - exp_continue - } - -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { - set see2 1 - exp_continue - } - -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" { - set see3 1 - exp_continue - } - -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { - set see4 1 - exp_continue - } - -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { - set see5 1 - exp_continue - } - -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" { - set see6 1 - exp_continue - } - -re ".*$gdb_prompt $" { - if { !$see1 && !$see2 && $see3 && $see4 && $see5 && !$see6 } then { - pass "info break 3-5" - } else { - fail "info break 3-5" - } - } -} + # test break at function + gdb_test "break -q main" \ + "Breakpoint.*at.* file .*$::srcfile, line.*" \ + "breakpoint function" -# -# Test disable/enable with arguments -# + # test break at quoted function + gdb_test "break \"marker2\"" \ + "Breakpoint.*at.* file .*$::srcfile1, line.*" \ + "breakpoint quoted function" -# Test with value history + # test break at function in file + gdb_test "break $::srcfile:factorial" \ + "Breakpoint.*at.* file .*$::srcfile, line.*" \ + "breakpoint function in file" -with_test_prefix "with value history" { - gdb_test "print 1" - gdb_test "print 2" - gdb_test "print 3" - gdb_test "print 4" - gdb_test "print 5" - gdb_test "print 6" + # test break at line number + # + # Note that the default source file is the last one whose source text + # was printed. For native debugging, before we've executed the + # program, this is the file containing main, but for remote debugging, + # it's wherever the processor was stopped when we connected to the + # board. So, to be sure, we do a list command. + gdb_test "list -q main" \ + ".*main \\(int argc, char \\*\\*argv, char \\*\\*envp\\).*" \ + "use `list' to establish default source file" + + gdb_test "break $::bp_location1" \ + "Breakpoint.*at.* file .*$::srcfile, line $::bp_location1\\." \ + "breakpoint line number" + + # test duplicate breakpoint + gdb_test "break $::bp_location1" \ + "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$::srcfile, line $::bp_location1\\." \ + "breakpoint duplicate" + + # test break at line number in file + gdb_test "break $::srcfile:$::bp_location2" \ + "Breakpoint.*at.* file .*$::srcfile, line $::bp_location2\\." \ + "breakpoint line number in file" + + # Test putting a break at the start of a multi-line if conditional. + # Verify the breakpoint was put at the start of the conditional. + gdb_test "break multi_line_if_conditional" \ + "Breakpoint.*at.* file .*$::srcfile, line $::bp_location3\\." \ + "breakpoint at start of multi line if conditional" - # $2 is 2 and $$ is 5 - gdb_test_no_output "disable \$2 \$\$" "disable using history values" + gdb_test "break multi_line_while_conditional" \ + "Breakpoint.*at.* file .*$::srcfile, line $::bp_location4\\." \ + "breakpoint at start of multi line while conditional" + + gdb_test "info break" \ + [multi_line "Num Type\[ \]+Disp Enb Address\[ \]+What.*" \ + "$::decimal\[\t \]+breakpoint keep y.* in [func main] at .*$::srcfile:$::main_line.*" \ + "$::decimal\[\t \]+breakpoint keep y.* in [func marker2] at .*$::srcfile1:$::bp_location8.*" \ + "$::decimal\[\t \]+breakpoint keep y.* in [func factorial] at .*$::srcfile:$::bp_location7.*" \ + "$::decimal\[\t \]+breakpoint keep y.* in [func main] at .*$::srcfile:$::bp_location1.*" \ + "$::decimal\[\t \]+breakpoint keep y.* in [func main] at .*$::srcfile:$::bp_location1.*" \ + "$::decimal\[\t \]+breakpoint keep y.* in [func main] at .*$::srcfile:$::bp_location2.*" \ + "$::decimal\[\t \]+breakpoint keep y.* in [func multi_line_if_conditional] at .*$::srcfile:$::bp_location3.*" \ + "$::decimal\[\t \]+breakpoint keep y.* in [func multi_line_while_conditional] at .*$::srcfile:$::bp_location4"] \ + "breakpoint info" + + # + # Test info breakpoint with arguments + # set see1 0 set see2 0 @@ -249,46 +135,39 @@ with_test_prefix "with value history" { set see5 0 set see6 0 - gdb_test_multiple "info break" "check disable with history values" { - -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { + gdb_test_multiple "info break 2 4 6" "info break 2 4 6" { + -re "1\[\t \]+breakpoint *keep y\[^\r\n\]*:$::main_line\[^\r\n\]*" { set see1 1 exp_continue } - -re "2\[\t \]+breakpoint *keep n\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { + -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { set see2 1 exp_continue } - -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location7\[^\r\n\]*" { + -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location7\[^\r\n\]*" { set see3 1 exp_continue } - -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location1\[^\r\n\]*" { set see4 1 exp_continue } - -re "5\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location1\[^\r\n\]*" { + -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location1\[^\r\n\]*" { set see5 1 exp_continue } - -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location2\[^\r\n\]*" { + -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location2\[^\r\n\]*" { set see6 1 exp_continue } - -re ".*$gdb_prompt $" { - if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then { - pass "check disable with history values" + -re ".*$::gdb_prompt $" { + if { !$see1 && $see2 && !$see3 && $see4 && !$see5 && $see6 } then { + pass "info break 2 4 6" } else { - fail "check disable with history values" + fail "info break 2 4 6" } } } -} - -with_test_prefix "with convenience vars" { - gdb_test "enable" - gdb_test "set \$foo = 3" - gdb_test "set \$bar = 6" - gdb_test_no_output "disable \$foo \$bar" "disable with convenience values" set see1 0 set see2 0 @@ -297,8 +176,8 @@ with_test_prefix "with convenience vars" { set see5 0 set see6 0 - gdb_test_multiple "info break" "check disable with convenience values" { - -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { + gdb_test_multiple "info break 3-5" "info break 3-5" { + -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$::main_line\[^\r\n\]*" { set see1 1 exp_continue } @@ -306,124 +185,231 @@ with_test_prefix "with convenience vars" { set see2 1 exp_continue } - -re "3\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location7\[^\r\n\]*" { + -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location7\[^\r\n\]*" { set see3 1 exp_continue } - -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location1\[^\r\n\]*" { set see4 1 exp_continue } - -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$bp_location1\[^\r\n\]*" { + -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location1\[^\r\n\]*" { set see5 1 exp_continue } - -re "6\[\t \]+breakpoint *keep n\[^\r\n\]*$bp_location2\[^\r\n\]*" { + -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location2\[^\r\n\]*" { set see6 1 exp_continue } - -re ".*$gdb_prompt $" { - if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then { - pass "check disable with convenience values" + -re ".*$::gdb_prompt $" { + if { !$see1 && !$see2 && $see3 && $see4 && $see5 && !$see6 } then { + pass "info break 3-5" } else { - fail "check disable with convenience values" + fail "info break 3-5" } } } -} -# test with bad values - -with_test_prefix "bad values" { - gdb_test "enable" - gdb_test "disable 10" "No breakpoint number 10." \ - "disable non-existent breakpoint 10" - - gdb_test_no_output "set \$baz = 1.234" - gdb_test "disable \$baz" \ - "Convenience variable must have integer value.*" \ - "disable with non-integer convenience var" - gdb_test "disable \$grbx" \ - "Convenience variable must have integer value.*" \ - "disable with non-existent convenience var" - gdb_test "disable \$10" \ - "History has not yet reached .10." \ - "disable with non-existent history value" - gdb_test "disable \$1foo" \ - "Convenience variable must have integer value.*" \ - "disable with badly formed history value" -} + # + # Test disable/enable with arguments + # -# FIXME: The rest of this test doesn't work with anything that can't -# handle arguments. -# Huh? There doesn't *appear* to be anything that passes arguments -# below. + # Test with value history + + with_test_prefix "with value history" { + gdb_test "print 1" + gdb_test "print 2" + gdb_test "print 3" + gdb_test "print 4" + gdb_test "print 5" + gdb_test "print 6" + + # $2 is 2 and $$ is 5 + gdb_test_no_output "disable \$2 \$\$" "disable using history values" + + set see1 0 + set see2 0 + set see3 0 + set see4 0 + set see5 0 + set see6 0 + + gdb_test_multiple "info break" "check disable with history values" { + -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$::main_line\[^\r\n\]*" { + set see1 1 + exp_continue + } + -re "2\[\t \]+breakpoint *keep n\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { + set see2 1 + exp_continue + } + -re "3\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location7\[^\r\n\]*" { + set see3 1 + exp_continue + } + -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location1\[^\r\n\]*" { + set see4 1 + exp_continue + } + -re "5\[\t \]+breakpoint *keep n\[^\r\n\]*$::bp_location1\[^\r\n\]*" { + set see5 1 + exp_continue + } + -re "6\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location2\[^\r\n\]*" { + set see6 1 + exp_continue + } + -re ".*$::gdb_prompt $" { + if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then { + pass "check disable with history values" + } else { + fail "check disable with history values" + } + } + } + } -# -# run until the breakpoint at main is hit. For non-stubs-using targets. -# -gdb_run_cmd -gdb_test "" \ - "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*" \ - "run until function breakpoint" - -# Test the 'list' commands sets current file for the 'break LINENO' command. -set bp_marker1 [gdb_get_line_number "set breakpoint 15 here" ${srcfile1}] -gdb_test "list marker1" ".*" -gdb_test "break $bp_marker1" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*${srcfile1}, line ${bp_marker1}\\." \ - "break lineno" -gdb_test_no_output {delete $bpnum} + with_test_prefix "with convenience vars" { + gdb_test "enable" + gdb_test "set \$foo = 3" + gdb_test "set \$bar = 6" + gdb_test_no_output "disable \$foo \$bar" "disable with convenience values" + + set see1 0 + set see2 0 + set see3 0 + set see4 0 + set see5 0 + set see6 0 + + gdb_test_multiple "info break" "check disable with convenience values" { + -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$::main_line\[^\r\n\]*" { + set see1 1 + exp_continue + } + -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { + set see2 1 + exp_continue + } + -re "3\[\t \]+breakpoint *keep n\[^\r\n\]*$::bp_location7\[^\r\n\]*" { + set see3 1 + exp_continue + } + -re "4\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location1\[^\r\n\]*" { + set see4 1 + exp_continue + } + -re "5\[\t \]+breakpoint *keep y\[^\r\n\]*$::bp_location1\[^\r\n\]*" { + set see5 1 + exp_continue + } + -re "6\[\t \]+breakpoint *keep n\[^\r\n\]*$::bp_location2\[^\r\n\]*" { + set see6 1 + exp_continue + } + -re ".*$::gdb_prompt $" { + if { $see1 && $see2 && $see3 && $see4 && $see5 && $see6 } then { + pass "check disable with convenience values" + } else { + fail "check disable with convenience values" + } + } + } + } -# -# run until the breakpoint at a line number -# -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \ - "run until breakpoint set at a line number" + # test with bad values + + with_test_prefix "bad values" { + gdb_test "enable" + gdb_test "disable 10" "No breakpoint number 10." \ + "disable non-existent breakpoint 10" + + gdb_test_no_output "set \$baz = 1.234" + gdb_test "disable \$baz" \ + "Convenience variable must have integer value.*" \ + "disable with non-integer convenience var" + gdb_test "disable \$grbx" \ + "Convenience variable must have integer value.*" \ + "disable with non-existent convenience var" + gdb_test "disable \$10" \ + "History has not yet reached .10." \ + "disable with non-existent history value" + gdb_test "disable \$1foo" \ + "Convenience variable must have integer value.*" \ + "disable with badly formed history value" + } -# -# Run until the breakpoint set in a function in a file -# -for {set i 6} {$i >= 1} {incr i -1} { - gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \ - "run until file:function($i) breakpoint" -} + # FIXME: The rest of this test doesn't work with anything that can't + # handle arguments. + # Huh? There doesn't *appear* to be anything that passes arguments + # below. -# -# Run until the breakpoint set at a quoted function -# -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:$bp_location8.*" \ - "run until quoted breakpoint" -# -# run until the file:function breakpoint at a line number in a file -# -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \ - "run until file:linenum breakpoint" + # + # run until the breakpoint at main is hit. For non-stubs-using targets. + # + gdb_run_cmd + gdb_test "" \ + "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$::srcfile:$::bp_location6.*$::bp_location6\[\t \]+if .argc.* \{.*" \ + "run until function breakpoint" -# Test break at offset +1 -set bp_location10 [gdb_get_line_number "set breakpoint 10 here"] + # Test the 'list' commands sets current file for the 'break LINENO' command. + set bp_marker1 [gdb_get_line_number "set breakpoint 15 here" $::srcfile1] + gdb_test "list marker1" ".*" + gdb_test "break $bp_marker1" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*$::srcfile1, line ${bp_marker1}\\." \ + "break lineno" + gdb_test_no_output {delete $bpnum} -gdb_test "break +1" \ - "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \ - "breakpoint offset +1" + # + # run until the breakpoint at a line number + # + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$::srcfile:$::bp_location1.*$::bp_location1\[\t \]+printf.*factorial.*" \ + "run until breakpoint set at a line number" -# Check to see if breakpoint is hit when stepped onto + # + # Run until the breakpoint set in a function in a file + # + for {set i 6} {$i >= 1} {incr i -1} { + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$::srcfile:$::bp_location7.*$::bp_location7\[\t \]+.*if .value > 1. \{.*" \ + "run until file:function($i) breakpoint" + } -gdb_test "step" \ - ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \ - "step onto breakpoint" + # + # Run until the breakpoint set at a quoted function + # + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$::srcfile1:$::bp_location8.*" \ + "run until quoted breakpoint" + # + # run until the file:function breakpoint at a line number in a file + # + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$::srcfile:$::bp_location2.*$::bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \ + "run until file:linenum breakpoint" -# Check to see if breakpoint can be set on ending brace of function -set bp_location10a [gdb_get_line_number "set breakpoint 10a here"] + # Test break at offset +1 + set bp_location10 [gdb_get_line_number "set breakpoint 10 here"] -gdb_test "break $bp_location10a" \ - "Breakpoint.*at.* file .*$srcfile, line $bp_location10a\\." \ - "setting breakpoint at }" + gdb_test "break +1" \ + "Breakpoint.*at.* file .*$::srcfile, line $bp_location10\\." \ + "breakpoint offset +1" -gdb_test "continue" \ - ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10a.*$bp_location10a\[\t \]+}.*breakpoint 10a here.*" \ - "continue to breakpoint at }" + # Check to see if breakpoint is hit when stepped onto -set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] + gdb_test "step" \ + ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$::srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \ + "step onto breakpoint" + + # Check to see if breakpoint can be set on ending brace of function + set bp_location10a [gdb_get_line_number "set breakpoint 10a here"] + + gdb_test "break $bp_location10a" \ + "Breakpoint.*at.* file .*$::srcfile, line $bp_location10a\\." \ + "setting breakpoint at \}" + + gdb_test "continue" \ + ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$::srcfile:$bp_location10a.*$bp_location10a\[\t \]+\}.*breakpoint 10a here.*" \ + "continue to breakpoint at \}" +} + +test_break proc_with_prefix test_tbreak {} { clean_restart break