Commit Graph

98452 Commits

Author SHA1 Message Date
Tom Tromey 88f7e87336 Move tui_disasm_window to tui-disasm.h
This moves tui_disasm_window to tui-disasm.h.  In this case there were
no method definitions to be moved.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-disasm.h (struct tui_disasm_window): Move from
	tui-data.h.
	* tui/tui-data.h (struct tui_disasm_window): Move to
	tui-disasm.h.
2019-07-17 12:19:23 -06:00
Tom Tromey 96bd6233af Move TUI data item window to tui-regs.h
The TUI data item window is only used by the TUI register window.  So,
this patch moves the relevant code to tui-regs.[ch].

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (struct tui_data_item_window): Move from
	tui-data.h.
	* tui/tui-regs.c (tui_data_item_window): Move from tui-data.c.
	* tui/tui-data.h (struct tui_data_item_window): Move to
	tui-regs.h.
	* tui/tui-data.c (~tui_data_item_window): Move to tui-regs.c.
2019-07-17 12:19:23 -06:00
Tom Tromey ce38393b1a Move TUI command window code
Like the earlier change to the data window, this moves the TUI command
window code to tui-command.[ch], and removes the old "structuring"
comments from tui-command.c.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.c: Update.
	* tui/tui-win.c (tui_cmd_window::do_make_visible_with_new_height)
	(tui_cmd_window::max_height): Move to tui-command.c.
	* tui/tui-layout.c: Update.
	* tui/tui-data.h (struct tui_cmd_window): Move to tui-command.h.
	* tui/tui-data.c (tui_cmd_window::clear_detail): Move to
	tui-command.c.
	* tui/tui-command.h (struct tui_cmd_window): Move from
	tui-data.h.
	* tui/tui-command.c: Remove "structuring" comments.
	(tui_cmd_window::clear_detail)
	(tui_cmd_window::do_make_visible_with_new_height)
	(tui_cmd_window::max_height): Move from elsewhere.
2019-07-17 12:19:22 -06:00
Tom Tromey 2d8b51cba3 Move tui_dispatch_ctrl_char to tui-io.c
tui_dispatch_ctrl_char is only called from a single spot in tui-io.c,
so move the function to that file and make it static.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-io.c (tui_dispatch_ctrl_char): Move from tui-command.c.
	Now static.
	* tui/tui-command.h (tui_dispatch_ctrl_char): Don't declare.
	* tui/tui-command.c (tui_dispatch_ctrl_char): Move to tui-io.c.
2019-07-17 12:19:22 -06:00
Tom Tromey 18ab23af8b Rearrange TUI data window code
An earlier patch caused tui-windata.h to be essentially empty.  And,
other earlier patches implemented TUI data window methods in any spot
that happened to be convenient at the time.

This patch rearranges all the data window code to be somewhat more
organized.  It moves tui_data_window to tui-regs.h, and moves the
implementation of all methods to tui-regs.c.  It then removes
tui-windata.h and tui-windata.c.

It also removes the "structuring" comments from tui-regs.c; these are
not the usual gdb style, and were out of date anyhow.  Finally, it
moves _initialize_tui_regs to the end of the file, per the usual gdb
convention.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.c: Update.
	* tui/tui-wingeneral.c (tui_data_window::refresh_window): Move to
	tui-regs.c.
	* tui/tui-windata.h: Remove file.
	* tui/tui-windata.c: Remove file.
	* tui/tui-win.c (tui_data_window::set_new_height)
	(tui_data_window::do_make_visible_with_new_height): Move to
	tui-regs.c.
	* tui/tui-regs.h (struct tui_data_window): Move from tui-data.h.
	* tui/tui-regs.c: Remove "structuring" comments.
	(tui_data_window::first_data_item_displayed)
	(tui_data_window::delete_data_content_windows)
	(tui_data_window::erase_data_content)
	(tui_data_window::display_all_data)
	(tui_data_window::refresh_all)
	(tui_data_window::do_scroll_vertical)
	(tui_data_window::clear_detail, tui_data_window::set_new_height)
	(tui_data_window::do_make_visible_with_new_height)
	(tui_data_window::refresh_window): Move from elsewhere.
	(_initialize_tui_regs): Move to end of file.
	* tui/tui-layout.c: Update.
	* tui/tui-hooks.c: Update.
	* tui/tui-data.h (struct tui_data_window): Move to tui-regs.h.
	* tui/tui-data.c (tui_data_window::clear_detail): Move to
	tui-regs.c.
	* Makefile.in (SUBDIR_TUI_SRCS): Remove tui-windata.c.
