Don't track the contents of the execution info window

The curses library keeps track of the contents of each window, and can
redraw the screen as needed.  This means that in most cases is no need
for the TUI windows to also keep track of their contents.  This patch
removes content tracking from the execution window, leaving that to
curses.

gdb/ChangeLog
2019-08-13  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_exec_info_window)
	<~tui_exec_info_window, maybe_allocate_content, get_content,
	m_content>: Remove.
	(struct tui_source_window_base) <set_exec_info_content,
	show_exec_info_content>: Don't declare.
	* tui/tui-winsource.c
	(tui_exec_info_window::maybe_allocate_content): Remove.
	(tui_source_window_base::update_exec_info): Rename from
	set_exec_info_content.
	(tui_source_window_base::show_exec_info_content)
	(tui_source_window_base::update_exec_info): Remove.
This commit is contained in:
Tom Tromey 2019-07-06 08:10:50 -06:00
parent 93858ad34e
commit 5216580d7a
3 changed files with 22 additions and 70 deletions

View File

@ -1,3 +1,17 @@
2019-08-13 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_exec_info_window)
<~tui_exec_info_window, maybe_allocate_content, get_content,
m_content>: Remove.
(struct tui_source_window_base) <set_exec_info_content,
show_exec_info_content>: Don't declare.
* tui/tui-winsource.c
(tui_exec_info_window::maybe_allocate_content): Remove.
(tui_source_window_base::update_exec_info): Rename from
set_exec_info_content.
(tui_source_window_base::show_exec_info_content)
(tui_source_window_base::update_exec_info): Remove.
2019-08-13 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_clear_exec_info_content): Don't

View File

@ -587,41 +587,22 @@ tui_update_breakpoint_info (struct tui_source_window_base *win,
return need_refresh;
}
/* See tui-data.h. */
tui_exec_info_content *
tui_exec_info_window::maybe_allocate_content (int n_elements)
{
if (m_content == nullptr)
m_content = XNEWVEC (tui_exec_info_content, n_elements);
return m_content;
}
/* Function to initialize the content of the execution info window,
based upon the input window which is either the source or
disassembly window. */
void
tui_source_window_base::set_exec_info_content ()
tui_source_window_base::update_exec_info ()
{
tui_exec_info_content *exec_content
= execution_info->maybe_allocate_content (height);
werase (execution_info->handle);
tui_update_breakpoint_info (this, nullptr, true);
for (int i = 0; i < content.size (); i++)
{
tui_exec_info_content &element = exec_content[i];
struct tui_source_element *src_element;
tui_bp_flags mode;
src_element = &content[i];
memset (element, ' ', sizeof (tui_exec_info_content));
element[TUI_EXECINFO_SIZE - 1] = 0;
struct tui_source_element *src_element = &content[i];
char element[TUI_EXECINFO_SIZE] = " ";
/* Now update the exec info content based upon the state
of each line as indicated by the source content. */
mode = src_element->break_mode;
tui_bp_flags mode = src_element->break_mode;
if (mode & TUI_BP_HIT)
element[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))
@ -634,34 +615,13 @@ tui_source_window_base::set_exec_info_content ()
if (src_element->is_exec_point)
element[TUI_EXEC_POS] = '>';
mvwaddstr (execution_info->handle, i + 1, 0, element);
}
execution_info->refresh_window ();
}
void
tui_source_window_base::show_exec_info_content ()
{
struct tui_exec_info_window *exec_info = execution_info;
const tui_exec_info_content *exec_content = exec_info->get_content ();
werase (exec_info->handle);
for (int cur_line = 1; cur_line <= content.size (); cur_line++)
mvwaddstr (exec_info->handle,
cur_line,
0,
exec_content[cur_line - 1]);
exec_info->refresh_window ();
}
/* Function to update the execution info window. */
void
tui_source_window_base::update_exec_info ()
{
set_exec_info_content ();
show_exec_info_content ();
}
void
tui_alloc_source_buffer (struct tui_source_window_base *win_info)
{

View File

@ -52,24 +52,6 @@ struct tui_exec_info_window : public tui_gen_win_info
: tui_gen_win_info (EXEC_INFO_WIN)
{
}
~tui_exec_info_window () override
{
xfree (m_content);
}
/* Get or allocate contents. */
tui_exec_info_content *maybe_allocate_content (int n_elements);
/* Return the contents. */
const tui_exec_info_content *get_content () const
{
return m_content;
}
private:
tui_exec_info_content *m_content = nullptr;
};
/* Elements in the Source/Disassembly Window. */
@ -132,7 +114,6 @@ public:
void show_source_content ();
void set_exec_info_content ();
void update_exec_info ();
/* Does the locator belong to this window? */
@ -150,9 +131,6 @@ public:
struct gdbarch *gdbarch = nullptr;
std::vector<tui_source_element> content;
private:
void show_exec_info_content ();
};
/* Update the execution windows to show the active breakpoints. This