From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: Johnson Sun To: gdb-patches@sourceware.org Cc: j3.soon777@gmail.com 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-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: , X-List-Received-Date: Tue, 20 Sep 2022 17:29:26 -0000 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