2019-07-17 12:19:21 -06:00
Tom Tromey 88b7e7ccb9 Fix flushing bug in tui_puts_internal
A while back I changed gdb not to flush in some places.  It turned out
that this broke the TUI a little.  An easy way to see it is to run
"gdb -tui -nx", then "file gdb" at the gdb prompt.  gdb will print the
usual "Reading symbols..." message -- but it won't appear on-screen
until the reading is complete.

This patch changes the TUI to do the equivalent of line buffering in
tui_puts_internal.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-io.c (tui_puts_internal): Call wrefresh if newline is
	seen.
2019-07-17 12:19:20 -06:00
Tom Tromey 0fcd37117e Remove has_locator method
Earlier changes made it obvious that the has_locator method can only
be called for source/disassembly windows.  Because the only reference
to this now occurs in methods on this object, we can remove the
has_locator method entirely, in favor of using the member directly.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_source_window_base::set_new_height)
	(tui_source_window_base::do_make_visible_with_new_height): Use
	m_has_locator field directly.
	* tui/tui-data.h (struct tui_win_info) <has_locator>: Remove
	method.
	(struct tui_source_window_base) <has_locator>: Likewise.
2019-07-17 12:19:20 -06:00
Tom Tromey 4a38112da0 Remove tui_make_visible and tui_make_invisible
tui_make_visible and tui_make_invisible are just wrappers for a method
call, so remove them and have the callers simply make the method call
themselves.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_make_visible, tui_make_invisible):
	Don't declare.
	* tui/tui-wingeneral.c (tui_make_visible, tui_make_invisible):
	Remove.
	* tui/tui-win.c (tui_source_window_base::set_new_height)
	(tui_source_window_base::set_new_height)
	(make_invisible_and_set_new_height)
	(tui_source_window_base::do_make_visible_with_new_height)
	(tui_source_window_base::do_make_visible_with_new_height):
	Update.
	* tui/tui-layout.c (show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-layout.c (show_layout): Update.
2019-07-17 12:19:19 -06:00
Tom Tromey 0912922656 Remove make_data_window
As with the previous patches, unifying the creation and
re-initialization cases for the data window lets us remove
make_data_window in favor of simply using "new".

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (make_data_window): Remove.
	(show_data): Unify creation and re-initialization cases.
2019-07-17 12:19:19 -06:00
Tom Tromey 4a8a5e84a7 Remove make_source_window and make_disasm_window
This unifies the remaining creation and re-initialization cases for
the source and disassembly windows.  Once this is done, it's clear
that make_source_window and make_disasm_window aren't needed any more,
so remove them.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (make_source_window, make_disasm_window):
	Remove.
	(show_data): Unify creation and re-initialization cases.
2019-07-17 12:19:18 -06:00
Tom Tromey 76d2be8e92 Remove make_command_window
This unifies the creation and re-initialization cases for the command
window.  When this is done, it becomes clear that make_command_window
isn't needed -- it can be replaced with a simple "new", so this is
removed as well.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (make_command_window): Remove.
	(show_source_disasm_command, show_source_or_disasm_and_command):
	Unify creation and re-initialization cases.
2019-07-17 12:19:18 -06:00
Tom Tromey 890b8bde7a Simplify show_source_or_disasm_and_command
This changes show_source_or_disasm_and_command to unify the creation
and re-initialization cases.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_or_disasm_and_command): Unify
	creation and re-initialization cases.
2019-07-17 12:19:17 -06:00
Tom Tromey 2cdfa11333 Change tui_get_register to return void
tui_get_register returns a tui_status, but nothing checks this, so it
can return void instead.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_get_register): Return void.
2019-07-17 12:19:17 -06:00
Tom Tromey 8e3cfd09e8 Simplify tui_gen_win_info::make_visible
I noticed that tui_gen_win_info::make_visible was much wordier than it
needed to be.  This simplifies it.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (tui_gen_win_info::make_visible):
	Simplify.
