From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id RykbDw+UsWo7oS4AWB0awg (envelope-from ) for ; Mon, 21 Sep 2026 16:31:11 -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=WqTLaL1h; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 251581E01F; Mon, 21 Sep 2026 16:31:11 -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 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 1FC221E01F for ; Mon, 21 Sep 2026 16:31:09 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CECB14BA79B5 for ; Mon, 21 Sep 2026 20:31:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CECB14BA79B5 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=WqTLaL1h 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 C993C4BA79B5 for ; Mon, 21 Sep 2026 20:30:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C993C4BA79B5 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 C993C4BA79B5 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790022639; cv=none; b=anFlWdmFkQw3mo6kwtopp+xqPksLMerXo+q2GT1zLkDkDUWrgLhqPIhZJwsNcMxhJ88BM9fk+TJEnqzz72LzXQG4DDFO9BXGoobwEOpKR66K2fRIovVqz97N4G4hIN5XkOKwU0EPbEMWdUp8Unuu8GcRIiJpNXItTAPUz7KOR+c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1790022639; c=relaxed/simple; bh=MI5wbXfV3iiOUT4vHXvuH4gU+OzBaKSoyUnrCUVQKKc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=nuPfk0QuonD5xuTroLflxkCis7jfHi6IgLKMy1VQ9V7VxYLMCOG4qxgQATPgjSrx7iAvydscfH1X4+MMzpvt8ODsyjYtxQKcaBtsDPDr4F8tPY/OhHB5uG42kgeilcDjX6wkWzluo4Q9q4k1VrHlC5JzsmYU738XHJXbABCI5CA= ARC-Authentication-Results: i=1; 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=WqTLaL1h DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C993C4BA79B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1790022639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L8F6RM7Pm+xpo5oMYAWvL0E7FuX/GBvC+sRIvGJiIfI=; b=WqTLaL1hJUANvvWJG9SkK651DY8pUykoQO+TYB02JAs1SgkyEE+4pAQcZ8R2dMamcTvPDw WMBvQ91YPs3LY9RemN40E5GM7jYUlkRoOwWIcYijNaJc2bIz0sVnKdWcNDjNVNWAUDCTW8 g3ibtEhXTHY9vWu0e/Ug7NAM+NQ83Ec= Received: from mail-vk1-f199.google.com (mail-vk1-f199.google.com [209.85.221.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-368-049CSRsMPBmvqKXeqm-Tiw-1; Mon, 21 Sep 2026 16:30:37 -0400 X-MC-Unique: 049CSRsMPBmvqKXeqm-Tiw-1 X-Mimecast-MFC-AGG-ID: 049CSRsMPBmvqKXeqm-Tiw_1790022637 Received: by mail-vk1-f199.google.com with SMTP id 71dfb90a1353d-5c830ea02d3so2926361e0c.3 for ; Mon, 21 Sep 2026 13:30:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790022637; x=1790627437; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc: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:content-type; bh=L8F6RM7Pm+xpo5oMYAWvL0E7FuX/GBvC+sRIvGJiIfI=; b=2s6fqzAUJnmh/dGik3bMp/y49V+ZeDMnp3R9PJHWciIvL+UEHX4vykqqaoLXz2sbU5 658Nx4I6QLeL6bwnJtIHq998+/ApUPwoFzqrRXro6ZkbveIzSZwBrRUeGzyUGWjGw29D LHwKPRuQayZo+QS8mNqYzY6EWzjQSN/64/Fgef+2hJEa6AeLikrfSKvanxBNSSmSP6i+ 9SRYlxQz19fEsoisxD9NTmqhhOYKfd5KeJj2/QQ3RQYx6MSSLpPMr+RF9/k72UDJ/45S XBxiOoCIIX622RWqs7L2jJXFJhHU1XeeSN5dQyTkXsbkr0oNi8/EamsDOiM1aD8gv2CW 02vg== X-Gm-Message-State: AFuF++kujMXdCkgw2rPASI1oiNhUyeIz8sna/TbMT8UGATbY/t0I+9FN StfAby1mlYXKuPeERErORWWH6VywbR+a9UEHLng2duglYwhd3C0jK23Nj6B7w9nxxEUMro0KSSE wqNKPDF662PNxUbU3k3oGTtOI5kVfHULKOgJ18dgVM35JHkEx/EGd05Wv2hp2Em0= X-Gm-Gg: AYBFou3utvq78izXRyAqnzdWOd896uJDogITeDItPi403JkD+opccm90giIpv+pHmWt LBGlo+1JaMybzDI0KznyMWCMH4sibiIfCziIOUngsmf1M9iT4CuzdqV/MU+rO4HQ0eien3zxWp+ Q5tAX1C6PGw8c4REaEYHA1pnyc+RSfZgY/UIRZl9yth7WE6xX/SsNrIsBJb8qLQv867attPcQiI bcYQBYcQpQG3DLfzq9MhfbY6L1Kv71QkV5MuR5RLLKpECQV6MhSNEBIR4oMre0ntX/5rschNG9L jKrrXsMvlA9DLmK5lB82ovvk9/6GLXAFskrPhT333RO7TQQNN0Xb0cwq69T+MZLSc8jmNYDddoD IX8e09rtgnYw5ZAF0Vu+jvEk+dcONrOLbBEMChymWVradkp+K X-Received: by 2002:a05:6122:54d:b0:5c9:c60e:5cf6 with SMTP id 71dfb90a1353d-5c9c60e60e2mr5208544e0c.20.1790022636858; Mon, 21 Sep 2026 13:30:36 -0700 (PDT) X-Received: by 2002:a05:6122:54d:b0:5c9:c60e:5cf6 with SMTP id 71dfb90a1353d-5c9c60e60e2mr5208534e0c.20.1790022636331; Mon, 21 Sep 2026 13:30:36 -0700 (PDT) Received: from ?IPV6:2804:14d:8084:993e:22e8:4ed1:527a:55c0? ([2804:14d:8084:993e:22e8:4ed1:527a:55c0]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-5c9e5a37944sm193838e0c.3.2026.09.21.13.30.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Sep 2026 13:30:35 -0700 (PDT) Message-ID: <14f94898-db17-421d-8032-9017d50e728d@redhat.com> Date: Mon, 21 Sep 2026 17:30:32 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb, infrun: do not discard a step-completed pending waitstatus To: "Metzger, Markus T" Cc: "gdb-patches@sourceware.org" References: <20260915141441.2274270-1-markus.t.metzger@intel.com> From: Guinevere Larsen In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: rx1sTJ5fbacsAvd9Nm4tDk9JzXEyWNiSZkKmLNPA0ik_1790022637 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed 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 9/21/26 8:42 AM, Metzger, Markus T wrote: >> On 9/15/26 11:14 AM, Markus Metzger wrote: >>> Consider a scenario with two breakpoints on adjacent instructions: >>> >>> bp1 at 0xf00 >>> bp2 at 0xf01 >>> >>> as well as two threads in all-stop-on-top-of-non-stop mode. >>> >>> Assume that threads A hits bp1 and we report the breakpoint hit to the >>> user. When the user continues, we start a step-over for thread A at 0xf00. >>> >>> Assume that thread B now hits bp1 and we report the breakpoint hit to the >>> user. We stop all threads to report the event. Meanwhile, the step-over >>> of thread A completes, so we save the pending waitstatus (stop_pc=0xf01, >>> currently_stepping=1) of thread A. >>> >>> When the user continues, clear_proceed_status_thread() discards the >>> pending step completed waitstatus of thread A, and proceed() starts >>> another step-over for thread A at 0xf01. >>> >>> We skip bp2 for thread A. >>> >>> Remove the code in clear_proceed_status_thread() that discards a step >>> completed waitstatus and let it get handled normally. >> Hi! Thanks for working on this. >> >> I have a question about the situation in general. From what I >> understand, the original intent of the code is that, if a user has asked >> for a step, but we hit something more important (like watchpoint or >> breakpoint), then we shouldn't mention the step. With this change, a >> user will now see the step once they resume from the breakpoint, if I >> understand the code correctly. > If I understand correctly, the scenario is that the user steps thread A, > the step completes, but GDB picks another event from thread B, say, > a breakpoint hit. The user then continues, and GDB processes the saved > step completed event from thread A. > > In clear_proceed_status_thread(), we set control.step_range_end = 0 > for thread A when we continue thread B from the breakpoint. > When processing the saved step completed event, process_event_stop_test() > continues the thread: > > if (ecs->event_thread->control.step_range_end == 0) > { > infrun_debug_printf ("no stepping, continue"); > /* Likewise if we aren't even stepping. */ > keep_going (ecs); > return; > } > > > If we instead switch to thread A and then step thread A, we get an extra > stop event. When source stepping, we'd simply keep stepping and the > user wouldn't notice the difference. When stepping a single instruction, > however, we'd stop without making progress. > > And if we switch to thread A, insert a breakpoint at the current location, > and continue, we start a step-over for that breakpoint, but then interpret > the pending event as result of this step-over and report the breakpoint. > > This is different from current GDB behavior. > > If that breakpoint had already been there and thread A hit it, but GDB picked > the event of thread B, we'd not discard the pending event of thread A, so > when we switch to thread A and continue, we report the breakpoint. > > The behavior differs whether we stopped at a breakpoint or stepped onto it. > In the latter case, we might skip the breakpoint. We also wouldn't call > finish_step_over() and we wouldn't clean up displaced stepping state. > Breakpoint actions wouldn't trigger, either. > > I'm not sure what would happen if a thread was interrupted and stopped > right at a breakpoint location. I'd expect the breakpoint to fire when that > thread is resumed, or, for the current thread, the interrupt being re-interpreted > as a breakpoint hit. Just like a step-completed onto a breakpoint location > is reported as breakpoint hit when done by the current thread. > > We need to handle the step completed event and finish the step-over. > It is also good that we now report a breakpoint we stepped onto reliably, > whether this is done by the current thread or some other thread. > > We may need some special case to not report a newly inserted breakpoint > at the current location after switching to a thread that completed a step > in the background when resuming that thread. And for the stepi case. > > Both are more niche than the bug this patch is fixing. Right, this makes sense. Yeah, I agree that this is more niche than the bug you're dealing with, but I think it would be nice to document that this behavior change is known so that if we get a bug about this in the future, we know what's going on. I don't know enough to review the code but I ran the test and I see it fixes the issue, so feel free to add my test tag Tested-By: Guinevere Larsen -- Cheers, Guinevere Larsen it/its she/her (deprecated) > > Markus. > ________________________________________ > Intel Deutschland GmbH > > Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany > > Tel: +49 (89) 99143-0 > > www.intel.de > > Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman > > Chairperson of the Supervisory Board: Sonja Pierer > > Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 > > This e-mail and any attachments may contain confidential material for > the sole use of the intended recipient(s). Any review or distribution > by others is strictly prohibited. If you are not the intended > recipient, please contact the sender and delete all copies. >