From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gCWWAOnmTGFgIQAAWB0awg (envelope-from ) for ; Thu, 23 Sep 2021 16:43:21 -0400 Received: by simark.ca (Postfix, from userid 112) id F41A31EE25; Thu, 23 Sep 2021 16:43:20 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4C9761EE14 for ; Thu, 23 Sep 2021 16:43:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3C6E63857C4A for ; Thu, 23 Sep 2021 20:43:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C6E63857C4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1632429799; bh=mcP4x4Gk5wz6qIunIMJnFc/VYGu/dufVmbw/WB6snx0=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Wj8Unq8oEwtlAuLPPRpICPPN0CHNZeafMZ9GufIxsVnzqWEgY/eoLRnW5pba5ZKeP OyuLRQKIaXNcq6I6yRz1iZg1Hlj8nL8/ZMDyDeNxtoAW6BGzbriqb46aygyF2L67lr CBbuOOCSx2xQE+WVLI9ucvhGxsgB2Brv8jkq2seI= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 7BFD9385782B for ; Thu, 23 Sep 2021 20:42:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7BFD9385782B Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AEC7E223DE for ; Thu, 23 Sep 2021 20:42:45 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9D71313EAA for ; Thu, 23 Sep 2021 20:42:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RYA+JcXmTGHIGgAAMHmgww (envelope-from ) for ; Thu, 23 Sep 2021 20:42:45 +0000 Date: Thu, 23 Sep 2021 22:42:44 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Use early-out style in gdb.base/break-probes.exp Message-ID: <20210923204242.GA31859@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, Reduce indentation and improve readability in test-case gdb.base/break-probes.exp by replacing: ... if { } { } ... with: ... if { ! } { return -1 } ... Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Use early-out style in gdb.base/break-probes.exp --- gdb/testsuite/gdb.base/break-probes.exp | 52 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp index 2a590de8139..e11591798df 100644 --- a/gdb/testsuite/gdb.base/break-probes.exp +++ b/gdb/testsuite/gdb.base/break-probes.exp @@ -60,34 +60,36 @@ gdb_test_multiple "bt" $test { } } -if { $using_probes } { - set sysroot "" - set test "show sysroot" - gdb_test_multiple $test $test { - -re "The current system root is \"(.*)\"\..*${gdb_prompt} $" { - set sysroot $expect_out(1,string) - } +if { ! $using_probes } { + return -1 +} + +set sysroot "" +set test "show sysroot" +gdb_test_multiple $test $test { + -re "The current system root is \"(.*)\"\..*${gdb_prompt} $" { + set sysroot $expect_out(1,string) } +} - # GDB strips "target:" from the start of filenames - # when operating on the local filesystem - regsub "^target:" "$sysroot" "(target:)?" sysroot +# GDB strips "target:" from the start of filenames +# when operating on the local filesystem +regsub "^target:" "$sysroot" "(target:)?" sysroot - # Run til it loads our library - set test "run til our library loads" - set not_loaded_library 1 - while { $not_loaded_library } { - set not_loaded_library 0 - gdb_test_multiple "c" $test { - -re "Inferior loaded $sysroot$binfile_lib\\M.*$gdb_prompt $" { - pass $test - } - -re "Stopped due to shared library event\\M.*$gdb_prompt $" { - set not_loaded_library 1 - } +# Run til it loads our library +set test "run til our library loads" +set not_loaded_library 1 +while { $not_loaded_library } { + set not_loaded_library 0 + gdb_test_multiple "c" $test { + -re "Inferior loaded $sysroot$binfile_lib\\M.*$gdb_prompt $" { + pass $test + } + -re "Stopped due to shared library event\\M.*$gdb_prompt $" { + set not_loaded_library 1 } } - - # Call something to ensure that relocation occurred - gdb_test "call (int) foo(23)" "\\\$.* = 31.*\\\M.*" } + +# Call something to ensure that relocation occurred +gdb_test "call (int) foo(23)" "\\\$.* = 31.*\\\M.*"