2019-07-17 12:19:16 -06:00
Tom Tromey f4e049775a Simplify show_source_disasm_command
This is the first of a few patches to further simplify window
(re-)initialization in tui-layout.c.  When changing the layout, a
window may be created or, if it already exists, simply resized.  These
two cases normally are identical, but this was obscured by the way the
code was written.  This patch changes show_source_disasm_command to
unify the creation and re-initialization cases.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_disasm_command): Simplify window
	resetting.
2019-07-17 12:19:16 -06:00
Tom Tromey 0379b8837a Clean up tui_layout_command
tui_layout_command is a simple wrapper for tui_set_layout_by_name.
This removes the extra layer and cleans up the resulting function a
bit -- changing it to call error rather than return a result.  This
necessitated a small change to tui-regs.c, to avoid calling the
function that is being removed.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.h (tui_set_layout_by_name): Don't declare.
	* tui/tui-regs.c (tui_reg_layout): New function.
	(tui_show_registers, tui_reg_command): Use it.
	* tui/tui-layout.c (LAYOUT_USAGE): Remove.
	(tui_layout_command): Rename from tui_set_layout_by_name.  Change
	parameters.
	(tui_layout_command): Remove.
2019-07-17 12:19:15 -06:00
Tom Tromey b7fbad913e Change tui_set_layout to return void
tui_set_layout can't meaningfully be called with UNDEFINED_LAYOUT; and
instead of trying to handle this case, simply assert and have the
function return void.  No caller was checking the return value anyway.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.h (tui/tui-layout): Return void.
	* tui/tui-layout.c (tui_set_layout): Return void.  Add assert.
2019-07-17 12:19:15 -06:00
Tom Tromey 4e1e56b981 Remove reset_locator
reset_locator was introduced just a few patches ago, but it's already
time to remove it.  It consists of a call to the locator's "reset"
method, plus a call to tui_make_window; but the latter is redundant at
all the places that call reset_locator.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_disasm_command, show_data):
	Update.
	(reset_locator): Remove.
	(show_source_or_disasm_and_command): Update.
2019-07-17 12:19:14 -06:00
Tom Tromey 1e0c09ba0b Remove the win_type parameter from tui_gen_win_info::reset
tui_gen_win_info::reset has a window type parameter that is only used
for an assertion.  This made sense as a defensive measure when window
creation was more dynamic -- it ensured that one did not make
mistakes.  However, there's no need for it any more, so this removes
it.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-source.c (tui_source_window_base::reset): Remove
	win_type parameter.
	* tui/tui-layout.c (make_command_window, make_source_window)
	(make_disasm_window, make_data_window)
	(show_source_disasm_command, show_data, tui_gen_win_info::reset)
	(reset_locator, show_source_or_disasm_and_command): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <reset>: Remove
	win_type parameter.
	(struct tui_source_window_base) <reset>: Likewise.
2019-07-17 12:19:13 -06:00
Tom Tromey 1bf605de8e Introduce reset_locator function in tui-layout.c
init_and_make_win in tui-layout.c is now only called for the locator
-- earlier changes have made most of the cases here obsolete.  This
patch removes init_and_make_win and introduces a reset_locator
function.  Window creation is now much simpler to follow, because it
is no longer quite so dynamic.  (Though it will become even simpler in
coming patches.)

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (show_source_disasm_command): Use
	reset_locator.
	(reset_locator): New function.
	(init_and_make_win): Remove.
	(show_source_or_disasm_and_command): Use reset_locator.
2019-07-17 12:19:13 -06:00
Tom Tromey 098f9ed48e Always create an execution info window for a source window
A source or disassembly window will always have an "execution info"
window (the window along the side that displays breakpoint info), but
this isn't immediately clear from the source.  As a result, some code
has checks to see whether the execution_info is NULL.

