From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id g5+UHA2992dUUy4AWB0awg (envelope-from ) for ; Thu, 10 Apr 2025 08:43:57 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FFU5GK+2; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 65AC31E0C3; Thu, 10 Apr 2025 08:43:57 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 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 CE4C31E05C for ; Thu, 10 Apr 2025 08:43:56 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AD4E383905F for ; Thu, 10 Apr 2025 12:43:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AD4E383905F Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FFU5GK+2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 937D73858433 for ; Thu, 10 Apr 2025 12:43:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 937D73858433 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 937D73858433 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744289002; cv=none; b=DaKQECmQiM2n/v/MIfzt9aMLSLHCTPTC3zOaXPPcTqzRKYCFbtjpoC6moc75FBg+lSR4OEdilPqgRoKhu0/HAwZbMpPrXTVz5mquWK+2+xv/4JCnKTKmJKgxWciXPN3kxEEzTfS8+9VYxRCVIT+lORD3ky7q5Xo20KnswnkW9QY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744289002; c=relaxed/simple; bh=4FktKgbZ/nWFKW8aP3+er60FMM6HhSSJfN6sNWTnDh0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Im+JlTxZaD7EOgeyyFufGCnXfKwS9gI2X7X4fNFPRQD3oOzWToW2KQPnbPTYcnzpcF+gBhVqc6WK3Rw1NpYN+JlITckO7QV2KxXGcSLqItY9Cxn7ud0HtOq7HeByHbd2Giyu/EOE0bF6V/Iu2F3xMIqYsWqc1F1UKrhopCok5K4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 937D73858433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744289002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bt7CQkN80246FNSlqtn1ey6JIlKsh4HTouOgTwHccTw=; b=FFU5GK+2MNA35TTBIF62X23H83XrSELtvIv9lOpUFhlOb5D0L+kjqrbdYgvaHltRR8tu89 1mse7BN3GtEFc72fhhwAEbMUQdRiKxVZuYDUvZ3vNA+6HDDRG1gZIoBSUwfdgEiwJudjUO drOj13dgNLFRafqt2ZIaibhOU+GVJRs= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-bi2aq6CxO4imq5POOrJJXA-1; Thu, 10 Apr 2025 08:43:21 -0400 X-MC-Unique: bi2aq6CxO4imq5POOrJJXA-1 X-Mimecast-MFC-AGG-ID: bi2aq6CxO4imq5POOrJJXA_1744289001 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4767bab171dso7645051cf.1 for ; Thu, 10 Apr 2025 05:43:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744289000; x=1744893800; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bt7CQkN80246FNSlqtn1ey6JIlKsh4HTouOgTwHccTw=; b=Fub7Flg0hXOeBqxvWFTUetglcBeg2dqtMNiaf5enO3mia8HSpgO0AiOA+oCnVubEXW PoZj5ZeUCLMpNbAFQvUEb9QG3dmdAJ+Jb5ajSAEZBKLPtL8zH6FIVqCpw0pRg0Pfj1lS eOipN0x8M/u20ZEoL4e+wwckLvZQ+Uh574LvJj9P7MuFFqQeyYsp6jS89d1/VuDr+OBH 0CoWZ+2DyXF8V8ErT41aGDvr1Vss1Ah5Gx5yobluUhonbXYzfpIbMFslycKh9BuIXDxw Y+IRASM7x+RJK2FQmhry078rr6CCj1oUzB9pjQbb5U/xYUUXOBXnP962HBGAhUhAx3YK JjWA== X-Forwarded-Encrypted: i=1; AJvYcCVcEALI/VSZwi4+/P8zwRbviQ42GwyIc5S8LD6ghYuS64ZmT3kSSsDqXe/HR8L8j0Im9Q0iB2bw33YzWA==@sourceware.org X-Gm-Message-State: AOJu0YxpTLvNEvUt5ck3Bass5HlauCxpCVXeHm1lXpRSso+71N0AqVFa vdDNA+O1yZku8KH5N0OjjXHBHQNFQcXvQXRBXjDba+wTpY3RPNQslCgxqg0+sQ4xm4xcn3PQwG5 jBjwLHcMcm4uuH49EItFl9SOIppycHwnYdy5vGf3Ih4/taAobFs+YajUnQauS24Z5+2M= X-Gm-Gg: ASbGncu6Z4/BGVVPImDWKrQbyVkW30cjwLbBJj6JJjjRDLy7jqUKJ7xqp0DLAcldz2O eUWLEuozG8pPOwvIiCpaNmj9Mrk2gChMtpbJnI9ujOlYrWpKRbMLHtqg6IjxZyezbKGULFqSqgm wDDYCDm8DQ7CGjlM8lCgSeHk+ptLp5MoxKccgtp8j0UdwSPduBAa9JtMaZK619ffe8TfFFSdN6r My4t3p3/C1dy5oDVjkKrXY0SFcJ9fz40kA0vmQuwtXQEc8eCnaNmDdAWuKVCSEavOK1AxAQigYs Zd49N0dO0Ov187PyJDacedY= X-Received: by 2002:ac8:5a03:0:b0:476:b59a:b30 with SMTP id d75a77b69052e-4796e2f1907mr34644091cf.16.1744289000492; Thu, 10 Apr 2025 05:43:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUCnGqyw0VFtr9ernH1d8zHusWMUNSpvOSwy4SiJfvVwI6Wkxr10oDjy7qldgAtCP09bzbLw== X-Received: by 2002:ac8:5a03:0:b0:476:b59a:b30 with SMTP id d75a77b69052e-4796e2f1907mr34643761cf.16.1744289000195; Thu, 10 Apr 2025 05:43:20 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:9a69::1001? ([2804:14d:8084:9a69::1001]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4796edc54d9sm7906831cf.80.2025.04.10.05.43.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Apr 2025 05:43:19 -0700 (PDT) Message-ID: <2959e0a5-c97d-4335-92cc-2d5157d44b3c@redhat.com> Date: Thu, 10 Apr 2025 09:43:17 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb/testsuite: fix gdb.base/dlmopen-ns-ids.exp racy test To: Tom de Vries , gdb-patches@sourceware.org References: <20250409182510.1629742-1-guinevere@redhat.com> <27d87d8d-2bf9-45db-87b3-6e2d5a843eb9@suse.de> From: Guinevere Larsen In-Reply-To: <27d87d8d-2bf9-45db-87b3-6e2d5a843eb9@suse.de> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: BHe2gqeB-IQZgpeenI6e2Ec8xx8DRScmIMrlHlscvVE_1744289001 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 On 4/10/25 5:11 AM, Tom de Vries wrote: > On 4/10/25 06:40, Tom de Vries wrote: >> On 4/9/25 20:25, Guinevere Larsen wrote: >>> * using exp_continue caused the value of ns to be overwritten, >>> returning >>>    the last SO_NS, instead of the first >> >> Hi Gwen, >> >> my guess is that this is the right solution, and that you can just >> check for $ns == -1 to make sure only the first value is picked. > > I tried this out, and got it working, after fixing the following. > > There is a problem with the gdb_test_multiple. > > It uses -lbl, which is the style of processing one line at a time, > with \r\n at the start, and (?=\r\n) at the end, which matches but not > consumes it (lookahead), always leaving an \r\n at the start of the > next line. > > This matches what -wrap (which is based on gdb_test) does which > requires an \r\n before the prompt. > > I got the test-case working using: > ... > diff --git a/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp > b/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp > index 03b7a527af5..d3584a0a402 100644 > --- a/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp > +++ b/gdb/testsuite/gdb.base/dlmopen-ns-ids.exp > @@ -42,17 +42,17 @@ if { [build_executable "failed to build" $testfile > $srcfile \ >  proc get_first_so_ns {} { >      set ns -1 >      gdb_test_multiple "info sharedlibrary" "get SO namespace" -lbl { > -    -re "From\\s+To\\s+\(NS\\s+\)?Syms\\s+Read\\s+Shared Object > Library\r\n" { > +    -re "\r\nFrom\\s+To\\s+\(NS\\s+\)?Syms\\s+Read\\s+Shared Object > Library(?=\r\n)" { >          exp_continue >      } > -    -re > "^$::hex\\s+$::hex\\s+\\\[\\\[($::decimal)\\\]\\\]\\s+\[^\r\n]+$::binfile_lib.*" > { > -        set ns $expect_out(1,string) > -    } > -    -re "^$::gdb_prompt $" { > -    } > -    -re "^\[^\r\n\]+\r\n" { > +    -re > "\r\n$::hex\\s+$::hex\\s+\\\[\\\[($::decimal)\\\]\\\]\\s+\[^\r\n]+${::binfile_lib}(?=\r\n > )" { > +        if { $ns == -1 } { > +        set ns $expect_out(1,string) > +        } >          exp_continue >      } > +    -re -wrap "" { > +    } >      } >      return $ns >  } > ... > Ah, ok. I guess there's quite a bit I still need to learn about -lbl. I was thinking that this could be quite a bit slower, but I noticed that this also fixes issues with using the lib name in the "info sharedlibrary" command, so I'll add this to a v2 > I also think that binfile_lib needs to be wrapped in string_to_regexp. Will also do this for v2. -- Cheers, Guinevere Larsen She/Her/Hers > > Thanks, > - Tom >