From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 6D39D3858D39 for ; Thu, 29 Jun 2023 08:37:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6D39D3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=undo.io Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=undo.io Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4fb73ba3b5dso648541e87.1 for ; Thu, 29 Jun 2023 01:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=undo.io; s=google2; t=1688027819; x=1690619819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hY8C90TsCS0FYlYcdTiyl3kuVhNR8CWhhWiYT0MxoFY=; b=TGHHOpTclJvdwsrPTQGIxrFt+F4NSehxyhZFPOuwKC7F24aHF4LBh5KCTeOuTBnxCJ 3n2qJEv1shWvfRplLfsBHE4glDZeTW+8NAUWCqWZIVw1Xh9r1Z5O8xLYM4fhj4ezfZ5x FDTsGes3dcOJ97U8pGBe/BJ+YDZYkml1cwCbJPlZZJ7Z47ot0dQkzPKefXthrAzkon67 B/H57XRWqFRYU/gVpQtbIyrlVcN5/akurCrI4Z2kV3iHNmLlnnF37JsrIsxkvwzGaseo 44quyJBdIrSI4hJnO0QmNbA/tu79ecJXfkHYTlz/n8rqO4mFjYXLmzxfxTf1SPTwRthy gw4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688027819; x=1690619819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hY8C90TsCS0FYlYcdTiyl3kuVhNR8CWhhWiYT0MxoFY=; b=InHFlq26iec2C1cfSTv2QIK/eMHKum8KTFBawkfDAMPZ5dLw8xA5mHqzhEvoR/yss0 dIDA5uM4ghHfuwc4EL2epx0XdhLJMOerXuXjBsM/AdULSbeAIpqXoTBvVwbYmT6fZp8w kQ197z44A0MrEGArISXnmnnQ/lMYCdOJ/vGL3MvoSLBkMB5trnsrnv9xTAWlgpkaQ4qO PYNZdWda3BxvoXbrZcydcADxsKARFWRak142YNZsnz8k+T2G8znyg9j43uwMiocowpGw VcDNBl6CUOyWU9tFBXJtspBEQdzvIlFRbSzXhjD4de0XJDSC3OMBl9PnJHpN6Iw93J6d AwBQ== X-Gm-Message-State: AC+VfDz3rXnP4M70lIVAOgK5p89dY7y3ww5bn+2EbCZ4w1J2hxa7Xr+j JhtuqslSCBwcHeHTQL9BQb25sf/iMAZfmucnt0Mt6mqyxfIAz39Eub789pV8kTAX19emACWnyZ0 RkFNMPBJEVnabZoD0dLX9vlaxSbKEtZDluUvztoSdVAH6dkjhX/P9vyUw4QDKACpCIDZmDw8= X-Google-Smtp-Source: ACHHUZ7KVnBIoBIZNJR6f1/3zibZIOt7p5C18oy81gLghfwWci1G8LLMSv+jZvTWJ9Avb9bVgVO6Uw== X-Received: by 2002:a05:6512:b94:b0:4f9:72a5:2b76 with SMTP id b20-20020a0565120b9400b004f972a52b76mr12884080lfv.65.1688027818879; Thu, 29 Jun 2023 01:36:58 -0700 (PDT) Received: from sbrinz-thinkpad.undoers.io (ip-185-104-136-31.ptr.icomera.net. [185.104.136.31]) by smtp.gmail.com with ESMTPSA id g11-20020a7bc4cb000000b003fbab76165asm5195747wmk.48.2023.06.29.01.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 01:36:58 -0700 (PDT) From: Magne Hov To: gdb-patches@sourceware.org Cc: Magne Hov Subject: [PATCH 2/2] gdb: retain thread-specific breakpoints in reverse execution targets Date: Thu, 29 Jun 2023 09:36:51 +0100 Message-Id: <20230629083651.3145268-3-mhov@undo.io> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230629083651.3145268-1-mhov@undo.io> References: <20230629083651.3145268-1-mhov@undo.io> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Thread-specific breakpoints are currently ignored and removed (since 49fa26b0411d990d36f3f6c095d167f3d12afdf4) if the corresponding thread has exited. This makes sense for targets that only execute in the forward direction because those breakpoints can never be hit again, but for targets with reverse execution the same thread can be seen again. --- gdb/breakpoint.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index da6c8de9d14..9a25c5f663d 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -3157,10 +3157,12 @@ insert_breakpoint_locations (void) continue; /* There is no point inserting thread-specific breakpoints if - the thread no longer exists. ALL_BP_LOCATIONS bp_location - has BL->OWNER always non-NULL. */ + the thread no longer exists, unless the target supports + reverse execution. ALL_BP_LOCATIONS bp_location has + BL->OWNER always non-NULL. */ if (bl->owner->thread != -1 - && !valid_global_thread_id (bl->owner->thread)) + && !valid_global_thread_id (bl->owner->thread) + && !target_can_execute_reverse ()) continue; switch_to_program_space_and_thread (bl->pspace); @@ -3245,12 +3247,18 @@ remove_breakpoints (void) return val; } -/* When a thread exits, remove breakpoints that are related to - that thread. */ +/* When a thread exits, remove breakpoints that are related to that + thread and cannot be hit again. */ static void remove_threaded_breakpoints (struct thread_info *tp, int silent) { + /* Targets that support reverse execution may navigate to a point in + time where an exited thread reappears and where its breakpoints + are still relevant. */ + if (target_can_execute_reverse ()) + return; + for (breakpoint &b : all_breakpoints_safe ()) { if (b.thread == tp->global_num && user_breakpoint_p (&b)) -- 2.25.1