From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Ki0DAr5tfmOm0BsAWB0awg (envelope-from ) for ; Wed, 23 Nov 2022 14:00:14 -0500 Received: by simark.ca (Postfix, from userid 112) id E5AB81E124; Wed, 23 Nov 2022 14:00:13 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=tM2PW4Eb; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (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 ESMTPS id B05B31E0D3 for ; Wed, 23 Nov 2022 14:00:12 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 54281384F6DB for ; Wed, 23 Nov 2022 19:00:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 54281384F6DB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669230011; 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=tM2PW4EbUZ4gZ/1enuof8a0JCLLDWQT3Q1skfreSYBKy4/12Nrr4UG186TJz8pJ8E 6tapttPQxqF2N5e2vYAyLbA2zjF9MoUPcbAmzTv47E5dLdfGs7GV9uaj9W2DXtGwGV 9lS4AgqV0wsODvQqKoXzTaJgG8u8hvyjbbVTbyfc= 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 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 23 Nov 2022 18:58:51 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+public-inbox=simark.ca@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. # -- 2.38.1