From patchwork Sun Apr 23 19:31:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 68193 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 1EFC43858414 for ; Sun, 23 Apr 2023 19:32:39 +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 8291D3858C50 for ; Sun, 23 Apr 2023 19:32:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8291D3858C50 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,220,1677571200"; d="scan'208";a="3666943" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 23 Apr 2023 11:32:22 -0800 IronPort-SDR: 78swdS/PFU8ofQk/UysAn0qEeXdcIJO+Jr2mtyCYrg+fpD+Isk1hSQUYBzHZgRVX4LAjtidLXW /Kp+zGwo8+J9KPnbaYkBYo62YEhJAf3MAtLQ/ic+CJiJSmhKKR8n5E7AAaVGC1p6xmBXvL0g4z IgbBQ7NVLs5b1eLnchLx7TQSIha6ewmJrZG1dVHKFW6FViUNHmiTd1I+yG++vWWATOqAl18ioo 2QV6TtrdWMmEjEQ4vZVLlMsYdu4inIboLBYmvLsLHvpxwQWfZiYFJr9du3ztPTvUEbeqCUgaAF nFk= From: Sandra Loosemore To: CC: Subject: [PATCH V2 1/5] gdb/testsuite: Fix style.exp failures on targets without argc/argv support Date: Sun, 23 Apr 2023 13:31:55 -0600 Message-ID: <20230423193159.576300-2-sandra@codesourcery.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230423193159.576300-1-sandra@codesourcery.com> References: <20230423193159.576300-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.9 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" 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. --- 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 {