From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id hSE0EW88qGR8ZxkAWB0awg (envelope-from ) for ; Fri, 07 Jul 2023 12:25:19 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=PZd1hdcU; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 280A61E0BD; Fri, 7 Jul 2023 12:25:19 -0400 (EDT) Received: from server2.sourceware.org (ip-8-43-85-97.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 119401E0BB for ; Fri, 7 Jul 2023 12:25:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9E052384DE7B for ; Fri, 7 Jul 2023 16:25:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E052384DE7B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688747116; bh=gl52jqqlmh0gZg4jO+ok9wFJE8d15acDSwpIKjFfexY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=PZd1hdcUZBFfj9VJ0Wu6d43ZAkU94MrB2cuI58ga9sd0fmP9h+elOSCWBcxDCPoIT VrnyaaYHYKa3X7rDmcRhBMNd6/RHiwBwL5qyQtaaQpdt2OtAso1AG/XdJVkIp/fKLY olNHDBZmiEtVL7ZraKc1RMhQ4b/LtXavsITiMc2M= Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 2DD66385E037 for ; Fri, 7 Jul 2023 16:24:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2DD66385E037 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbc0609cd6so21726095e9.1 for ; Fri, 07 Jul 2023 09:24:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688747095; x=1691339095; 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=gl52jqqlmh0gZg4jO+ok9wFJE8d15acDSwpIKjFfexY=; b=OgWM05pQTlZXiU2kXN00IY+kbDnzqM1VxjLhxX3/mmeBlsuCDJUJS5usueD63EPQrb qwbCViob+LugqsF38P6BDpPvFUs9/iUhRpk+I9riSWpW0ZZHDd2MymVGy6P9qvHFbfRm Tn2tqYNoYYGK/cn7vU2v+lgfWu1nWG88BP8PwjS3xzbrq9rmGOkN7UnCfDwywlDxZ2KI EigIA+jf/ZdplZOePZ1pI+gUcJlTFyWFO/9YnUhS/HLmuumw0hglq26mehfRDbL/uFAJ U5n7aU3vCdG1irx2Cw1Q1WB7Ml19leSzIFT+qMh6tYWxjpDHwWURuIAmPNBq/fmYsn3f aw1Q== X-Gm-Message-State: ABy/qLbZCzb7l0MNem8B43ANi1oIi7kULgnXyNIOq6AkdGWFXVKyTJwL kvMD8YAbQg3zAo+t/BUyAEcZGiy66IF9X09R15JQ7LYkMEavvLHpH69TpxCc19II0MgFtrdmMR+ UD/2U02sedhzi0uuCxDYT/Iwzx0Q3HnskwvIYZPE5AdlCNliLJu5gnvHl+Uk/hgbKVWDzIN4= X-Google-Smtp-Source: APBJJlHdJmYFDJLu2378wgkecr0VzkZoo6u1y5dXuIfwOBn122pqQ4QPcVcbumEyt4zOoE1Dp2KZaQ== X-Received: by 2002:a7b:c858:0:b0:3f7:3651:450c with SMTP id c24-20020a7bc858000000b003f73651450cmr4489085wml.6.1688747094582; Fri, 07 Jul 2023 09:24:54 -0700 (PDT) Received: from sbrinz-thinkpad.undoers.io (nrwh-14-b2-v4wan-164652-cust345.vm23.cable.virginm.net. [81.96.125.90]) by smtp.gmail.com with ESMTPSA id f11-20020a7bc8cb000000b003fa98908014sm2931834wml.8.2023.07.07.09.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 09:24:54 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Magne Hov Subject: [PATCH v2 2/2] gdb: retain thread-specific breakpoints in reverse execution targets Date: Fri, 7 Jul 2023 17:24:51 +0100 Message-Id: <20230707162451.3605544-3-mhov@undo.io> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230707162451.3605544-1-mhov@undo.io> References: <20230629083651.3145268-1-mhov@undo.io> <20230707162451.3605544-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 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: Magne Hov via Gdb-patches Reply-To: Magne Hov Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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.40.1