From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id BaJNCHZO/1+LBwAAWB0awg (envelope-from ) for ; Wed, 13 Jan 2021 14:48:06 -0500 Received: by simark.ca (Postfix, from userid 112) id 133191EF80; Wed, 13 Jan 2021 14:48:06 -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.4 required=5.0 tests=DKIM_SIGNED,MAILING_LIST_MULTI, RDNS_NONE,T_DKIM_INVALID,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [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 8CE621E940 for ; Wed, 13 Jan 2021 14:48:05 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D80A63870853; Wed, 13 Jan 2021 19:48:04 +0000 (GMT) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id D1AA23861030 for ; Wed, 13 Jan 2021 19:47:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D1AA23861030 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-wm1-x335.google.com with SMTP id n16so4219091wmc.0 for ; Wed, 13 Jan 2021 11:47:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DOamllPbsKZXA9Nu8got9p84nWtQZaDHby4snbd7uiM=; b=A9cOgQWXx7Eha1eZSzPNYKvMqZM+oacRjMpxg/HkGnloLfWMM7/V2ZTiW5NWJ9ScqJ wgAAUzM/lbj0ZYknZ68fAeFw7Xn4cBBQn+l1GDzcWojf7U8uuBoqWK3zF5oN98f94oGc ifRCViZJvBMX+bYU/7Ld9HZ0wCoVTq5IrSeumBTlq20O3/pBAas/1kAa0t+Bs9cptAcC VhTlBd1QeMKzvGieTQrIVecoSILWoBef/Is9UzN3ehxc5U8GdNvpOG+vjeOICzMr7rvc ZwAlgC/qKuOPOBmpWqTexPKGGHnlbYKu9Y3STpAe5aaJ2t0wtzkbGdN9I4qln7w78Oli YMlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DOamllPbsKZXA9Nu8got9p84nWtQZaDHby4snbd7uiM=; b=cosmY6oLhebC6/z9/u479kCwkRn+HVf1fvQNyG7Xj0XItAbvO+MzrIWN7zYk0Db5re BB9wH8I4eTkUZWtE4jU26TJMcwZRkEO5ss/l9BDsYOINnDYE+5XwPGj+LVyTpe/Ggcvl lvdyhZPSBXZQ9sG37lhWBzTDW01gIIBI4rBQS9KqdRZwJC6RLqq8KrCdItRnIBktQGPL bV4//8RlZAEb29vklge8AARSSprGoehuUh7xQBrc+5kVnfYMxfqL64plg/pU+eMDc9dk MfEWL9d19M0BPoSrU+bqcpa4IIDAH44kpbXRWMCwo/Im9zcZHdclIwdPBObDP3mI3Tld 5AKg== X-Gm-Message-State: AOAM531NDwVvRWU2qF8yjomkEeyo98RSWI8OWqyHwICd1kVl4AAVITYK CBeVG+NRv3slW3Yk8QMFzAZTDw== X-Google-Smtp-Source: ABdhPJxs2uW4sNGLEDWw+1sbblwZa1NmSAM4wmR7bsfVSv/P/YSr82ozcq9SQ2TsBFJS/izEP7IvNQ== X-Received: by 2002:a05:600c:210e:: with SMTP id u14mr787798wml.48.1610567276794; Wed, 13 Jan 2021 11:47:56 -0800 (PST) Received: from localhost (host86-166-129-230.range86-166.btcentralplus.com. [86.166.129.230]) by smtp.gmail.com with ESMTPSA id w189sm4559096wmg.31.2021.01.13.11.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 11:47:56 -0800 (PST) Date: Wed, 13 Jan 2021 19:47:55 +0000 From: Andrew Burgess To: Tom de Vries Subject: Re: [PATCH][gdb/testsuite] Fix gdb.base/style.exp with -m32 Message-ID: <20210113194755.GD265215@embecosm.com> References: <20210113000929.GA14297@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210113000929.GA14297@delia> X-Operating-System: Linux/5.8.13-100.fc31.x86_64 (x86_64) X-Uptime: 19:43:11 up 36 days, 27 min, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] 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: , Cc: Tom Tromey , gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" * Tom de Vries [2021-01-13 01:09:30 +0100]: > Hi, > > When running test-case gdb.base/style.exp with target board unix/-m32, we run > into (stripped styling from output, shortened file name): > ... > (gdb) frame > argv=0xffffc714) at src/gdb/testsuite/gdb.base/style.c:45 > 45 return some_called_function (); /* break here */ > (gdb) FAIL: gdb.base/style.exp: frame when width=20 > ... > while with native we have instead: > ... > (gdb) frame > argv=0x7fffffffd478) > at src/gdb/testsuite/gdb.base/style.c:45 > 45 return some_called_function (); /* break here */ > (gdb) PASS: gdb.base/style.exp: frame when width=20 > ... > > The problem is that due to argv having a different length for -m32, we get a > different layout, and the test-case doesn't accommodate for that. > > Fix this by first printing the frame without styling and checking the layout, > and then printing the frame with styling and verifying that the layout is the > same. > > Tested on x86_64-linux. > > Any comments? > > Thanks, > - Tom > > [gdb/testsuite] Fix gdb.base/style.exp with -m32 > > gdb/testsuite/ChangeLog: > > 2021-01-13 Tom de Vries > > PR testsuite/24590 > * gdb.base/style.exp: Handle shorter argv in frame command output. > > --- > gdb/testsuite/gdb.base/style.exp | 66 ++++++++++++++++++++++++++++++++++++---- > 1 file changed, 60 insertions(+), 6 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp > index cc143b43292..848d4d337d4 100644 > --- a/gdb/testsuite/gdb.base/style.exp > +++ b/gdb/testsuite/gdb.base/style.exp > @@ -70,21 +70,75 @@ save_vars { env(TERM) } { > # Regression test for a bug where line-wrapping would occur at the > # wrong spot with styling. There were different bugs at different > # widths, so try two. > - foreach width {20 30} { > - gdb_test_no_output "set width $width" > + foreach_with_prefix width {20 30} { > + > # There was also a bug where the styling could be wrong in the > # line listing; this is why the words from the source code are > # spelled out in the final result line of the test. > - gdb_test "frame" \ > + set re1 \ > + [multi_line \ > + "#0 *main.*argc.*" \ > + ".*argv.*" \ > + ".* at .*style\\.c.*" \ > + "\[0-9\]+.*return.* break here .*"] > + set re1_styled \ > [multi_line \ > "#0 *$main_expr.*$arg_expr.*" \ > ".*$arg_expr.*" \ > ".* at .*$file_expr.*" \ > - "\[0-9\]+.*return.* break here .*" > - ] \ > - "frame when width=$width" > + "\[0-9\]+.*return.* break here .*"] > + set re2 \ > + [multi_line \ > + "#0 *main.*argc.*" \ > + ".*argv.* at .*style\\.c.*" \ > + "\[0-9\]+.*return.* break here .*"] > + set re2_styled \ > + [multi_line \ > + "#0 *$main_expr.*$arg_expr.*" \ > + ".*$arg_expr.* at .*$file_expr.*" \ > + "\[0-9\]+.*return.* break here .*"] > + > + set re_styled "" > + with_test_prefix "style=off" { > + # We temporarily set width to 0 to be able to use > + # gdb_test_no_output for "set style enabled on". > + gdb_test_no_output "set width 0" > + gdb_test_no_output "set style enabled off" > + gdb_test_no_output "set width $width" > + > + # Depending on the width and the length of argv, there may be > + # a different layout. > + gdb_test_multiple "frame" "" { > + -re -wrap $re1 { > + set re_styled $re1_styled > + pass $gdb_test_name > + } > + -re -wrap $re2 { > + set re_styled $re2_styled > + pass $gdb_test_name > + } > + } > + } > + if { $re_styled == "" } { > + continue > + } All of the above is really just a way to select between two different output patterns, the choice of which is based on the length of argv. So, could we not just skip the complexity, and instead do: set argv_value [get_hexadecimal_valueof "argv" "??"] if { [string length $argv_value] > 12 } { # Choose the first pattern... } else { # Choose the second pattern... } foreach_with_prefix width {20 30} { # Run the tests using the selected pattern... } Seems like this might be a simpler solution? Thanks, Andrew > + > + with_test_prefix "style=on" { > + # We temporarily set width to 0 to be able to use > + # gdb_test_no_output for "set style enabled on". > + gdb_test_no_output "set width 0" > + gdb_test_no_output "set style enabled on" > + gdb_test_no_output "set width $width" > + > + # Check that the frame has the same layout with "style enabled on" > + # as with "style enabled off". > + gdb_test "frame" $re_styled > + } > } > > + # Reset width back to 0. > + gdb_test_no_output "set width 0" > + > if {$test_macros} { > set macro_line [gdb_get_line_number "\#define SOME_MACRO"] > gdb_test "info macro SOME_MACRO" \