From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id mWrgG3cF/maiXD8AWB0awg (envelope-from ) for ; Wed, 02 Oct 2024 22:46:15 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=vWVzFWPr; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5FED91E353; Wed, 2 Oct 2024 22:46:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,URIBL_BLOCKED,URIBL_DBL_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.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 ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7362F1E08F for ; Wed, 2 Oct 2024 22:46:14 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F0D76385DDE6 for ; Thu, 3 Oct 2024 02:46:13 +0000 (GMT) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 6B2DE385840A for ; Thu, 3 Oct 2024 02:45:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B2DE385840A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6B2DE385840A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727923525; cv=none; b=kn3ck4P6/sQeVIv0OyX7ULTLP+WNzrJQm35I5AilfBLTNbxzQ7A4WqWlhr2ClSXp3H2OkmixZgNYBKm81dWPkeO6KWlXkFLWnZ37dY/Ei7eMgvpAeRDjfCs8qZ5QoFmUw3iNNv0oGnbM1FWLfgyG/PTzbxxGkMAsjFhvTvQU2xU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727923525; c=relaxed/simple; bh=WWlra5RnQRa5x6DjV2K+dyCf0tL6kV/ht7C/ajdSIvA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=hPZOkJ0fjV4X5FpHHTrCQsDeOcam5j0UTnueXjL9RKiGPWgLn7N2f4zW95h5naMZ9K/L8wtlrDPKigFvSeiV0petWxNgs1IY4S9pZ7K80o+vaJUyl0N2db8KYdPBSbYXD0J541zSI60WFhe+851iUvaRXrVr6KA5R8IOkftARhY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-20bc2970df5so2925275ad.3 for ; Wed, 02 Oct 2024 19:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727923520; x=1728528320; darn=sourceware.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=kP7J2ltdHU/EGHghPFzrSdUuxgPeask/CIZpSigl3e4=; b=vWVzFWPrdp4+A6W3TZRRG51NRxzCtt8psW4u+jDu5DO9BxfBq7Rrt+w80RB7P5MaWb Axytmr0VhMY8vxRrmh1TRz2l9eUfbL/F+f+UY8wgWVN+O1J10+X4dVVVHjD0+Om2vxuj 6WHY2ANPQgW6PC+pv1winqK8skAL3AjCZPfKXkPT2rjNlLldVDYYKx0dZDa78cjzPb7t INGkVNxUXtKNE6Ih6JU+o6aPp3Y3yg08Z6cJZPHtapkMTm/WVmtsTh0IBMwrbpiD9Wru Rqt7FximG49hl9l/0+da54jiIAUElQfN1gPsvEdp1w4FPv8/8Bmo/wVAozEoLfaJhYQK hl6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727923520; x=1728528320; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kP7J2ltdHU/EGHghPFzrSdUuxgPeask/CIZpSigl3e4=; b=d7hALHqO6MFN3Q+FXGdGlvdAQUNgN2sB5hiGgrL/J5Mt8n56T+y0BUzfQPflnSdIQp N0InsPGWn0e+fZdWy/ChoBzds1XB0u7YRgYMp0OWa51izf0jt/tXQKFpnt2+Q6BR2X6M JX2QtKGQAwK9EPvb4WHtGoUeNa8HbiB2f4WU+KDnazUwyhUrBv+5gaWDaoNatY4dFS8I TJgxwoEw1X6M7CFV12/OHtdAbd23tmbI8wgRVS1UpG6CFcKHUlnK8QKhXD4bu3/XabLR ogSnyyQ+9+upsK1yzeDeJKmtZzlYVx7CifkiaLpZPaXd+tDr/LVVeb2WXh3FW3GnpRZk u3BQ== X-Gm-Message-State: AOJu0YyYSbUdnkVFygeZMIdcLwU2n4+83pFLo9AHGK+Mq5cYj08M//kK sPGOiJHVISzrrVWRQqCOmrCA8hHmH+dqWr/YUiA75qOwQabEWroA2KApumkO3h0= X-Google-Smtp-Source: AGHT+IGjgKWAqdJ8lwRW9ZZ02NJ4m249v43RtTqOluJz8bWY7MOHN3+kQUXa4PzLHQenwFR8Z2BipQ== X-Received: by 2002:a17:903:2446:b0:207:894:6e58 with SMTP id d9443c01a7336-20bc5a7926bmr68349195ad.56.1727923520319; Wed, 02 Oct 2024 19:45:20 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:c692:4473:f1b3:494c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20beead24d1sm284085ad.41.2024.10.02.19.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 19:45:19 -0700 (PDT) From: Thiago Jung Bauermann To: Guinevere Larsen Cc: gdb-patches@sourceware.org, Guinevere Larsen Subject: Re: [PATCH v5 4/5] gdb: introduce ability to disable frame unwinders In-Reply-To: <20241001184235.3710608-5-guinevere@redhat.com> (Guinevere Larsen's message of "Tue, 1 Oct 2024 15:42:34 -0300") References: <20241001184235.3710608-1-guinevere@redhat.com> <20241001184235.3710608-5-guinevere@redhat.com> Date: Wed, 02 Oct 2024 23:45:16 -0300 Message-ID: <87frpdaoqr.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Guinevere Larsen writes: > +/* Helper function to both enable and disable frame unwinders. > + if ENABLE is true, this call will be enabling unwinders, > + otherwise the unwinders will be disabled. */ > +static void > +enable_disable_frame_unwinders (const char *args, int from_tty, bool enable) > +{ > + reinit_frame_cache (); > + if (args == nullptr) > + { > + if (enable) > + error (_("specify which frame unwinder(s) should be enabled")); > + else git complains about this line: /home/bauermann/src/binutils-gdb/.git/worktrees/binutils-gdb-wt-2/rebase-apply/patch:327: trailing whitespace. else warning: 1 line adds whitespace errors. > + error (_("specify which frame unwinder(s) should be disabled")); > + } > diff --git a/gdb/testsuite/gdb.base/frame-unwind-disable.exp b/gdb/testsuite/gdb.base/frame-unwind-disable.exp > new file mode 100644 > index 00000000000..972d6b70351 > --- /dev/null > +++ b/gdb/testsuite/gdb.base/frame-unwind-disable.exp > @@ -0,0 +1,140 @@ > +# Copyright 2024 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 multiple situations in which we may use the maintenance command to > +# disable and enable frame unwinders, and check that they really are > +# disabled when they say the are. > + > +standard_testfile .c > + > +# Proc to check if the unwinder of the given name is in the desired state. > +# STATE can be either Y or N. > +proc check_unwinder_state { unwinder_name state {testname ""} } { > + set should_pass false > + set command "maint info frame-unwinders" > + if {${testname} == ""} { > + set testname "checking state ${state} for ${unwinder_name}" > + } > + gdb_test_multiple "${command}" "${testname}" -lbl { > + -re "^${unwinder_name}\\s+\\w+\\s+\\w+\\s+${state}\\s+" { With 'make check-read1', this test only passes if I remove the '^' from the beginning of the pattern. > + set should_pass true > + exp_continue > + } > + -re "${command}" { > + exp_continue > + } > + -re "\\w+\\s+\\w+\\s+\\w+\\s+\\w+\\s+" { > + exp_continue > + } > + -re "${::gdb_prompt} $" { > + # We can't use -wrap here because it expects the line with start > + # with \r\n, but the previous commands eat that If I use -re -wrap "" here things still work (with or without read1), so this comment probably applied only to a previous version of this test. It does apply to the prompt pattern in check_unwinder_class, but there's a way around that. See below. > + gdb_assert {${should_pass} == true} "${gdb_test_name}" > + } > + } > +} > + > +proc check_unwinder_class { unwinder_class state {testname ""} } { > + set command "maint info frame-unwinders" > + set seen_arches 0 > + set correct_state 0 > + if {$testname == ""} { > + set testname "checking if ${unwinder_class} state is ${state}" > + } > + gdb_test_multiple "${command}" "${testname}" -lbl { > + -re "^\[^\r\n\]+\\s+\\w+\\s+${unwinder_class}\\s+\(\[YN\]\)\\s+\r\n" { You can change the last "\r\n" in the pattern to "(?=\r\n)", which tests for the presence of the characters without taking them out of the buffer. > + # The unwinder name may have multiple words, so we need to use the > + # more generic [^\r\n] pattern to match the unwinders. > + set should_pass true > + incr seen_arches > + set cur_state $expect_out(1,string) > + if {$cur_state == $state} { > + incr correct_state > + } > + exp_continue > + } > + -re "${command}" { > + exp_continue > + } > + -re "\[^\r\n\]+\r\n" { Same here, though this pattern is very similar to what the -lbl option adds: if {$line_by_line} { append code { -re "\r\n\[^\r\n\]*(?=\r\n)" { exp_continue } } } So is it necessary? > + exp_continue > + } > + -re "${::gdb_prompt} $" { With the changes above I can use -re -wrap "" here. > + gdb_assert {${correct_state} == ${seen_arches}} "${gdb_test_name}" > + } > + } > +} -- Thiago