From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3fbc0609cd6so21726095e9.1 for ; Fri, 07 Jul 2023 09:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=undo.io; s=google2; t=1688747095; x=1691339095; 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=gl52jqqlmh0gZg4jO+ok9wFJE8d15acDSwpIKjFfexY=; b=KHzHM81N6EC5rv+EGE/gCg6yTnKghi/+fJO5wt5wrH1AfZPlcerP4fhwF3PBdLAKJf BNB7XNMEIfKuB46By9cAOy0OW/qz7CCq1d+OvLFz8hZp7e+VwUlKmIZhWHkyCo/hW8i5 5hVSuF0L2a32BAHUYFsxdvz93XBfjm6gwZA4LHYdeP30myF1kObtnRbsd5yUVUBtMqKw SpNM700+tIEVAyATtwlW4Ul1fhT9OYsFucHdcxtsI18RI972hB+Qka8b/gdZYg17yQoi N5go630HW2TEe3hMB/q9OLOINwULNnK4v+85HQKyNTO2KJ6R8tQd9SkK9AqIfx991Z31 kTPQ== 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) From: Magne Hov 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 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.40.1