From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id BDFD93858C2B for ; Fri, 1 Sep 2023 03:22:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDFD93858C2B 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="6.02,218,1688457600"; d="scan'208";a="15864722" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 31 Aug 2023 19:22:48 -0800 IronPort-SDR: K4d1fMbLRRaN2l88jJAYit3Gm9dZfLX+mnrQstyv6Bvso/bFp+/J0iKYFP2dmbrRgjPKxay9Mo EePIIMY2TOa2aXv5blZT7piqfsQ4MTo6L0AbUS/3DeXeLDuJqBs+lCHZRgbXLHJJ+frSf4hQ5B M+2nOQPgh6j45haCBcG3ie1dL1TrrrvAAr3pV7kGe+K0HieZ8FZqj7uvrIropLYxzUgGJxV2JQ UhR9h3WGZU0U9034o7XwiM5kjJBwMlo0MiDbFsAJ4SeY7lPwlHE/KcsjlVTeB+d72xudZf6mq+ PQY= From: Sandra Loosemore To: Subject: [PATCH V3 1/4] gdb/testsuite: Fix style.exp failures on targets without argc/argv support Date: Thu, 31 Aug 2023 21:22:27 -0600 Message-ID: <20230901032230.4193511-2-sandra@codesourcery.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901032230.4193511-1-sandra@codesourcery.com> References: <20230901032230.4193511-1-sandra@codesourcery.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: svr-orw-mbx-10.mgc.mentorg.com (147.34.90.210) To svr-orw-mbx-13.mgc.mentorg.com (147.34.90.213) X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,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 List-Id: Some embedded targets don't have full support for argc/argv. argv may print as "0x0" or as an address with a symbol name following. This causes problems for the regexps in the style.exp line-wrapping tests that assume it always prints as an ordinary address in backtrace output. This patch generalizes the regexps to handle these additional forms and reworks some of the line-wrapping tests to account for the argv address string being shorter or longer than a regular address. Reviewed-By: Tom Tromey --- gdb/testsuite/gdb.base/style.exp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 0370550d251..60f909e2402 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -92,7 +92,7 @@ proc run_style_tests { } { set argv "" gdb_test_multiple "frame" "frame without styling" { - -re -wrap "main \\(argc=.*, (argv=$hex)\\).*style\\.c:\[0-9\].*" { + -re -wrap "main \\(argc=.*, (argv=$hex.*)\\).*style\\.c:\[0-9\].*" { set argv $expect_out(1,string) pass $gdb_test_name } @@ -105,9 +105,13 @@ proc run_style_tests { } { set file_expr "$base_file_expr:\[0-9\]+" set arg_expr [limited_style "arg." variable] + # On some embedded targets that don't fully support argc/argv, + # argv may print as "0x0" or as an address with a symbol name + # following, so use a regexp general enough to match that and + # do not make assumptions about how long the address string is. gdb_test "frame" \ [multi_line \ - "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+$arg_expr=$hex\\)\\s+at\\s+$file_expr" \ + "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+$arg_expr=$hex.*\\)\\s+at\\s+$file_expr" \ "\[0-9\]+\\s+.*return.* break here .*"] gdb_test "info breakpoints" "$main_expr at $file_expr.*" @@ -134,16 +138,21 @@ proc run_style_tests { } { # the line listing; this is why the words from the source # code are spelled out in the final result line of the # test. + set re0_styled \ + [multi_line \ + "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+$arg_expr=$hex\\)" \ + "\\s+at\\s+$file_expr" \ + "\[0-9\]+\\s+.*return.* break here .*"] set re1_styled \ [multi_line \ "#0\\s+$main_expr\\s+\\($arg_expr=$decimal,\\s+" \ - "\\s+$arg_expr=$hex\\)" \ + "\\s+$arg_expr=$hex.*\\)" \ "\\s+at\\s+$file_expr" \ "\[0-9\]+\\s+.*return.* break here .*"] set re2_styled \ [multi_line \ "#0\\s+$main_expr\\s+\\($arg_expr=.*" \ - "\\s+$arg_expr=$hex\\)\\s+at\\s+$file_expr" \ + "\\s+$arg_expr=$hex.*\\)\\s+at\\s+$file_expr" \ "\[0-9\]+\\s+.*return.* break here .*"] # The length of the line containing argv containing: @@ -152,7 +161,11 @@ proc run_style_tests { } { # - closing parenthesis set line_len [expr 4 + $argv_len + 1] - if { $line_len > $width } { + if { $argv == "argv=0x0" && $width >= 27 } { + # Embedded target with no argv support. + # #0 main (argc=0, argv=0x0) + set re_styled $re0_styled + } elseif { $line_len > $width } { # At on the next line. set re_styled $re1_styled } else { -- 2.31.1