This changes the source window base class to always instantiate an
execution_info window, then updates the rest of the code.  It also
simplifies window creation in tui-layout.c.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_set_exec_info_content): Remove
	condition.
	* tui/tui-wingeneral.c (tui_source_window_base::make_visible):
	Remove condition.
	* tui/tui-source.c (tui_source_window_base::reset): New method.
	* tui/tui-layout.c (make_command_window): Don't call
	init_and_make_win.
	(make_source_window, make_disasm_window): Don't call
	make_source_or_disasm_window.
	(make_data_window): Don't call init_and_make_win.  Change calling
	convention.
	(show_source_disasm_command, show_data): Simplify.
	(make_source_or_disasm_window): Remove.
	(show_source_or_disasm_and_command): Simplify.
	* tui/tui-data.h (struct tui_gen_win_info) <reset>: Now virtual.
	(struct tui_source_window_base) <reset>: Likewise.
	<execution_info>: Remove initializer.
	* tui/tui-data.c (tui_source_window_base): Initialize
	execution_info.
2019-07-17 12:19:12 -06:00
Tom Tromey 801109578c Remove some dead code from tui_set_layout
tui_set_layout sets regs_populate using:

      regs_populate = (new_layout == SRC_DATA_COMMAND
		       || new_layout == DISASSEM_DATA_COMMAND);

Then later it checks this variable:

	  if (!regs_populate
	      && (new_layout == SRC_DATA_COMMAND
		  || new_layout == DISASSEM_DATA_COMMAND))

However, this is equivalent to "!regs_populate && regs_populate",
which can never be true.  So, remove the dead code and the variable.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-layout.c (tui_set_layout): Remove regs_populate
	variable.
2019-07-17 12:19:12 -06:00
Tom Tromey cf82af058d Remove TUI data window special case
The TUI has a couple of special cases for updating the data window:
one in tui_rl_other_windowand one in tui_set_focus_command.  As part
of the project to remove references to globals, I wanted to remove
these calls; but when I did, some simple operations (like "C-x o")
would cause the register window to blank.

This fixes the underlying problem by arranging for the data window's
refresh_window method to call the superclass method first, and then to
refresh the child windows.  Then the special cases can be removed.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_rl_other_window): Update.
	* tui/tui-wingeneral.c (tui_data_window::refresh_window): Call
	superclass method first.  Always iterate over regs_content.
	(tui_unhighlight_win, tui_highlight_win): Use refresh_window
	method.
	* tui/tui-win.c (tui_set_focus_command): Update.
2019-07-17 12:19:11 -06:00
Tom Tromey 01aeb396d0 Remove tui_set_focus
tui_set_focus_command is a simple wrapper for tui_set_focus, so rename
the latter and remove the wrapper function.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_set_focus_command): Rename from
	tui_set_focus.  Call tui_enable.
	(tui_set_focus_command): Remove.
2019-07-17 12:19:10 -06:00
Tom Tromey fd6c75eecd Merge refresh and refresh_window methods
Earlier refactorings introduced the refresh and refresh_window
methods, following the previous TUI code.  However, these methods are
essentially the same, so this patch merges them.  It also removes some
redundant refresh_window calls, because the execution window is
updated automatically by the corresponding source (or disassembly)
window.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_show_exec_info_content): Don't call
	refresh_window.
	* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Call
	touchwin.
	(tui_data_window::refresh_window): Call refresh_window on data
	items.  Always call superclass refresh_window.
	(tui_win_info::refresh): Remove.
	(tui_source_window_base::refresh_window): Update.
	(tui_refresh_all): Update.
	* tui/tui-layout.c (show_source_disasm_command): Remove call to
	refresh_window.
	(show_source_or_disasm_and_command): Likewise.
	* tui/tui-data.h (struct tui_win_info) <refresh>: Remove.
	(struct tui_source_window_base) <refresh>: Likewise.
2019-07-17 12:19:10 -06:00
Tom Tromey f6cc34a91c Remove tui_source_window::content_in_use
Now that source window clearing has been simplified, we don't need a
special flag to say whether the source window is in use -- we can
simply check whether the contents are set.  This patch implements this
idea, removing the content_in_use field.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_clear_source_content)
	(tui_show_source_content): Update.
	* tui/tui-source.c (tui_source_window::showing_source_p): Check
	whether content is empty.
	* tui/tui-data.h (struct tui_source_window_base) <content_in_use>:
	Remove.
2019-07-17 12:19:09 -06:00
Tom Tromey f31ec9af48 Simplify source window clearing
When a TUI source window is empty, it displays a "No Source Available"
message.  The function tui_set_source_content_nil also made sure to
put this message into the window's "content" field.

