From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id FX2vK9NYcWHpSwAAWB0awg (envelope-from ) for ; Thu, 21 Oct 2021 08:10:59 -0400 Received: by simark.ca (Postfix, from userid 112) id A2FCB1F0BD; Thu, 21 Oct 2021 08:10:59 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.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 6FDFD1E79C for ; Thu, 21 Oct 2021 08:10:58 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A02DB3857C6D for ; Thu, 21 Oct 2021 12:10:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A02DB3857C6D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1634818257; bh=jFtk2dSrWVaCXinDV6nNHaDmiBy+38wNxU8FYBYVMa4=; 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=OkW9yTC5e+LeOW0z15xJnVOBVjjIA86X0aCgyspx4Vm103nJa9Naf5tMhj5q1f4T2 pZUPWsKN1h+ZuqMTyZxyuS6gk/iN/Jm8j1GUmDXQtWeieyRnpC2t6et7RmJjX/apnp aUUZd/9G7Z3DZSD/7BYUxfgrRwi6/WOQtX8NN+sA= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 21C8E3858D39 for ; Thu, 21 Oct 2021 12:10:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 21C8E3858D39 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 5DD0A1FD4F; Thu, 21 Oct 2021 12:10:37 +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 41A4E13A6F; Thu, 21 Oct 2021 12:10:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GDnmDr1YcWGreQAAMHmgww (envelope-from ); Thu, 21 Oct 2021 12:10:37 +0000 Subject: Re: [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> <13493139-7bee-fb1e-f72a-6fdc36ac5b5d@suse.de> Message-ID: <265fd71d-ee7f-489c-bcb5-dfa86a1d18bb@suse.de> Date: Thu, 21 Oct 2021 14:10:36 +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: <13493139-7bee-fb1e-f72a-6fdc36ac5b5d@suse.de> Content-Type: multipart/mixed; boundary="------------4C9F06077FB4F7BECD54D0C7" 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. --------------4C9F06077FB4F7BECD54D0C7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 10/21/21 1:29 PM, Tom de Vries wrote: > [ 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 ? Now also included test-case. Thanks, - Tom --------------4C9F06077FB4F7BECD54D0C7 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/testsuite/gdb.tui/break.exp | 37 +++++++++++++++++++++++++++++++++++++ gdb/tui/tui-winsource.c | 3 +-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.tui/break.exp b/gdb/testsuite/gdb.tui/break.exp new file mode 100644 index 00000000000..de4821c570a --- /dev/null +++ b/gdb/testsuite/gdb.tui/break.exp @@ -0,0 +1,37 @@ +# Copyright 2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Verify that breakpoint marker is shown. + +tuiterm_env + +standard_testfile tui-layout.c + +if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { + return -1 +} + +Term::clean_restart 24 80 $testfile +if {![Term::enter_tui]} { + unsupported "TUI not supported" + return +} + +set text [Term::get_all_lines] +gdb_assert {![string match "No Source Available" $text]} \ + "initial source listing" + +Term::command "b main" +Term::check_contents "break marker present" "\\|b\\+" 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) --------------4C9F06077FB4F7BECD54D0C7--