From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6MbEDoz4KWPkPj0AWB0awg (envelope-from ) for ; Tue, 20 Sep 2022 13:29:48 -0400 Received: by simark.ca (Postfix, from userid 112) id 3885D1E112; Tue, 20 Sep 2022 13:29:48 -0400 (EDT) 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=gfDXSDIn; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_REPLYTO_END_DIGIT,MAILING_LIST_MULTI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from 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 CA6FB1E0D5 for ; Tue, 20 Sep 2022 13:29:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 25D233857C7C for ; Tue, 20 Sep 2022 17:29:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25D233857C7C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663694986; bh=5kyYVvgsP1n3SE2aCw2XpjaXqC+L/HVhANGx8XJwJOc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gfDXSDInGzZLs4i7A7v8QYDi1EIYLfo5E1d0z1fR0gCsWngv4HF+MCKDDEbsNFCHG rOj7MA72AF4zYa6d0hUFYrpe+SYZMlKQB/odcSye7IPzwDh5eZSoLduRx3TwCgmeep nBHeoVawJQVzrK92WlIhybS7ANecjxtpOgnu8Iv0= Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id EC311385840F for ; Tue, 20 Sep 2022 17:29:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC311385840F Received: by mail-wr1-x42d.google.com with SMTP id e16so5512224wrx.7 for ; Tue, 20 Sep 2022 10:29:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=5kyYVvgsP1n3SE2aCw2XpjaXqC+L/HVhANGx8XJwJOc=; b=pov5PpdXGZGUFFYAxCnUmINvDYjXh3Mt+xU3z6k09spS04c8oYwXAVbFb3cN0WhcEi 9So4WrSecXgiDmJ5WEh4NcySfRRRRJVFv2NsNM78RF44k/60bIKIjRxFEpYUlvjcBw1U 8oT4O6Q2R68XzovaN/nQw7MnWqMPW9dznBTudONCjpl97muWW0TIaKRys0RcDcGNIP3Y imkjsp7btyWP3AQm7QDGEYVijORgH96bw+BTFdGoV8CzzmsD2PQXB30ADY8tRw8Wra7R 1evAvpNZzXSrqKfuxi34Ld4rEbIQ83SmJ3iQWQNVMcVHiG8RDpfSbOvAM39R4697/K9E PZcQ== X-Gm-Message-State: ACrzQf3q8sOL16TfE8iiWi6foWdXG3M3DSoaUgBftN9f7HgTLazI+RyC bbDR8bEmEKl0tosTrXHqQOm77rZE9R2DaQ== X-Google-Smtp-Source: AMsMyM7+kcMIPK15rv185/uLvpuSxal5KPfylpubrWF9AQG/J9TTaoPoFyGfBpoDafM00wgDbdQlVg== X-Received: by 2002:adf:f50e:0:b0:228:de89:dace with SMTP id q14-20020adff50e000000b00228de89dacemr14854617wro.354.1663694963526; Tue, 20 Sep 2022 10:29:23 -0700 (PDT) Received: from ubuntu-22.. (intel10.cs.nthu.edu.tw. [140.114.89.60]) by smtp.gmail.com with ESMTPSA id c1-20020adffb01000000b00228da396f9dsm311685wrr.84.2022.09.20.10.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 10:29:23 -0700 (PDT) To: gdb-patches@sourceware.org Subject: [PATCH 2/3] [gdb/python] Fix gdb.python/py-finish-breakpoint-deletion.exp for Bug 18655 Date: Wed, 21 Sep 2022 01:24:27 +0800 Message-Id: <20220920172426.90659-3-j3.soon777@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220920172426.90659-1-j3.soon777@gmail.com> References: <20220920172426.90659-1-j3.soon777@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Johnson Sun via Gdb-patches Reply-To: Johnson Sun Cc: j3.soon777@gmail.com Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This removes the KFAIL in the testcase, and fixes the bug by setting the correct disposition type for deletion. The original code fails since it does not correctly delete the temporary FinishBreakpoints in `gdb/python/py-finishbreakpoint.c': /* Can't delete it here, but it will be removed at the next stop. */ disable_breakpoint (bp_obj->bp); gdb_assert (bp_obj->bp->disposition == disp_del); The code above aims to delete the breakpoint on the next hit by setting the disposition to `disp_del'. However, the FinishBreakpoint is disabled, so it will never be hit (thus never be deleted before the program stops). The fix only consists of a single line, setting the disposition to `disp_del_at_next_stop': bp_obj->bp->disposition = disp_del_at_next_stop; The code above allows the breakpoint to be deleted in `breakpoint_auto_delete': for (breakpoint *b : all_breakpoints_safe ()) if (b->disposition == disp_del_at_next_stop) delete_breakpoint (b); Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18655 --- gdb/python/py-finishbreakpoint.c | 1 + gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index c80096f6810..a219bc82f15 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -146,6 +146,7 @@ bpfinishpy_post_stop_hook (struct gdbpy_breakpoint_object *bp_obj) /* Can't delete it here, but it will be removed at the next stop. */ disable_breakpoint (bp_obj->bp); gdb_assert (bp_obj->bp->disposition == disp_del); + bp_obj->bp->disposition = disp_del_at_next_stop; } catch (const gdb_exception &except) { diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp index 778b53fbeda..ac5e5d8ac2e 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp @@ -43,5 +43,4 @@ gdb_test "source $pyfile" ".*Python script imported.*" \ "import python scripts" gdb_test "python print (len(gdb.breakpoints()))" "2" "check modified BP count" gdb_test "continue" "Breakpoint.*at.*" "run until FinishBreakpoint stops" -setup_kfail "gdb/18655" "*-*-*" gdb_test "python print (len(gdb.breakpoints()))" "2" "check BP count" -- 2.34.1