From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UNPNDrS4HWD2LAAAWB0awg (envelope-from ) for ; Fri, 05 Feb 2021 16:29:24 -0500 Received: by simark.ca (Postfix, from userid 112) id 3A9671EFCD; Fri, 5 Feb 2021 16:29:24 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 DFF2E1EF7A for ; Fri, 5 Feb 2021 16:29:21 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4F04B3860C3F; Fri, 5 Feb 2021 21:29:21 +0000 (GMT) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 2C4533857815 for ; Fri, 5 Feb 2021 21:29:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2C4533857815 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x432.google.com with SMTP id b3so9252670wrj.5 for ; Fri, 05 Feb 2021 13:29:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rs2308QRbBL/B6D89Ig3frOubPQYW53HXmBxjMm45js=; b=UPiQRHi0Iy79gVerFHHy63GTmoX21wkAC+deYNfRalhi44loNYOudSEMnGQXMzJOVl hnUU8rwrMP6towHJ7vyizPW1K27rYFs5v1JYE3+u/T/vRAEVlCqGnUpNHqkdjyBL8MEs UPkHlzs4svEtRAgHgSV2qFKZpUBUe6S5/IFyC7qU/eriDOWVSdLMZo7MLwgr2k613Xv6 P1mmKI2YqFU3oS5myZ4xXmtnaubYuuCMcnBuOPYGVhAwFvSvie6BDA+zL6D/fvMmzxkd 96xDckNZhvsy9enPG4aFcWRuw9iAUMb320gZH9izr2y6Q0IZ5IhqK9VJ7anRsnkA7THj Zf0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rs2308QRbBL/B6D89Ig3frOubPQYW53HXmBxjMm45js=; b=C3iaNm342ziWMCMPduO2bxNygp8RKwInglEQsqjeuExyeTzXAXAOOUNH1a6Ng7bY8W tOZ9urRjgU5pGZ5UZNbSrkcPUQAXNsprrUSZb6S7q2C2q9r0KzdCimbkWhRNE6wjj64U rT75vldn9bm8rx2ZsLRy/QVCBuRjdT7zLOjD/ALoiJjHy2H+ym6Dtw58IvGBAJ7JgrJq 6vFj5rqcefn4QgJfEjnzhlZPIizuQzaR3otJk2p35319n8aK6bg+loIkeKaCIznNU4ch 962r1UFZIkRW9tAcGSstMvZcXqBz8/jsDfoAYJv67aLqFELJxiQn1EKUOxJ6JxrOR/n8 LzAg== X-Gm-Message-State: AOAM533mKgflWkLXMNVEdvSAdh9WThiaS4zkicJPPGa6mv9nHzuJtu+Q eyCkXZ1EwjszhWfsfB2bLd5dEaMtZhIljA== X-Google-Smtp-Source: ABdhPJyRx5t1SlD0BIJKCLYf1ORxvXk2tioI1MCIcl9sTaA3iFOPp9eVgJ6MASP5mTIF9hk2ObXAGQ== X-Received: by 2002:adf:dd43:: with SMTP id u3mr7246756wrm.396.1612560556883; Fri, 05 Feb 2021 13:29:16 -0800 (PST) Received: from localhost (host109-151-46-64.range109-151.btcentralplus.com. [109.151.46.64]) by smtp.gmail.com with ESMTPSA id t8sm9752446wmq.36.2021.02.05.13.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 13:29:16 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCH 1/3] gdb/testsuite: split 'maint info sections' tests to a new file Date: Fri, 5 Feb 2021 21:29:09 +0000 Message-Id: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" The next couple of patches are going to add more tests for the 'maint info sections' command. Rather than try to jam these tests into the already quite long gdb.base/maint.c, this commit moves all of the tests for 'maint info sections' into a new file. I've updated the tests to make use of some newer testsuite constructs, like -wrap and $gdb_test_name for gdb_test_multiple, but otherwise the tests should not have changed with this commit. gdb/testsuite/ChangeLog: * gdb.base/maint-info-sections.exp: New file, content is moved from gdb.base/maint.exp and cleaned up to use latest testsuite techniques. * gdb.base/maint.exp: Tests moved out to gdb.base/maint-info-sections.exp. --- gdb/testsuite/ChangeLog | 8 ++ .../gdb.base/maint-info-sections.exp | 127 ++++++++++++++++++ gdb/testsuite/gdb.base/maint.exp | 87 ------------ 3 files changed, 135 insertions(+), 87 deletions(-) create mode 100644 gdb/testsuite/gdb.base/maint-info-sections.exp diff --git a/gdb/testsuite/gdb.base/maint-info-sections.exp b/gdb/testsuite/gdb.base/maint-info-sections.exp new file mode 100644 index 00000000000..6c41ff2bd90 --- /dev/null +++ b/gdb/testsuite/gdb.base/maint-info-sections.exp @@ -0,0 +1,127 @@ +# Copyright 1998-2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test just for the 'maintenance info sections' command. + +standard_testfile break.c break1.c + +if {[prepare_for_testing "failed to prepare" $testfile \ + [list $srcfile $srcfile2] {debug nowarnings}]} { + return -1 +} + +if ![runto_main] then { + untested "maint info sections" + return -1 +} + +# Check that 'maint info sections' output looks correct. When +# checking the lines for each section we reject section names starting +# with a '*' character, the internal *COM*, *UND*, *ABS*, and *IND* +# sections should not be displayed in this output. +set seen_header false +set seen_a_section false +gdb_test_multiple "maint info sections" "general output check" { + -re "Exec file:\r\n\[\t ]+`\[^'\]+', file type \[^.\]+\.\r\n" { + set seen_header true + exp_continue + } + -re "^ \\\[\[0-9\]+\\\]\[\t \]+$hex->$hex at $hex: \[^*\r\]+\r\n" { + set seen_a_section true + exp_continue + } + -re "^$gdb_prompt $" { + gdb_assert { $seen_header && $seen_a_section } + pass $gdb_test_name + } +} + +# It'd be nice to check for every possible section. However, that's +# problematic, since the relative ordering wanders from release to +# release of the compilers. Instead, we'll just check for two +# sections which appear to always come out in the same relative +# order. (If that changes, then we should just check for one +# section.) +# +# And by the way: This testpoint will break for PA64, where a.out's +# are ELF files. + +# Standard GNU names. +set text_section ".text" +set data_section ".data" + +gdb_test_multiple "maint info sections" "" { + -re -wrap "Exec file:\r\n.*${binfile}., file type.*ER_RO.*" { + # Looks like RealView which uses different section names. + set text_section ER_RO + set data_section ER_RW + pass "maint info sections" + } + -re -wrap "Exec file:\r\n.*${binfile}., file type.*neardata.*" { + # c6x doesn't have .data section. It has .neardata and .fardata section. + set data_section ".neardata" + pass "maint info sections" + } + -re -wrap "Exec file:\r\n.*${binfile}., file type.*" { + pass "maint info sections" + } +} + +# Test for new option: maint info sections
+# If you don't have a .text section, this will require tweaking. + +gdb_test_multiple "maint info sections $text_section" "" { + -re -wrap " \\.bss .*" { + fail $gdb_test_name + } + -re -wrap " $data_section .*" { + fail $gdb_test_name + } + -re -wrap " $text_section .*" { + pass $gdb_test_name + } +} + +# Test for new option: CODE section flag +# If your data section is tagged CODE, xfail this test. + +gdb_test_multiple "maint info sections CODE" "" { + -re -wrap " $data_section .*" { + fail $gdb_test_name + } + -re -wrap " $text_section .*" { + pass $gdb_test_name + } +} + +# Test for new option: DATA section flag +# If your text section is tagged DATA, xfail this test. +# +# The "maint info sections DATA" test is marked for XFAIL on Windows, +# because Windows has text sections marked DATA. +setup_xfail "*-*-*cygwin*" +setup_xfail "*-*-*mingw*" + +gdb_test_multiple "maint info sections DATA" "" { + -re -wrap " $text_section .*" { + fail $gdb_test_name + } + -re -wrap " $data_section .*" { + pass $gdb_test_name + } + -re -wrap " .rodata .*" { + pass $gdb_test_name + } +} diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 4b5b0391971..b418c023d73 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -40,7 +40,6 @@ #maintenance print unwind -- Print unwind table entry at given address # # -#maintenance info sections -- List the BFD sections of the exec and core files #maintenance info breakpoints -- Status of all breakpoints # @@ -118,23 +117,6 @@ if ![runto_main] then { perror "tests suppressed" } -# Check that 'maint info sections' output looks correct. When -# checking the lines for each section we reject section names starting -# with a '*' character, the internal *COM*, *UND*, *ABS*, and *IND* -# sections should not be displayed in this output. -set test "check maint info sections output" -gdb_test_multiple "maint info sections" $test { - -re "Exec file:\r\n\[\t ]+`\[^'\]+', file type \[^.\]+\.\r\n" { - exp_continue - } - -re "^ \\\[\[0-9\]+\\\]\[\t \]+$hex->$hex at $hex: \[^*\r\]+\r\n" { - exp_continue - } - -re "^$gdb_prompt $" { - pass $test - } -} - # If we're using .gdb_index or .debug_names there will be no psymtabs. set have_gdb_index [ exec_has_index_section ${binfile} ] @@ -417,75 +399,6 @@ if [istarget "hppa*-*-11*"] { set oldtimeout $timeout set timeout [expr $timeout + 300] -# It'd be nice to check for every possible section. However, that's -# problematic, since the relative ordering wanders from release to -# release of the compilers. Instead, we'll just check for two -# sections which appear to always come out in the same relative -# order. (If that changes, then we should just check for one -# section.) -# -# And by the way: This testpoint will break for PA64, where a.out's -# are ELF files. - -# Standard GNU names. -set text_section ".text" -set data_section ".data" - -gdb_test_multiple "maint info sections" "maint info sections" { - -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*ER_RO.*$gdb_prompt $" { - # Looks like RealView which uses different section names. - set text_section ER_RO - set data_section ER_RW - pass "maint info sections" - } - -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*neardata.*$gdb_prompt $" { - # c6x doesn't have .data section. It has .neardata and .fardata section. - set data_section ".neardata" - pass "maint info sections" - } - -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*$gdb_prompt $" { - pass "maint info sections" - } -} - -# Test for new option: maint info sections
-# If you don't have a .text section, this will require tweaking. - -gdb_test_multiple "maint info sections $text_section" \ - "maint info sections .text" { - -re ".* \\.bss .*$gdb_prompt $" { - fail "maint info sections .text" - } - -re ".* $data_section .*$gdb_prompt $" { - fail "maint info sections .text" - } - -re ".* $text_section .*$gdb_prompt $" { - pass "maint info sections .text" - } - } - -# Test for new option: CODE section flag -# If your data section is tagged CODE, xfail this test. - -gdb_test_multiple "maint info sections CODE" "maint info sections CODE" { - -re ".* $data_section .*$gdb_prompt $" { fail "maint info sections CODE" } - -re ".* $text_section .*$gdb_prompt $" { pass "maint info sections CODE" } -} - -# Test for new option: DATA section flag -# If your text section is tagged DATA, xfail this test. -# -# The "maint info sections DATA" test is marked for XFAIL on Windows, -# because Windows has text sections marked DATA. -setup_xfail "*-*-*cygwin*" -setup_xfail "*-*-*mingw*" - -gdb_test_multiple "maint info sections DATA" "maint info sections DATA" { - -re ".* $text_section .*$gdb_prompt $" { fail "maint info sections DATA" } - -re ".* $data_section .*$gdb_prompt $" { pass "maint info sections DATA" } - -re ".* .rodata .*$gdb_prompt $" { pass "maint info sections DATA" } -} - set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] gdb_test_multiple "maint info breakpoints" "maint info breakpoints" { -- 2.25.4