However, I believe this isn't really necessary.  Instead, it's simpler
to just empty the contents and let curses handle the refreshing.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_erase_source_content): Clear the
	window's contents.
	* tui/tui-source.h (tui_set_source_content_nil): Don't declare.
	* tui/tui-source.c (tui_set_source_content_nil): Remove.
2019-07-17 12:19:09 -06:00
Tom Tromey d1b6f1e5eb Remove UNDEFINED_ITEM define from TUI
The TUI defined UNDEFINED_ITEM, but only used it in a single spot.  I
think this isn't very useful, so this removes the define.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (UNDEFINED_ITEM): Remove define.
	(struct tui_data_item_window): Update.
2019-07-17 12:19:08 -06:00
Tom Tromey d9743a13e0 Remove unused TUI defines
This removes some #defines that were unused in the TUI.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (MAX_CONTENT_COUNT, TUI_NULL_STR)
	(DEFAULT_HISTORY_COUNT, WITH_LOCATOR, NO_LOCATOR): Remove
	defines.
2019-07-17 12:19:07 -06:00
Tom Tromey caf0bc4e8b Remove unused parameter from two TUI functions
The "display_prompt" parameter of tui_erase_source_content and
tui_clear_source_content was never passed the NO_EMPTY_SOURCE_PROMPT
value, so remove the parameter.  Once this is done, the
EMPTY_SOURCE_PROMPT and NO_EMPTY_SOURCE_PROMPT defines are unused, so
remove those as well.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_erase_source_content)
	(tui_clear_source_content): Remove "display_prompt" parameter.
	* tui/tui-winsource.c (tui_update_source_window_as_is)
	(tui_update_source_windows_with_addr): Update.
	(tui_clear_source_content): Remove "display_prompt" parameter.
	(tui_erase_source_content): Likewise.  Simplify.
	(tui_show_source_content): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
	* tui/tui-stack.c (tui_show_frame_info): Update.
	* tui/tui-data.h (EMPTY_SOURCE_PROMPT, NO_EMPTY_SOURCE_PROMPT):
	Remove defines.
2019-07-17 12:19:07 -06:00
Tom Tromey 9d391078d1 Add win_info parameter to tui_set_disassem_content
This adds a win_info parameter to tui_set_disassem_content, removing
uses of the TUI_DISASM_WIN global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_window_as_is): Update.
	* tui/tui-disasm.h (tui_set_disassem_content): Add win_info
	parameter.
	* tui/tui-disasm.c (tui_set_disassem_content): Add win_info
	parameter.
2019-07-17 12:19:06 -06:00
Tom Tromey a38da35d7b Move content_in_use to tui_source_window class
From scanning the source now, it's clear that the content_in_use field
is only used for the source window.  This patch moves the field there,
and changes it to be a bool at the same time.  (A future patch will
clean this up further, removing the field entirely.)

gdb/ChangeLog
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 12:19:06 -06:00
Tom Tromey c2cd899466 Introduce tui_source_window_base::location_matches_p method
This introduces the location_matches_p method, removing a spot that
explicitly examines a window's type.

gdb/ChangeLog
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 12:19:05 -06:00
Tom Tromey 4dde7b34f4 Remove tui_set_win_height
tui_set_win_height_command is just a simple wrapper for
tui_set_win_height, so rename the latter and remove the wrapper.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_set_win_height_command): Rename from
	tui_set_win_height.
	(tui_set_win_height_command): Remove.
2019-07-17 12:19:04 -06:00
Tom Tromey b73dd8779c Make source windows be self-updating
This changes the TUI source window to register itself on the
source_styling_changed observable, and removes a bit of code from
tui-hooks.c.  This reduces the number of uses of the TUI_SRC_WIN
global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-source.c (tui_source_window): New constructor.  Add
	observer.
	(~tui_source_window): New destructor.
	(tui_source_window::style_changed): New method.
	* tui/tui-hooks.c (tui_redisplay_source): Remove.
	(tui_attach_detach_observers): Update.
	* tui/tui-data.h (struct tui_source_window): Make constructor not
	inline.  Add destructor.
	(struct tui_source_window) <style_changed>: New method.
	<m_observable>: New member.
2019-07-17 12:19:04 -06:00
Tom Tromey ae2b53806d Fix comment typos
This fixes a couple of comment typos that I noticed.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.c (tui_clear_source_windows_detail): Fix typo.
	* tui/tui-win.c (tui_resize_all): Fix typo.
