From: cbiesinger@chromium.org
To: gdb-patches@sourceware.org
Cc: Christian Biesinger <cbiesinger@google.com>
Subject: [PATCH v2 2/2] Make tui-winsource not use breakpoint_chain
Date: Wed, 09 Oct 2019 19:39:00 -0000 [thread overview]
Message-ID: <20191009193938.147076-2-cbiesinger@chromium.org> (raw)
In-Reply-To: <20191009193938.147076-1-cbiesinger@chromium.org>
From: Christian Biesinger <cbiesinger@google.com>
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 <cbiesinger@google.com>
* 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 698411d707f..531ab044557 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..fb64075cbff 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 ([&] (struct breakpoint *bp, void*) -> int
{
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;
+ }, nullptr);
if (line->break_mode != mode)
{
line->break_mode = mode;
need_refresh = true;
}
+ return false;
}
return need_refresh;
}
--
2.23.0.581.g78d2f28ef7-goog
next prev parent reply other threads:[~2019-10-09 19:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 19:39 [PATCH v2 1/2] Change iterate_over_breakpoints to take a function_view cbiesinger
2019-10-09 19:39 ` cbiesinger [this message]
2019-10-09 21:02 ` Tom Tromey
2019-10-10 0:13 ` Christian Biesinger via gdb-patches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191009193938.147076-2-cbiesinger@chromium.org \
--to=cbiesinger@chromium.org \
--cc=cbiesinger@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox