2019-07-17 Tom Tromey <tom@tromey.com>
+ * tui/tui-winsource.c (tui_clear_source_content)
+ (tui_show_source_content, tui_show_exec_info_content)
+ (tui_clear_exec_info_content): Update.
+ * tui/tui-stack.c (tui_show_locator_content): Update.
+ (tui_show_frame_info): Update.
+ * tui/tui-source.h (tui_source_window): Don't declare.
+ * tui/tui-source.c (tui_source_window::showing_source_p): Rename
+ from tui_source_is_displayed.
+ * tui/tui-data.h (struct tui_gen_win_info) <content_in_use>:
+ Remove field.
+ (struct tui_source_window_base) <content_in_use>: New field. Now
+ bool.
+ (struct tui_source_window) <showing_source_p>: New method.
+ (TUI_SRC_WIN): Change cast.
+ * tui/tui-data.c (tui_initialize_static_data): Update.
+
+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
win->viewport_height =
win->last_visible_line = 0;
win->handle = NULL;
- win->content_in_use = FALSE;
win->is_visible = false;
win->title = 0;
}
int height = 0;
/* Origin of window. */
struct tui_point origin = {0, 0};
- /* Can it be used, or is it already used? */
- int content_in_use = FALSE;
/* Viewport height. */
int viewport_height = 0;
/* Index of last visible line. */
LINE_NO in this source window; false otherwise. */
virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0;
+ /* Can it be used, or is it already used? */
+ bool content_in_use = false;
/* Does the locator belong to this window? */
bool m_has_locator = false;
/* Execution information window. */
bool location_matches_p (struct bp_location *loc, int line_no) override;
+ bool showing_source_p (const char *filename) const;
+
protected:
void do_scroll_vertical (int num_to_scroll) override;
/* Global Data. */
extern struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
-#define TUI_SRC_WIN ((tui_source_window_base *) tui_win_list[SRC_WIN])
+#define TUI_SRC_WIN ((tui_source_window *) tui_win_list[SRC_WIN])
#define TUI_DISASM_WIN ((tui_source_window_base *) tui_win_list[DISASSEM_WIN])
#define TUI_DATA_WIN ((tui_data_window *) tui_win_list[DATA_WIN])
#define TUI_CMD_WIN ((tui_cmd_window *) tui_win_list[CMD_WIN])
/* Answer whether the source is currently displayed in the source
window. */
-int
-tui_source_is_displayed (const char *fullname)
+bool
+tui_source_window::showing_source_p (const char *fullname) const
{
- return (TUI_SRC_WIN != NULL
- && TUI_SRC_WIN->content_in_use
+ return (content_in_use
&& (filename_cmp (tui_locator_win_info_ptr ()->full_name,
fullname) == 0));
}
struct gdbarch *, struct symtab *,
struct tui_line_or_address,
int);
-extern int tui_source_is_displayed (const char *);
#endif /* TUI_TUI_SOURCE_H */
locator->refresh_window ();
wmove (locator->handle, 0, 0);
xfree (string);
- locator->content_in_use = TRUE;
}
}
symtab_and_line sal = find_frame_sal (fi);
- source_already_displayed = sal.symtab != 0
- && tui_source_is_displayed (symtab_to_fullname (sal.symtab));
+ const char *fullname = nullptr;
+ if (sal.symtab != nullptr)
+ fullname = symtab_to_fullname (sal.symtab);
+
+ source_already_displayed = (sal.symtab != 0
+ && TUI_SRC_WIN != nullptr
+ && TUI_SRC_WIN->showing_source_p (fullname));
if (get_frame_pc_if_available (fi, &pc))
locator_changed_p
= tui_set_locator_info (get_frame_arch (fi),
(sal.symtab == 0
- ? "??" : symtab_to_fullname (sal.symtab)),
+ ? "??" : fullname),
tui_get_function_from_frame (fi),
sal.line,
pc);
{
int i;
- win_info->content_in_use = FALSE;
+ win_info->content_in_use = false;
tui_erase_source_content (win_info, display_prompt);
for (i = 0; i < win_info->content.size (); i++)
{
tui_check_and_display_highlight_if_needed (win_info);
win_info->refresh_window ();
- win_info->content_in_use = TRUE;
+ win_info->content_in_use = true;
}
/* See tui-data.h. */
0,
content[cur_line - 1]);
exec_info->refresh_window ();
- exec_info->content_in_use = TRUE;
}
void
tui_clear_exec_info_content (struct tui_source_window_base *win_info)
{
- win_info->execution_info->content_in_use = FALSE;
tui_erase_exec_info_content (win_info);
}