From patchwork Wed Apr 19 19:30:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 68043 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 655713854176 for ; Wed, 19 Apr 2023 19:31:38 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 984F03858C83 for ; Wed, 19 Apr 2023 19:31:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 984F03858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.99,210,1677571200"; d="scan'208";a="3288412" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 19 Apr 2023 11:31:08 -0800 IronPort-SDR: 2qkfOd96l1Id4fps1VWPPZw9tEeF2bmCQSNJ51Y3iSXp+tzXHWgHDFfgotd5B+Tw+p9IznBX8H 5Xe80SvUe1lKJQFziBtaIe0z1Ga9ftJOrKT1f3gZjwkOQrW/z3Lpn6rRIAmgfQfWxFxv6mcrL7 CfsnpT51FxcQYNbWuclhQsSxyHffVfAIL/+SgMuYn3Tdm2VVrWkTMlnwAptXTEE6XDECg+iEZz L+VnswJ1U2w4ARe/hXajDHM2rmFvOHFRiJcWSNJqASH46Ui2Rte1tGRMcv49GLg0JxVXQo9Oah zRs= From: Sandra Loosemore To: Subject: [PATCH 2/5] gdb/testsuite: Fix style.exp failures on targets without libopcodes styling Date: Wed, 19 Apr 2023 13:30:43 -0600 Message-ID: <20230419193046.548783-3-sandra@codesourcery.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419193046.548783-1-sandra@codesourcery.com> References: <20230419193046.548783-1-sandra@codesourcery.com> MIME-Version: 1.0 X-ClientProxiedBy: svr-orw-mbx-14.mgc.mentorg.com (147.34.90.214) To svr-orw-mbx-13.mgc.mentorg.com (147.34.90.213) X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Do not expect disassembler output to be styled by libopcodes if GDB reports the target does not support that. --- gdb/testsuite/gdb.base/style.exp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 60f909e2402..d6ce48237e4 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -24,6 +24,29 @@ if {[build_executable "failed to build" $testfile $srcfile {debug macros}]} { return -1 } +# Check whether libopcodes styling is supported for this target. +set have_libopcodes_styling 1 +proc test_for_libopcodes_styling {} { + global binfile + global have_libopcodes_styling + clean_restart ${binfile} + + gdb_test_multiple "maint set libopcodes-styling enabled on" "" { + -re "^maint set libopcodes-styling enabled on\r\n" + { + exp_continue + } + -re "Use of libopcodes styling not supported on architecture \[^\r\n\]+\r\n" + { + set have_libopcodes_styling 0 + exp_continue + } + -re "^$::gdb_prompt $" + { + } + } +} + # The tests in this file are run multiple times with GDB's styles # disabled one at a time. This variable is the style that is # currently disabled. @@ -68,6 +91,7 @@ proc clean_restart_and_disable { prefix args } { proc run_style_tests { } { global testfile srcfile hex binfile global currently_disabled_style decimal hex + global have_libopcodes_styling save_vars { env(TERM) } { # We need an ANSI-capable terminal to get the output. @@ -195,7 +219,7 @@ proc run_style_tests { } { # symbol will be styled. However, if pygments is not being # used then we can know how the symbol name will be styled. set main [limited_style main function] - if { $::python_disassembly_styling } { + if { $::python_disassembly_styling || !$have_libopcodes_styling } { set func "some_called_function" } else { set func [limited_style some_called_function function] @@ -495,6 +519,9 @@ if {[allow_python_tests] && [gdb_py_module_available "pygments"]} { set python_disassembly_styling false } +# Check to see if libopcodes styling is available for this target +test_for_libopcodes_styling + # Run tests with all styles in their default state. with_test_prefix "all styles enabled" { run_style_tests