From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aNdfLkJPcWHhSgAAWB0awg (envelope-from ) for ; Thu, 21 Oct 2021 07:30:10 -0400 Received: by simark.ca (Postfix, from userid 112) id B9D1A1F0BD; Thu, 21 Oct 2021 07:30:10 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 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 6466E1E79C for ; Thu, 21 Oct 2021 07:30:10 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 607AF385802B for ; Thu, 21 Oct 2021 11:30:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 607AF385802B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1634815809; bh=w4knY4+OBwiH/WOO8iC5PGzBOSEaWeo2e7kaqxPM+Wg=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=jgVh16399q6yo8TeFvs2urWVpFjVn3VbCZzFklJGrmdTWXfnlXsyOzuZ81IBr1130 87yWAawspIMx6lzcEKwwRi+ddU2qvj+fe9ha+QoMw67nXCa925FxeenuathuZcaQPy Hus0hyGfAax1oLNt2Fw7w5s5WSl+rgGiIjsI7yqQ= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 15C6A3858D39 for ; Thu, 21 Oct 2021 11:29:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 15C6A3858D39 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2BED71FDA8; Thu, 21 Oct 2021 11:29:48 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1185A13A6F; Thu, 21 Oct 2021 11:29:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id dJ8RAyxPcWFZaAAAMHmgww (envelope-from ); Thu, 21 Oct 2021 11:29:48 +0000 Subject: [PATCH, master + 11][gdb/tui] Fix breakpoint display functionality To: Simon Marchi , gdb-patches@sourceware.org References: <20210527153558.3016335-1-simon.marchi@polymtl.ca> <20210527153558.3016335-9-simon.marchi@polymtl.ca> <83f04dc4-f756-0363-2e07-f81a6c384007@suse.de> Message-ID: <13493139-7bee-fb1e-f72a-6fdc36ac5b5d@suse.de> Date: Thu, 21 Oct 2021 13:29:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <83f04dc4-f756-0363-2e07-f81a6c384007@suse.de> Content-Type: multipart/mixed; boundary="------------B0E06D59F8F471964BD035FD" Content-Language: en-US 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: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" This is a multi-part message in MIME format. --------------B0E06D59F8F471964BD035FD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit [ was: Re: [PATCH 8/9] gdb: remove iterate_over_breakpoints function ] On 10/21/21 12:20 PM, Tom de Vries wrote: > On 5/27/21 5:35 PM, Simon Marchi via Gdb-patches wrote: >> /* Create and register solib event breakpoints. PROBES is an array >> diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c >> index 738f69156485..afd51e95980c 100644 >> --- a/gdb/tui/tui-winsource.c >> +++ b/gdb/tui/tui-winsource.c >> @@ -457,7 +457,7 @@ tui_source_window_base::update_breakpoint_info >> do with it. Identify enable/disabled breakpoints as well as >> those that we already hit. */ >> tui_bp_flags mode = 0; >> - iterate_over_breakpoints ([&] (breakpoint *bp) -> bool >> + for (breakpoint *bp : all_breakpoints ()) >> { >> if (bp == being_deleted) >> return false; >> @@ -479,7 +479,8 @@ tui_source_window_base::update_breakpoint_info >> } >> } >> return false; >> - }); >> + } >> + >> if (line->break_mode != mode) >> { >> line->break_mode = mode; >> -- > > This changes a lambda function body to a loop body, but fails to update > the two returns. Consequently, showing breakpoints in tui is broken > (and unfortunately there's no test-case to detect that). > > This works for me: Now with commit log, referring to corresponding PR. OK for trunk / 11 branch ? Thanks, - Tom --------------B0E06D59F8F471964BD035FD Content-Type: text/x-patch; charset=UTF-8; name="0001-gdb-tui-Fix-breakpoint-display-functionality.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-gdb-tui-Fix-breakpoint-display-functionality.patch" [gdb/tui] Fix breakpoint display functionality In commit 81e6b8eb208 "Make tui-winsource not use breakpoint_chain", a loop body was transformed into a lambda function body: ... - for (bp = breakpoint_chain; - bp != NULL; - bp = bp->next) + iterate_over_breakpoints ([&] (breakpoint *bp) -> bool ... and consequently: - a continue was replaced by a return, and - a final return was added. Then in commit 240edef62f0 "gdb: remove iterate_over_breakpoints function", we transformed back to a loop body: ... - iterate_over_breakpoints ([&] (breakpoint *bp) -> bool + for (breakpoint *bp : all_breakpoints ()) ... but without reverting the changes that introduced the two returns. Consequently, breakpoints no longer show up in the tui source window. Fix this by reverting the changes that introduced the two returns. Build on x86_64-linux, tested with all .exp test-cases that contain tuiterm_env. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28483 --- gdb/tui/tui-winsource.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index afd51e95980..955b68901fe 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -460,7 +460,7 @@ tui_source_window_base::update_breakpoint_info for (breakpoint *bp : all_breakpoints ()) { if (bp == being_deleted) - return false; + continue; for (bp_location *loc : bp->locations ()) { @@ -478,7 +478,6 @@ tui_source_window_base::update_breakpoint_info mode |= TUI_BP_HARDWARE; } } - return false; } if (line->break_mode != mode) --------------B0E06D59F8F471964BD035FD--