+2019-07-17 Tom Tromey <tom@tromey.com>
+
+ PR tui/24722:
+ * tui/tui-winsource.h (tui_update_all_breakpoint_info)
+ (tui_update_breakpoint_info): Add "being_deleted" parameter.
+ * tui/tui-winsource.c (tui_update_source_window_as_is): Update.
+ (tui_update_all_breakpoint_info): Add "being_deleted" parameter.
+ (tui_update_breakpoint_info): Likewise.
+ * tui/tui-hooks.c (tui_event_create_breakpoint)
+ (tui_event_delete_breakpoint, tui_event_modify_breakpoint):
+ Update.
+
2019-07-17 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (tui_show_frame_info): Consolidate "if"s.
static void
tui_event_create_breakpoint (struct breakpoint *b)
{
- tui_update_all_breakpoint_info ();
+ tui_update_all_breakpoint_info (nullptr);
}
/* Breakpoint deletion hook.
static void
tui_event_delete_breakpoint (struct breakpoint *b)
{
- tui_update_all_breakpoint_info ();
+ tui_update_all_breakpoint_info (b);
}
static void
tui_event_modify_breakpoint (struct breakpoint *b)
{
- tui_update_all_breakpoint_info ();
+ tui_update_all_breakpoint_info (nullptr);
}
/* Refresh TUI's frame and register information. This is a hook intended to be
}
else
{
- tui_update_breakpoint_info (win_info, 0);
+ tui_update_breakpoint_info (win_info, nullptr, false);
tui_show_source_content (win_info);
tui_update_exec_info (win_info);
if (win_info->type == SRC_WIN)
refill ();
}
-/* Update the execution windows to show the active breakpoints.
- This is called whenever a breakpoint is inserted, removed or
- has its state changed. */
+/* See tui-winsource.h. */
+
void
-tui_update_all_breakpoint_info ()
+tui_update_all_breakpoint_info (struct breakpoint *being_deleted)
{
for (tui_source_window_base *win : tui_source_windows ())
{
- if (tui_update_breakpoint_info (win, FALSE))
+ if (tui_update_breakpoint_info (win, being_deleted, false))
{
tui_update_exec_info (win);
}
}
-/* Scan the source window and the breakpoints to update the has_break
+/* Scan the source window and the breakpoints to update the break_mode
information for each line.
- Returns 1 if something changed and the execution window must be
+ Returns true if something changed and the execution window must be
refreshed. */
-int
-tui_update_breakpoint_info (struct tui_source_window_base *win,
- int current_only)
+bool
+tui_update_breakpoint_info (struct tui_source_window_base *win,
+ struct breakpoint *being_deleted,
+ bool current_only)
{
int i;
- int need_refresh = 0;
+ bool need_refresh = false;
tui_source_window_base *src = (tui_source_window_base *) win;
for (i = 0; i < win->content.size (); i++)
gdb_assert (line->line_or_addr.loa == LOA_LINE
|| line->line_or_addr.loa == LOA_ADDRESS);
+ if (bp == being_deleted)
+ continue;
+
for (loc = bp->loc; loc != NULL; loc = loc->next)
{
if ((win == TUI_SRC_WIN
tui_exec_info_content *content
= win_info->execution_info->maybe_allocate_content (win_info->height);
- tui_update_breakpoint_info (win_info, 1);
+ tui_update_breakpoint_info (win_info, nullptr, true);
for (int i = 0; i < win_info->content.size (); i++)
{
tui_exec_info_content &element = content[i];
/* Update the execution windows to show the active breakpoints. This
is called whenever a breakpoint is inserted, removed or has its
- state changed. */
-extern void tui_update_all_breakpoint_info (void);
+ state changed. Normally BEING_DELETED is nullptr; if not nullptr,
+ it indicates a breakpoint that is in the process of being deleted,
+ and which should therefore be ignored by the update. This is done
+ because the relevant observer is notified before the breakpoint is
+ removed from the list of breakpoints. */
+extern void tui_update_all_breakpoint_info (struct breakpoint *being_deleted);
/* Scan the source window and the breakpoints to update the break_mode
- information for each line. Returns 1 if something changed and the
- execution window must be refreshed. */
-extern int tui_update_breakpoint_info (struct tui_source_window_base *win,
- int current_only);
+ information for each line. Returns true if something changed and
+ the execution window must be refreshed. See
+ tui_update_all_breakpoint_info for a description of
+ BEING_DELETED. */
+extern bool tui_update_breakpoint_info (struct tui_source_window_base *win,
+ struct breakpoint *being_deleted,
+ bool current_only);
/* Function to display the "main" routine. */
extern void tui_display_main (void);