From patchwork Thu Oct 10 00:04:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Biesinger X-Patchwork-Id: 34893 Received: (qmail 74399 invoked by alias); 10 Oct 2019 00:04:22 -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 74348 invoked by uid 89); 10 Oct 2019 00:04:21 -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, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*MI:sk:2019101 X-HELO: mail-io1-f65.google.com Received: from mail-io1-f65.google.com (HELO mail-io1-f65.google.com) (209.85.166.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Oct 2019 00:04:18 +0000 Received: by mail-io1-f65.google.com with SMTP id q1so9692932ion.1 for ; Wed, 09 Oct 2019 17:04:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3yI1bkPochPxlTZwYzv/xip53/e6b7bGYN4UrH9Me9c=; b=avQsSXxkhj0a1q8MzNaWeq2JGNgJHlNdOl6ZlLEMGaPI53giUN7K0Z41VcopBzk40l ON5gPPkrMBpfUVfXaOuj8Ax3q6KAMit5INuZsUI1ZWMr9C1DjZe6eQqpk6NEYmupqTZ2 rFEHNvzB3DRTbIutocL+A0GQEgcScvL3b1HFM= Return-Path: Received: from cbiesinger.roam.corp.google.com (ip-174-152-211-21.chcgil.spcsdns.net. [174.152.211.21]) by smtp.googlemail.com with ESMTPSA id s201sm3509230ios.83.2019.10.09.17.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 17:04:15 -0700 (PDT) From: cbiesinger@chromium.org To: gdb-patches@sourceware.org Cc: Christian Biesinger Subject: [PATCH v3 2/2] Make tui-winsource not use breakpoint_chain Date: Wed, 9 Oct 2019 19:04:03 -0500 Message-Id: <20191010000403.189265-2-cbiesinger@chromium.org> In-Reply-To: <20191010000403.189265-1-cbiesinger@chromium.org> References: <20191010000403.189265-1-cbiesinger@chromium.org> MIME-Version: 1.0 From: Christian Biesinger That's an internal variable of breakpoint.c. Insted, use iterate_over_breakpoints to update the breakpoint list. gdb/ChangeLog: 2019-10-09 Christian Biesinger * breakpoint.c (breakpoint_chain): Make static. * tui/tui-winsource.c: Call iterate_over_breakpoints instead of accessing breakpoint_chain. --- gdb/breakpoint.c | 2 +- gdb/tui/tui-winsource.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index e17cb69c3e6..f6d0d715015 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -521,7 +521,7 @@ bool target_exact_watchpoints = false; /* 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 683856de817..d70b7cd8e4c 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -401,8 +401,6 @@ tui_source_window_base::update_breakpoint_info 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 @@ 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; - for (bp = breakpoint_chain; - bp != NULL; - bp = bp->next) + iterate_over_breakpoints ([&] (breakpoint *bp) -> bool { struct bp_location *loc; @@ -423,7 +419,7 @@ tui_source_window_base::update_breakpoint_info || line->line_or_addr.loa == LOA_ADDRESS); if (bp == being_deleted) - continue; + return false; for (loc = bp->loc; loc != NULL; loc = loc->next) { @@ -441,12 +437,14 @@ tui_source_window_base::update_breakpoint_info mode |= TUI_BP_HARDWARE; } } - } + return false; + }); if (line->break_mode != mode) { line->break_mode = mode; need_refresh = true; } + return false; } return need_refresh; }