From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7fttFossLGpcagMAWB0awg (envelope-from ) for ; Fri, 12 Jun 2026 11:58:03 -0400 Received: by simark.ca (Postfix, from userid 112) id 48A7D1E0A3; Fri, 12 Jun 2026 11:58:03 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 9DF511E070 for ; Fri, 12 Jun 2026 11:58:02 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D152F4B99F49 for ; Fri, 12 Jun 2026 15:58:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D152F4B99F49 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by sourceware.org (Postfix) with ESMTPS id C02CA4BA2E05 for ; Fri, 12 Jun 2026 15:57:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C02CA4BA2E05 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C02CA4BA2E05 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781279857; cv=none; b=AptEgtkIgtQyovveRqrs1eF2mVr8LgjVWrB1+XYx3JKq+vD0Je9TZTyu4VDGED+3gnVfWlTTGsgfqP5bKPreWz4OboaOLkjJJu/7jf8kQcgKWqYfQ2nYyfM2YZqEsp6YWrse5Wqube+5VMF6WRGjPIarnB8BoXNWaCyTRXltzX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781279857; c=relaxed/simple; bh=warIEzSAYLwoXGJsvOtzURVpLorMBMb0iVWqbZ+kng8=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=qySyejvcsqn5hS1x+V79QHrQtmTQFAS2lctUL1DbL+1/HoHUw38oM9svWTVZ/SXPdhy2Fk3wQueNNqPoIiS9dxNM2wJnnMJrhL6rXV80z3Ik55VPLqGV5jCIe/o39SbqaZSOIIIh0Yus3rbTOVoYbB+fulrR4oZWKOHsqFCaZxc= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C02CA4BA2E05 Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-45ef56d9b67so913707f8f.2 for ; Fri, 12 Jun 2026 08:57:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781279856; x=1781884656; h=content-transfer-encoding:in-reply-to:content-language:from :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=l+1neW5Zxqb/QNgScsY0GfTj4BvFZ2qYyRWfpHfGp5w=; b=G3QLTWNB5q4FXKfVsYcwx5Egh6xJ1D34brflVSHx2uN0zx+xnU/LvPkuWfT1OKzL3Z 9xedDTghK+cGkG9pot6hzmK8T5l8oiE2uQ8pnJ5O/0fUfXfB1HNIFxU/UVlyOX6sz3z8 wiC5cYD1hwVpXodrPLpcjLaXozFrSoUWNllfhixS2e4n4uvDjznfroFv7HgomEgA2U8y bgjpZpGIKNhGVak1fNdvvGzrnNZMnDgZx/Za+QSZSHN0hHjJKvD++zsOFP0Yb28kKz6Q hiXveNvwlBiByXaIc8LIbptPFoyR7Z9AEpa+X9bPopPjGx+EmLmgaX01bxkId3j+gh1D oOLw== X-Forwarded-Encrypted: i=1; AFNElJ+Boqz1BgGAVL229AKTa5OQBKi5MWP5HvOj/APa1fvqVswhPVX7XP9odz+BHz3ovxcKw2Z6lw7cc91sXQ==@sourceware.org X-Gm-Message-State: AOJu0YyMMxdQaGDKF96hndC/r0GaXdarSPescsGATgXxjWxALd8/9Kb8 qMa8eBfce8GcXqKLwj+zAtpo1Jr5GX8Xwy1ZhMx3HpNzSUAY+g1DH4Hsu7DF7Q== X-Gm-Gg: Acq92OHGdRSphz5qRJO7zoLdcybTM84ol5wLKSvjtRFubzdQAEf7DDJ+MlL1WnuW7Uq Q85ixCV1N6KPb/e+jEDxy2tpQkREJ2NyY4d9cQswyQl9PfwKbbOWOcKFN9xp0HT/to5CERWGOID 0QOYx3EUl2LbJ711eZQyWKF3KuLhrZW4fPkz2O2cSyoU8tqnfK/VU+MroDkcwQXZR7CnfxoFeXo n90Pbt42UYWlR0phtCMtzX5UNy9ztv7yWe0tmwfZmZ06+mG0sYE/cNFN0vxQN5lTQq6HfGVnkfw OLNtrSmX+0be0wJBhIzmc0l2JYxRoojNNm/bgeipdCv5TOe8nqrU08lesp+AmffPIDGuV/f23V/ 9mgMXp9pfhKURKgLqP9tmIf5uAk/o8a6+zKIl9Atlros5u1xuRU9ATWKT+xvGAeEAxec83ttWkN TKayync845bEDKwWP//+K3v6APJOv2CEuBSLnrlnDQ8FWivU+86peT3MXCHSAOrMIHLw== X-Received: by 2002:a05:6000:38a:b0:45e:f4f7:7cad with SMTP id ffacd0b85a97d-4606dbbf04fmr5284598f8f.39.1781279855649; Fri, 12 Jun 2026 08:57:35 -0700 (PDT) Received: from ?IPV6:2001:8a0:fae3:2600:bf49:e032:9c8d:efc8? ([2001:8a0:fae3:2600:bf49:e032:9c8d:efc8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4606f2b0d28sm7094885f8f.20.2026.06.12.08.57.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jun 2026 08:57:35 -0700 (PDT) Message-ID: <8430a5e6-5452-464a-8793-172a1b679c69@palves.net> Date: Fri, 12 Jun 2026 16:57:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv2 3/3] gdb: allow 'until' to work in outermost frame To: Andrew Burgess , gdb-patches@sourceware.org References: <41fe591d58ba010fa771e80ca674b61e30feef2f.1780942441.git.aburgess@redhat.com> From: Pedro Alves Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 2026-06-11 22:59, Andrew Burgess wrote: > +# Use 'bt 1' to get the name of the current function. Returns the > +# name of the current function, or the empty string if the current > +# function name cannot be established. Nit: I'd think "frame" would be more natural than "bt 1". > +proc current_function_name { testname } { > + set func_name "" > + gdb_test_multiple "bt 1" $testname { > + -re -wrap "#0\\s+\[^\r\n\]*\\s+in (\[^( \]+) \\(.*" { > + set func_name $expect_out(1,string) > + } > + } > + > + return $func_name > +} > + > +# Start the inferior with 'starti', then use 'until' within the > +# outermost frame. This is the real outermost frame, not 'main'. > +# > +# PAST_ENTRY should be 'on' or 'off' and is used in a 'set backtrace > +# past-entry ...' command. > +proc run_test { use_stepi past_entry testfile } { > + clean_restart $testfile > + > + if { [gdb_starti_cmd] < 0 } { > + untested starti > + return > + } > + > + gdb_test "" "Program stopped\\..*" "starti" On Windows when you get to the entry address there's already more than one thread, so the above will fail. E.g.: (gdb) starti Starting program: C:/msys2/home/alves/gdb/build-testsuite/outputs/gdb.base/patch/patch.exe [New Thread 12888.0x3260] Thread 1 stopped. 0x00007ff9abd3d78e in ntdll!RtlGetReturnAddressHijackTarget () from C:/WINDOWS/SYSTEM32/ntdll.dll (gdb) info thr Id Target Id Frame * 1 Thread 12888.0x404c 0x00007ff9abd3d78e in ntdll!RtlGetReturnAddressHijackTarget () from C:/WINDOWS/SYSTEM32/ntdll.dll 2 Thread 12888.0x3260 0x00007ff9abd83d24 in ntdll!ZwWaitForWorkViaWorkerFactory () from C:/WINDOWS/SYSTEM32/ntdll.dll (gdb) > + # Find an address to use in the 'until' command. > + set until_address "" > + set capture_address false > + gdb_test_multiple "disassemble" "find address for until" { > + -re "^=> $::hex \[^\r\n\]+\r\n" { > + set capture_address true > + exp_continue > + } > + > + -re "^\\s+($::hex) \[^\r\n\]+\r\n" { > + if { $capture_address } { > + set until_address $expect_out(1,string) > + set capture_address false > + } > + > + exp_continue > + } > + > + -re "^$::gdb_prompt $" { > + set found_address [expr { $until_address ne "" }] > + if { !$found_address } { > + unsupported "$gdb_test_name (no instruction found)" > + return > + } > + pass $gdb_test_name > + } > + > + -re "^\[^\r\n\]*\r\n" { > + exp_continue > + } Could use -lbl ?