2019-07-17 12:19:03 -06:00
Tom Tromey 1ce3e8442e Introduce TUI window iterator
This introduces an iterator class and a range adapter to make it
simpler to iterate over TUI windows.

One explicit iteration remains, in tui-win.c, because that spot is
deleting windows as well.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_refresh_all): Update.
	* tui/tui-wingeneral.c (make_all_visible): Use foreach.
	(tui_refresh_all): Remove "list" parameter.  Use foreach.
	* tui/tui-win.c (window_name_completer): Use foreach.
	(tui_refresh_all_win, tui_rehighlight_all, tui_all_windows_info)
	(update_tab_width): Likewise.
	* tui/tui-layout.c (show_layout): Update.
	* tui/tui-data.h (class tui_window_iterator): New.
	(struct all_tui_windows): New.
	* tui/tui-data.c (tui_partial_win_by_name): Use foreach.
2019-07-17 12:19:03 -06:00
Tom Tromey fe3eaf1cd9 Minor tui_reg_next / tui_reg_prev cleanup
This changes tui_reg_next and tui_reg_prev so that they don't need to
reference the TUI_DATA_WIN globals.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_reg_next, tui_reg_prev): Add "current_group"
	parameter.  Don't reference globals.
	(tui_reg_command): Update.
2019-07-17 12:19:02 -06:00
Tom Tromey 368c1354e5 Simplify tui_show_registers
tui_show_registers keeps a local status variable, but it is not
actually needed.  This rearranges the function to remove the variable.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_show_registers): Simplify.
2019-07-17 12:19:01 -06:00
Tom Tromey e80cd20470 Parameterize tui_show_register_group with window
This changes tui_show_register_group not to reference the TUI_DATA_WIN
global, instead leaving that to its caller.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_show_registers): Update.
	(tui_show_register_group): Add win_info parameter.
2019-07-17 12:19:01 -06:00
Tom Tromey aca2dd1647 Introduce tui_data_window::display_reg_element_at_line method
This changes tui_display_reg_element_at_line to be a method on
tui_data_window, allowing for the removal of some uses of the
TUI_DATA_WIN global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_data_window::display_reg_element_at_line):
	Rename from tui_display_reg_element_at_line.
	(tui_data_window::display_registers_from_line): Update.
	* tui/tui-data.h (struct tui_data_window)
	<display_reg_element_at_line>: New method.
2019-07-17 12:19:00 -06:00
Tom Tromey 517e9505fa Introduce two more tui_data_window methods
This changes tui_display_registers_from and
tui_display_registers_from_line to be methods on tui_data_window,
allowing for the removal of more uses of the TUI_DATA_WIN global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (tui_display_registers_from)
	(tui_display_registers_from_line): Don't declare.
	* tui/tui-windata.c (tui_data_window::display_all_data)
	(tui_data_window::refresh_all)
	(tui_data_window::do_scroll_vertical): Update.
	* tui/tui-regs.c (tui_data_window::display_registers_from): Rename
	from tui_display_registers_from.
	(tui_display_reg_element_at_line): Update.
	(tui_data_window::display_registers_from_line): Rename from
	tui_display_registers_from_line.
	* tui/tui-data.h (struct tui_data_window) <display_registers_from,
	display_registers_from_line>: New methods.
2019-07-17 12:18:59 -06:00
Tom Tromey f76d8b19e8 Introduce tui_data_window::erase_data_content method
This changes tui_erase_data_content to be a method on tui_data_window,
allowing for the removal of some uses of the TUI_DATA_WIN global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.h (tui_erase_data_content): Don't declare.
	* tui/tui-windata.c (tui_data_window::erase_data_content): Rename
	from tui_erase_data_content.
	(tui_data_window::display_all_data)
	(tui_data_window::refresh_all)
	(tui_data_window::do_scroll_vertical): Update.
	* tui/tui-regs.c (tui_show_registers): Update.
	* tui/tui-data.h (struct tui_data_window) <erase_data_content>:
	New method.
