aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog16
-rw-r--r--gdb/tui/tui-disasm.h5
-rw-r--r--gdb/tui/tui-source.h5
-rw-r--r--gdb/tui/tui-win.c10
-rw-r--r--gdb/tui/tui-winsource.c40
-rw-r--r--gdb/tui/tui-winsource.h7
6 files changed, 53 insertions, 30 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 946e737..f109f9a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,21 @@
2019-08-15 Tom Tromey <tom@tromey.com>
+ * tui/tui-winsource.h (struct tui_source_window_base)
+ <do_erase_source_content>: New method.
+ <erase_source_content>: New method.
+ (tui_erase_source_content): Don't declare.
+ * tui/tui-winsource.c (tui_clear_source_content): Update.
+ (tui_source_window_base::do_erase_source_content): Rename from
+ tui_erase_source_content.
+ (tui_source_window_base::show_source_content): Update.
+ * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
+ * tui/tui-source.h (struct tui_source_window)
+ <erase_source_content>: New method.
+ * tui/tui-disasm.h (struct tui_disasm_window)
+ <erase_source_content>: New method.
+
+2019-08-15 Tom Tromey <tom@tromey.com>
+
* tui/tui-winsource.h (tui_alloc_source_buffer): Don't declare.
(struct tui_source_element): Add DISABLE_COPY_AND_ASSIGN, and move
constructor.
diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index 1b51e09..0ebe42a 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -48,6 +48,11 @@ struct tui_disasm_window : public tui_source_window_base
int line_no, CORE_ADDR addr)
override;
+ void erase_source_content () override
+ {
+ do_erase_source_content (NO_DISASSEM_STRING);
+ }
+
protected:
void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index 4233879..2926777 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -51,6 +51,11 @@ struct tui_source_window : public tui_source_window_base
int line_no, CORE_ADDR addr)
override;
+ void erase_source_content () override
+ {
+ do_erase_source_content (NO_SRC_STRING);
+ }
+
protected:
void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index ff4f2ee..7210f6c 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -595,7 +595,7 @@ tui_resize_all (void)
first_win->make_visible_with_new_height ();
TUI_CMD_WIN->make_visible_with_new_height ();
if (src_win->content.empty ())
- tui_erase_source_content (src_win);
+ src_win->erase_source_content ();
break;
default:
if (cur_layout == SRC_DISASSEM_COMMAND)
@@ -659,7 +659,7 @@ tui_resize_all (void)
second_win->make_visible_with_new_height ();
TUI_CMD_WIN->make_visible_with_new_height ();
if (src_win->content.empty ())
- tui_erase_source_content (src_win);
+ src_win->erase_source_content ();
break;
}
@@ -1065,7 +1065,7 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
tui_source_window_base *src_base
= (tui_source_window_base *) src_win_info;
if (src_base->content.empty ())
- tui_erase_source_content (src_base);
+ src_base->erase_source_content ();
}
}
else
@@ -1169,9 +1169,9 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
second_win->make_visible_with_new_height ();
first_win->make_visible_with_new_height ();
if (src1 != nullptr && src1->content.empty ())
- tui_erase_source_content (src1);
+ src1->erase_source_content ();
if (second_win->content.empty ())
- tui_erase_source_content (second_win);
+ second_win->erase_source_content ();
}
}
}
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 121f19a..d955efc 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -198,7 +198,7 @@ tui_clear_source_content (struct tui_source_window_base *win_info)
{
int i;
- tui_erase_source_content (win_info);
+ win_info->erase_source_content ();
for (i = 0; i < win_info->content.size (); i++)
{
struct tui_source_element *element = &win_info->content[i];
@@ -211,38 +211,30 @@ tui_clear_source_content (struct tui_source_window_base *win_info)
void
-tui_erase_source_content (struct tui_source_window_base *win_info)
+tui_source_window_base::do_erase_source_content (const char *str)
{
int x_pos;
- int half_width = (win_info->width - 2) / 2;
+ int half_width = (width - 2) / 2;
- if (win_info->handle != NULL)
+ if (handle != NULL)
{
- werase (win_info->handle);
- win_info->check_and_display_highlight_if_needed ();
+ werase (handle);
+ check_and_display_highlight_if_needed ();
- const char *no_src_str;
-
- if (win_info->type == SRC_WIN)
- no_src_str = NO_SRC_STRING;
- else
- no_src_str = NO_DISASSEM_STRING;
- if (strlen (no_src_str) >= half_width)
+ if (strlen (str) >= half_width)
x_pos = 1;
else
- x_pos = half_width - strlen (no_src_str);
- mvwaddstr (win_info->handle,
- (win_info->height / 2),
+ x_pos = half_width - strlen (str);
+ mvwaddstr (handle,
+ (height / 2),
x_pos,
- (char *) no_src_str);
-
- win_info->content.clear ();
- win_info->refresh_window ();
+ (char *) str);
- struct tui_gen_win_info *exec_info = win_info->execution_info;
+ content.clear ();
+ refresh_window ();
- werase (exec_info->handle);
- exec_info->refresh_window ();
+ werase (execution_info->handle);
+ execution_info->refresh_window ();
}
}
@@ -284,7 +276,7 @@ tui_source_window_base::show_source_content ()
tui_show_source_line (this, lineno);
}
else
- tui_erase_source_content (this);
+ erase_source_content ();
check_and_display_highlight_if_needed ();
refresh_window ();
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index bff2560..0443c4a 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -100,6 +100,9 @@ protected:
void do_scroll_horizontal (int num_to_scroll) override;
void do_make_visible_with_new_height () override;
+ /* Erase the content and display STRING. */
+ void do_erase_source_content (const char *string);
+
public:
void clear_detail ();
@@ -133,6 +136,9 @@ public:
virtual void maybe_update (struct frame_info *fi, symtab_and_line sal,
int line_no, CORE_ADDR addr) = 0;
+ /* Erase the source content. */
+ virtual void erase_source_content () = 0;
+
/* Does the locator belong to this window? */
bool m_has_locator = false;
/* Execution information window. */
@@ -182,7 +188,6 @@ extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
extern void tui_update_source_windows_with_line (struct symtab *,
int);
extern void tui_clear_source_content (struct tui_source_window_base *);
-extern void tui_erase_source_content (struct tui_source_window_base *);
/* Constant definitions. */
#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */