From patchwork Tue Oct 15 13:31:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 34982 Received: (qmail 1096 invoked by alias); 15 Oct 2019 13:31:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 1041 invoked by uid 89); 15 Oct 2019 13:31:16 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2830 X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Oct 2019 13:31:14 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 04AD92095C; Tue, 15 Oct 2019 09:31:12 -0400 (EDT) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id A5F62208F0; Tue, 15 Oct 2019 09:31:05 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 92C4029ECF; Tue, 15 Oct 2019 09:31:05 -0400 (EDT) X-Gerrit-PatchSet: 4 Date: Tue, 15 Oct 2019 09:31:05 -0400 From: "Sourceware to Gerrit sync (Code Review)" To: Christian Biesinger , gdb-patches@sourceware.org Cc: Simon Marchi Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: Change in binutils-gdb[master]: Make tui-winsource not use breakpoint_chain X-Gerrit-Change-Id: Ic259b2c3a4c1f5a47f34cfd7fccbdcf274417429 X-Gerrit-Change-Number: 22 X-Gerrit-ChangeURL: X-Gerrit-Commit: 81e6b8eb208c427028d919afb2b5cabbc355fc88 In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, simon.marchi@polymtl.ca, cbiesinger@google.com, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3 Message-Id: <20191015133105.92C4029ECF@gnutoolchain-gerrit.osci.io> Sourceware to Gerrit sync has submitted this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/22 ...................................................................... Make tui-winsource not use breakpoint_chain That's an internal variable of breakpoint.c. Insted, use iterate_over_breakpoints to update the breakpoint list. gdb/ChangeLog: 2019-10-15 Christian Biesinger * breakpoint.c (breakpoint_chain): Make static. * tui/tui-winsource.c: Call iterate_over_breakpoints instead of accessing breakpoint_chain. Change-Id: Ic259b2c3a4c1f5a47f34cfd7fccbdcf274417429 --- M gdb/ChangeLog M gdb/breakpoint.c M gdb/tui/tui-winsource.c 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 39a8374..9d3ec1f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2019-10-15 Christian Biesinger + * breakpoint.c (breakpoint_chain): Make static. + * tui/tui-winsource.c: Call iterate_over_breakpoints instead + of accessing breakpoint_chain. + +2019-10-15 Christian Biesinger + * breakpoint.c (iterate_over_breakpoints): Change function pointer to a gdb::function_view and return value to bool. * breakpoint.h (iterate_over_breakpoints): Likewise. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 9bbb28f..2fd2438 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -517,7 +517,7 @@ /* Chains of all breakpoints defined. */ -struct breakpoint *breakpoint_chain; +static struct breakpoint *breakpoint_chain; /* Array is sorted by bp_locations_compare - primarily by the ADDRESS. */ diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index f1c9f95..3fbc49f 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -401,8 +401,6 @@ for (i = 0; i < content.size (); i++) { - struct breakpoint *bp; - extern struct breakpoint *breakpoint_chain; struct tui_source_element *line; line = &content[i]; @@ -413,9 +411,7 @@ do with it. Identify enable/disabled breakpoints as well as those that we already hit. */ tui_bp_flags mode = 0; - for (bp = breakpoint_chain; - bp != NULL; - bp = bp->next) + iterate_over_breakpoints ([&] (breakpoint *bp) -> bool { struct bp_location *loc; @@ -423,7 +419,7 @@ || line->line_or_addr.loa == LOA_ADDRESS); if (bp == being_deleted) - continue; + return false; for (loc = bp->loc; loc != NULL; loc = loc->next) { @@ -441,7 +437,8 @@ mode |= TUI_BP_HARDWARE; } } - } + return false; + }); if (line->break_mode != mode) { line->break_mode = mode;