aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-07-06 08:10:50 -0600
committerTom Tromey <tom@tromey.com>2019-08-13 14:52:10 -0600
commit5216580d7a1134a9349ec045b475f5b40f499e5e (patch)
tree4c6a230c52ac2e2344d1d004ad0a1aa688fdb5d5 /gdb/tui
parent93858ad34ec1d2250d33365468c6721023786f51 (diff)
downloadgdb-5216580d7a1134a9349ec045b475f5b40f499e5e.zip
gdb-5216580d7a1134a9349ec045b475f5b40f499e5e.tar.gz
gdb-5216580d7a1134a9349ec045b475f5b40f499e5e.tar.bz2
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.
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-winsource.c56
-rw-r--r--gdb/tui/tui-winsource.h22
2 files changed, 8 insertions, 70 deletions
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 2f02c6a..1b2b439 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -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] = '>';
- }
-}
-
-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 ();
+ mvwaddstr (execution_info->handle, i + 1, 0, element);
+ }
+ execution_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)
{
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index e0a96c1..abb7ea3 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -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