+2019-07-17 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-winsource.c (tui_update_breakpoint_info): Use
+ location_matches_p.
+ * tui/tui-source.c (tui_source_window::location_matches_p): New
+ method.
+ * tui/tui-disasm.c (tui_disasm_window::location_matches_p): New
+ method.
+ * tui/tui-data.h (struct tui_source_window_base)
+ <location_matches_p>: New method.
+ (struct tui_source_window, struct tui_disasm_window)
+ <location_matches_p>: Likewise.
+
2019-07-17 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_set_win_height_command): Rename from
void update_tab_width () override;
+ /* Return true if the location LOC corresponds to the line number
+ LINE_NO in this source window; false otherwise. */
+ virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0;
+
/* Does the locator belong to this window? */
bool m_has_locator = false;
/* Execution information window. */
return SRC_NAME;
}
+ bool location_matches_p (struct bp_location *loc, int line_no) override;
+
protected:
void do_scroll_vertical (int num_to_scroll) override;
return DISASSEM_NAME;
}
+ bool location_matches_p (struct bp_location *loc, int line_no) override;
+
protected:
void do_scroll_vertical (int num_to_scroll) override;
NULL, val, FALSE);
}
}
+
+bool
+tui_disasm_window::location_matches_p (struct bp_location *loc, int line_no)
+{
+ return (content[line_no].line_or_addr.loa == LOA_ADDRESS
+ && content[line_no].line_or_addr.u.addr == loc->address);
+}
if (tui_active && is_visible)
refill ();
}
+
+bool
+tui_source_window::location_matches_p (struct bp_location *loc, int line_no)
+{
+ return (content[line_no].line_or_addr.loa == LOA_LINE
+ && content[line_no].line_or_addr.u.line_no == loc->line_number
+ && loc->symtab != NULL
+ && filename_cmp (fullname,
+ symtab_to_fullname (loc->symtab)) == 0);
+}
{
int i;
bool need_refresh = false;
- tui_source_window_base *src = (tui_source_window_base *) win;
for (i = 0; i < win->content.size (); i++)
{
for (loc = bp->loc; loc != NULL; loc = loc->next)
{
- if ((win == TUI_SRC_WIN
- && loc->symtab != NULL
- && filename_cmp (src->fullname,
- symtab_to_fullname (loc->symtab)) == 0
- && line->line_or_addr.loa == LOA_LINE
- && loc->line_number == line->line_or_addr.u.line_no)
- || (win == TUI_DISASM_WIN
- && line->line_or_addr.loa == LOA_ADDRESS
- && loc->address == line->line_or_addr.u.addr))
+ if (win->location_matches_p (loc, i))
{
if (bp->enable_state == bp_disabled)
mode |= TUI_BP_DISABLED;