2019-07-17 12:18:59 -06:00
Tom Tromey b4094625d8 Introduce tui_data_window::delete_data_content_windows method
This changes tui_delete_data_content_windows to be a method on
tui_data_window, removing some uses of the TUI_DATA_WIN global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.h (tui_delete_data_content_windows): Don't
	declare.
	* tui/tui-windata.c
	(tui_data_window::delete_data_content_windows): Rename from
	tui_delete_data_content_windows.
	(tui_data_window::display_all_data)
	(tui_data_window::do_scroll_vertical): Update.
	* tui/tui-data.h (struct tui_data_window)
	<delete_data_content_windows>: New method.
2019-07-17 12:18:58 -06:00
Tom Tromey c223a7299e Don't declare unimplemented functions
A couple of functions were declared but never defined.  This removes
the declarations.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.h (tui_refresh_data_win): Don't declare.
	* tui/tui-regs.h (tui_first_reg_element_inline): Don't declare.
2019-07-17 12:18:58 -06:00
Tom Tromey 50daf2683b Introduce tui_data_window::display_all_data method
This changes tui_display_all_data to be a method on tui_data_window.
This helps cluster uses of the TUI_DATA_WIN global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.h (tui_display_all_data): Don't declare.
	* tui/tui-windata.c (tui_data_window::display_all_data): Rename
	from tui_display_all_data.
	* tui/tui-win.c
	(tui_data_window::do_make_visible_with_new_height): Update.
	* tui/tui-regs.c (tui_show_registers): Update.
	* tui/tui-layout.c (tui_set_layout): Update.
	* tui/tui-data.h (struct tui_data_window) <display_all_data>: New
	method.
2019-07-17 12:18:57 -06:00
Tom Tromey df5f8cab00 Remove tui_display_data_from
tui_display_data_from is only called from a single place.  Inlining it
there lets us remove some uses of the TUI_DATA_WIN global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.h (tui_display_data_from): Don't declare.
	* tui/tui-windata.c (tui_display_data_from): Remove.
	(tui_data_window::refresh_all): Update.
2019-07-17 12:18:57 -06:00
Tom Tromey 80cb6c2709 Remove tui_display_data_from_line
tui_display_data_from_line is just a wrapper for
tui_display_registers_from_line, so remove it.  Also, nothing passed 0
as the "force_display" parameter to tui_display_registers_from_line,
so remove that parameter as well.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.h (tui_display_data_from_line): Don't declare.
	* tui/tui-windata.c (tui_display_data_from_line): Remove.
	(tui_display_data_from, tui_data_window::do_scroll_vertical): Call
	tui_display_registers_from_line.
	* tui/tui-regs.h (tui_display_registers_from_line): Update.
	* tui/tui-regs.c (tui_display_registers_from_line): Remove
	"force_display" parameter.
2019-07-17 12:18:54 -06:00
Tom Tromey baff0c28b8 Introduce tui_data_window::first_reg_element_no_inline
This changes tui_first_reg_element_no_inline to be a method on
tui_data_window.  This again moves uses of the TUI_DATA_WIN global
from this function into other functions that are already using the
global.

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.h (tui_first_reg_element_no_inline): Don't
	declare.
	* tui/tui-regs.c (tui_data_window::first_reg_element_no_inline):
	Rename from tui_first_reg_element_no_inline.
	(tui_display_reg_element_at_line)
	(tui_display_registers_from_line): Update.
	* tui/tui-data.h (struct tui_data_window)
	<first_reg_element_no_inline>: New method.
2019-07-17 12:18:54 -06:00
Tom Tromey 3b23c5f266 Introduce tui_data_window::line_from_reg_element_no method
This changes tui_line_from_reg_element_no to be a method on
tui_data_window, allowing for the removal of some uses of the
TUI_DATA_WIN global.  (Actually, in this particular patch, the number
of uses is not decreased, but rather the uses are moved to spots that
are already using the global, i.e., increasing the clustering.)

gdb/ChangeLog
2019-07-17  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.c (tui_display_data_from)
	(tui_data_window::do_scroll_vertical): Update.
	* tui/tui-regs.h (tui_line_from_reg_element_no): Don't declare.
	* tui/tui-regs.c (tui_data_window::line_from_reg_element_no):
	Rename from tui_line_from_reg_element_no.
	(tui_display_registers_from_line): Update.
	* tui/tui-data.h (struct tui_data_window)
	<line_from_reg_element_no>: New method.
2019-07-17 12:18:53 -06:00