Commit Graph

174 Commits

Author SHA1 Message Date
Tom Tromey 3b0fb49e30 Fix cast in TUI_DISASM_WIN
I noticed that the TUI_DISASM_WIN macro cast the disassembly window to
a base type, rather than its correct type.  This patch fixes this
oversight.

2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (TUI_DISASM_WIN): Cast to tui_disasm_window.

Change-Id: Ied3dbac9ef3dc48ceb9e0850fe4ada3c316dd769
2020-02-22 12:57:25 -07:00
Tom Tromey 935c78c046 Remove tui_set_win_with_focus
I noticed that the TUI had two functions with similar names:
tui_set_win_focus_to and tui_set_win_with_focus.

However, one was just an implementation detail of the latter.  So,
this patch removes tui_set_win_with_focus entirely, to avoid any
temptation to call it.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
	* tui/tui-data.h (tui_set_win_with_focus): Don't declare.
	* tui/tui-data.c (tui_set_win_with_focus): Remove.
	(tui_set_win_focus_to): Move from tui-win.c.

Change-Id: Idffddab773436bdf80d55480906d76b292981ef2
2020-02-22 11:48:38 -07:00
Tom Tromey fdb01f0ce4 TUI windows do not need to store their type
TUI windows no longer need to store their type -- there's only a
single spot that uses this information, and it can be changed to use
dynamic_cast.  (It could be cleaned up even more, by using a virtual
method, but I haven't done so.)  This patch removes the "type" field
from tui_gen_win_info, and this in turn allows removing a couple of
enumerator constants.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui.h (enum tui_win_type) <LOCATOR_WIN, DATA_ITEM_WIN>:
	Remove constants.
	* tui/tui-winsource.h (struct tui_source_window_base)
	<tui_source_window_base>: Remove parameter.
	* tui/tui-winsource.c
	(tui_source_window_base::tui_source_window_base): Remove
	parameter.
	(tui_source_window_base::refill): Update.
	* tui/tui-stack.h (struct tui_locator_window)
	<tui_locator_window>: Update.
	* tui/tui-source.h (struct tui_source_window) <tui_source_window>:
	Default the constructor.
	* tui/tui-regs.h (struct tui_data_item_window)
	<tui_data_item_window>: Default the constructor.
	(struct tui_data_window) <tui_data_window>: Likewise.
	* tui/tui-disasm.h (struct tui_disasm_window) <tui_disasm_window>:
	Default the constructor.
	* tui/tui-data.h (struct tui_gen_win_info) <tui_gen_win_info>:
	Default the constructor.
	<type>: Remove.
	(struct tui_win_info) <tui_win_info>: Default the constructor.
	* tui/tui-data.c (tui_win_info::tui_win_info): Remove.
	* tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>:
	Default the constructor.

Change-Id: I594cd07d2e0bba71ad594a6fb263904ce2febcd6
2020-02-22 11:48:37 -07:00
Tom Tromey 865a5aec04 Remove tui_delete_invisible_windows and tui_make_all_invisible
tui_delete_invisible_windows is only needed after applying a layout,
and tui_make_all_invisible is only needed before applying a layout.

This patch removes these functions, in favor of doing this management
directly in tui_apply_current_layout.  This is needed so that the
lifetimes of non-built-in windows will be properly managed.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_make_all_invisible): Don't declare.
	* tui/tui-wingeneral.c (tui_make_all_invisible): Remove.
	* tui/tui-win.c (tui_resize_all): Don't call
	tui_delete_invisible_windows.
	* tui/tui-layout.c (tui_apply_current_layout): Delete windows when
	done.
	(tui_set_layout): Update.
	(tui_add_win_to_layout): Don't call tui_delete_invisible_windows.
	* tui/tui-data.h (tui_delete_invisible_windows): Don't declare.
	* tui/tui-data.c (tui_delete_invisible_windows): Remove.

Change-Id: Ia3603b021dcb7ec31700a4a32640cd09b00b8f3b
2020-02-22 11:48:37 -07:00
Tom Tromey 7eed1a8e83 Change TUI window iteration
This changes the TUI to track all the instantiated windows in a new
global vector.  After this, iteration over TUI windows is done by
simply iterating over this vector.

This approach makes it simpler to define new window types.  In
particular, a subsequent patch will add the ability to define a TUI
window from Python.

Note that this series will not remove tui_win_list.  This will
continue to exist in parallel, only because it was simpler to leave
this alone.  Perhaps it could still be removed in the future.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_iterator)
	<inner_iterator>: New etytypedef.
	<tui_source_window_iterator>: Take "end" parameter.
	<tui_source_window_iterator>: Take iterator.
	<operator*, advance>: Update.
	<m_iter>: Change type.
	<m_end>: New field.
	(struct tui_source_windows) <begin, end>: Update.
	* tui/tui-layout.c (tui_windows): New global.
	(tui_apply_current_layout): Clear tui_windows.
	(tui_layout_window::apply): Update tui_windows.
	* tui/tui-data.h (tui_windows): Declare.
	(all_tui_windows): Now inline function.
	(class tui_window_iterator, struct all_tui_windows): Remove.

Change-Id: I6ab77976d6326f427178f725434f8f82046e0bbf
2020-02-22 11:48:34 -07:00
Tom Tromey 7c043ba695 Add horizontal splitting to TUI layout
This changes the TUI layout engine to add horizontal splitting.  Now,
windows can be side-by-side.

A horizontal split is defined using the "-horizontal" parameter to
"tui new-layout".

This also adds the first "winheight" test to the test suite.  One open
question is whether we want a new "winwidth" command, now that
horizontal layouts are possible.  This is easily done using the
generic layout code.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	PR tui/17850:
	* tui/tui-win.c (tui_gen_win_info::max_width): New method.
	* tui/tui-layout.h (class tui_layout_base) <get_sizes>: Add
	"height" argument.
	(class tui_layout_window) <get_sizes>: Likewise.
	(class tui_layout_split) <tui_layout_split>: Add "vertical"
	argument.
	<get_sizes>: Add "height" argument.
	<m_vertical>: New field.
	* tui/tui-layout.c (tui_layout_split::clone): Update.
	(tui_layout_split::get_sizes): Add "height" argument.
	(tui_layout_split::adjust_size, tui_layout_split::apply): Update.
	(tui_new_layout_command): Parse "-horizontal".
	(_initialize_tui_layout): Update help string.
	(tui_layout_split::specification): Add "-horizontal" when needed.
	* tui/tui-layout.c (tui_layout_window::get_sizes): Add "height"
	argument.
	* tui/tui-data.h (struct tui_gen_win_info) <max_width, min_width>:
	New methods.

gdb/doc/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	PR tui/17850:
	* gdb.texinfo (TUI Commands): Document horizontal layouts.

gdb/testsuite/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	PR tui/17850:
	* gdb.tui/new-layout.exp: Add horizontal layout and winheight
	tests.

Change-Id: I38b35e504f34698578af86686be03c0fefd954ae
2020-02-22 11:48:33 -07:00
Tom Tromey 416eb92d84 Remove hard-coded TUI layouts
This changes the TUI so that the available layouts are no longer
completely hard-coded.  "enum tui_layout_type" is removed, and then
all the fallout from this is fixed up.

This patch also reimplements the "layout" command to be a prefix
command.  The concrete layouts are simply sub-commands now.  This
provides completion and correct abbreviation behavior for free.

Finally, this also changes the name of the locator window to "status".
This matches the documentation and will be exposed to the user in a
subsequent patch.

gdb/ChangeLog
2020-02-22  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_enable): Call tui_set_initial_layout.
	* tui/tui-win.c (window_name_completer): Update comment.
	* tui/tui-layout.h (class tui_layout_base) <replace_window>:
	Declare method.
	(class tui_layout_window) <replace_window>: Likewise.
	(class tui_layout_split) <replace_window>: Likewise.
	(tui_set_layout): Don't declare.
	(tui_set_initial_layout): Declare function.
	* tui/tui-layout.c (layouts, applied_skeleton, src_regs_layout)
	(asm_regs_layout): New globals.
	(tui_current_layout, show_layout): Remove.
	(tui_set_layout, tui_add_win_to_layout): Rewrite.
	(find_layout, tui_apply_layout): New function.
	(layout_completer): Remove.
	(tui_next_layout): Reimplement.
	(tui_next_layout_command): New function.
	(tui_set_initial_layout, tui_prev_layout_command): New functions.
	(tui_regs_layout): Reimplement.
	(tui_regs_layout_command): New function.
	(extract_display_start_addr): Rewrite.
	(next_layout, prev_layout): Remove.
	(tui_layout_window::replace_window): New method.
	(tui_layout_split::replace_window): New method.
	(destroy_layout): New function.
	(layout_list): New global.
	(add_layout_command): New function.
	(initialize_layouts): Update.
	(tui_layout_command): New function.
	(_initialize_tui_layout): Install "layout" commands.
	* tui/tui-data.h (enum tui_layout_type): Remove.
	(tui_current_layout): Don't declare.

Change-Id: I9b5f7ab3ce838d6b340b8c373ef649a8e0a74b73
2020-02-22 11:48:30 -07:00
Tom Tromey 45bbae5c4b Remove flickering from the TUI
In some cases, the TUI flickers when redrawing.  This can be seen
mostly easily when switching layouts.

This patch fixes the problem by exploiting the double buffering that
curses already does.  In some spots, the TUI will now disable flushing
the curses buffers to the screen; and then flush them all at once when
the rendering is complete.

gdb/ChangeLog
2020-01-19  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_show_assembly): Use tui_suppress_output.
	* tui/tui-wingeneral.h (class tui_suppress_output): New.
	(tui_wrefresh): Declare.
	* tui/tui-wingeneral.c (suppress_output): New global.
	(tui_suppress_output, ~tui_suppress_output): New constructor and
	destructor.
	(tui_wrefresh): New function.
	(tui_gen_win_info::refresh_window): Use tui_wrefresh.
	(tui_gen_win_info::make_window): Call wnoutrefresh when needed.
	* tui/tui-regs.h (struct tui_data_window) <no_refresh>: Declare
	method.
	* tui/tui-regs.c (tui_data_window::erase_data_content): Call
	tui_wrefresh.
	(tui_data_window::no_refresh): New method.
	(tui_data_item_window::refresh_window): Call tui_wrefresh.
	(tui_reg_command): Use tui_suppress_output
	* tui/tui-layout.c (tui_set_layout): Use tui_suppress_output.
	* tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: New
	method.
	* tui/tui-command.c (tui_refresh_cmd_win): Call tui_wrefresh.

Change-Id: Icb832ae100b861de3af3307488e636fa928d5c9f
2020-01-19 13:08:49 -07:00
Joel Brobecker b811d2c292 Update copyright year range in all GDB files.
gdb/ChangeLog:

        Update copyright year range in all GDB files.
2020-01-01 10:20:53 +04:00
Tom Tromey 1630140dc6 Remove tui_gen_win_info::viewport_height
tui_gen_win_info::viewport_height is only used in a couple of spots,
and is redundant with "height".  This patch removes viewport_height.

gdb/ChangeLog
2019-12-27  Tom Tromey  <tom@tromey.com>

	* tui/tui-source.c (tui_source_window::maybe_update): Update.
	* tui/tui-regs.c (tui_data_window::display_registers_from):
	Update.
	* tui/tui-layout.c (tui_gen_win_info::resize): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <viewport_height>:
	Remove.
	* tui/tui-command.c (tui_cmd_window::resize): Update.

Change-Id: I020e026fbe289adda8e2fdfebca91bdbdbc312e8
2019-12-27 09:33:36 -07:00
Tom Tromey fb3184d8ee Remove struct tui_point
struct tui_point does not help very much.  It is only used for
storage, and never passed between functions.  I think it makes the
code more verbose without any corresponding benefit, so this patch
removes it.

gdb/ChangeLog
2019-12-11  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (tui_gen_win_info::make_window): Update.
	* tui/tui-win.c (tui_adjust_win_heights, tui_resize_all): Update.
	* tui/tui-layout.c (tui_gen_win_info::resize): Update.
	* tui/tui-data.h (struct tui_point): Remove.
	(struct tui_gen_win_info) <origin>: Remove.
	<x, y>: New fields.
	* tui/tui-command.c (tui_cmd_window::resize): Update.

Change-Id: I3f77920585b9ea9e2b4b189f3f3ae32d4da0c252
2019-12-11 15:49:01 -07:00
Tom Tromey dc7ff8a608 Introduce the tui_gen_win_info::min_height method
This introduces a new method, tui_gen_win_info::min_height, to fetch
the minimum height of a window.  This is used in the subsequent
unified layout patch.

gdb/ChangeLog
2019-12-11  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.h (struct tui_locator_window) <min_height>:
	Implement.
	* tui/tui-regs.h (struct tui_data_item_window) <min_height>:
	Implement.
	* tui/tui-data.h (struct tui_gen_win_info) <min_height>: New
	method.
	(struct tui_win_info) <min_height>: Implement.

Change-Id: Id33baffdf041fde072e15c1ff89b75f8b8118adb
2019-12-11 15:49:00 -07:00
Tom Tromey 1431937bee Move can_box to tui_gen_win_info
This moves the can_box method to tui_gen_win_info, so that it will be
available on the tui_locator_window class.  This will be used in a
subsequent patch.

gdb/ChangeLog
2019-12-11  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method.
	(struct tui_win_info) <can_box>: Update.

Change-Id: Idfa58af41341607932d3c39415f6a35ee9b5d3dc
2019-12-11 15:49:00 -07:00
Tom Tromey c8ec2f433c Move max_height method to tui_gen_win_info
This moves the max_height method to tui_gen_win_info and implements it
in the subclasses.  This is used by a subsequent patch, which will
normalize window layout across all window types.

gdb/ChangeLog
2019-12-11  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.h (struct tui_locator_window) <max_height>: New
	method.
	* tui/tui-regs.h (struct tui_data_item_window) <max_height>: New
	method.
	* tui/tui-data.h (struct tui_gen_win_info) <max_height>: New
	method.
	(struct tui_win_info) <max_height>: Now override.

Change-Id: I4ba3e8899bc4668328d3d78e3c1674c61882450d
2019-12-11 15:48:59 -07:00
Tom Tromey 9f6ad286ef Fix the "winheight" command
The "winheight" command is broken.  I probably broke it in one of my
TUI refactoring patches, though I didn't track down exactly which one.

The bug is that the code does:

	  *buf_ptr = '\0';

... but then never advances buf_ptr past this point, so no window name
is seen.

This patch refactors the code a bit so that a copy of the argument
string is not needed, also fixing the bug.

A new test case is included.

gdb/ChangeLog
2019-11-19  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_partial_win_by_name): Move from tui-data.c.
	Now static.  Change type of "name".
	(tui_set_win_height_command): Don't copy "arg".
	* tui/tui-data.h (tui_partial_win_by_name): Don't declare.
	* tui/tui-data.c (tui_partial_win_by_name): Move to tui-win.c.

gdb/testsuite/ChangeLog
2019-11-19  Tom Tromey  <tom@tromey.com>

	* gdb.tui/winheight.exp: New file.

Change-Id: I0871e93777a70036dbec9c9543f862f42e3a81e5
2019-11-19 13:27:25 -07:00
Tom Tromey 0b026263ea Remove can_highlight from TUI windows
Each TUI window has a "can_highlight" member.  However, this has the
same meaning as "can_box" -- a window can be highlighted if and only
if it can be boxed.  So, this patch removes can_highlight in favor of
simply using can_box.

gdb/ChangeLog
2019-11-10  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (tui_unhighlight_win): Use can_box.
	(tui_highlight_win): Likewise.
	(tui_win_info::check_and_display_highlight_if_needed): Likewise.
	* tui/tui-data.h (struct tui_win_info) <can_highlight>: Remove.
	* tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>:
	Don't set can_highlight.

Change-Id: I35916859070efcdfcc6e692c71cc6070956dcfce
2019-11-10 10:33:07 -07:00
Tom de Vries 30baf67b65 [gdb] Fix more typos in comments (2)
Fix typos in comments.  NFC.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-10-26  Tom de Vries  <tdevries@suse.de>

	* aarch64-linux-tdep.c: Fix typos in comments.
	* aarch64-tdep.c: Same.
	* ada-lang.c: Same.
	* amd64-nat.c: Same.
	* arc-tdep.c: Same.
	* arch/aarch64-insn.c: Same.
	* block.c: Same.
	* breakpoint.h: Same.
	* btrace.h: Same.
	* c-varobj.c: Same.
	* cli/cli-decode.c: Same.
	* cli/cli-script.c: Same.
	* cli/cli-utils.h: Same.
	* coff-pe-read.c: Same.
	* coffread.c: Same.
	* compile/compile-cplus-symbols.c: Same.
	* compile/compile-object-run.c: Same.
	* completer.c: Same.
	* corelow.c: Same.
	* cp-support.c: Same.
	* demangle.c: Same.
	* dwarf-index-write.c: Same.
	* dwarf2-frame.c: Same.
	* dwarf2-frame.h: Same.
	* eval.c: Same.
	* frame-base.h: Same.
	* frame.h: Same.
	* gdbcmd.h: Same.
	* gdbtypes.h: Same.
	* gnu-nat.c: Same.
	* guile/scm-objfile.c: Same.
	* i386-tdep.c: Same.
	* i386-tdep.h: Same.
	* infcall.c: Same.
	* infcall.h: Same.
	* linux-nat.c: Same.
	* m68k-tdep.c: Same.
	* macroexp.c: Same.
	* memattr.c: Same.
	* mi/mi-cmd-disas.c: Same.
	* mi/mi-getopt.h: Same.
	* mi/mi-main.c: Same.
	* minsyms.c: Same.
	* nat/aarch64-sve-linux-sigcontext.h: Same.
	* objfiles.h: Same.
	* ppc-linux-nat.c: Same.
	* ppc-linux-tdep.c: Same.
	* ppc-tdep.h: Same.
	* progspace.h: Same.
	* prologue-value.h: Same.
	* python/py-evtregistry.c: Same.
	* python/py-instruction.h: Same.
	* record-btrace.c: Same.
	* record-full.c: Same.
	* remote.c: Same.
	* rs6000-tdep.c: Same.
	* ser-tcp.c: Same.
	* sol-thread.c: Same.
	* sparc-sol2-tdep.c: Same.
	* sparc64-tdep.c: Same.
	* stabsread.c: Same.
	* symfile.c: Same.
	* symtab.h: Same.
	* target.c: Same.
	* tracepoint.c: Same.
	* tui/tui-data.h: Same.
	* tui/tui-io.c: Same.
	* tui/tui-win.c: Same.
	* tui/tui.c: Same.
	* unittests/rsp-low-selftests.c: Same.
	* user-regs.h: Same.
	* utils.c: Same.
	* utils.h: Same.
	* valarith.c: Same.
	* valops.c: Same.
	* valprint.c: Same.
	* valprint.h: Same.
	* value.c: Same.
	* value.h: Same.
	* varobj.c: Same.
	* x86-nat.h: Same.
	* xtensa-tdep.c: Same.

gdb/gdbserver/ChangeLog:

2019-10-26  Tom de Vries  <tdevries@suse.de>

	* linux-aarch64-low.c: Fix typos in comments.
	* linux-arm-low.c: Same.
	* linux-low.c: Same.
	* linux-ppc-low.c: Same.
	* proc-service.c: Same.
	* regcache.h: Same.
	* server.c: Same.
	* tracepoint.c: Same.
	* win32-low.c: Same.

gdb/stubs/ChangeLog:

2019-10-26  Tom de Vries  <tdevries@suse.de>

	* ia64vms-stub.c: Fix typos in comments.
	* m32r-stub.c: Same.
	* m68k-stub.c: Same.
	* sh-stub.c: Same.

gdb/testsuite/ChangeLog:

2019-10-26  Tom de Vries  <tdevries@suse.de>

	* gdb.base/bigcore.c: Fix typos in comments.
	* gdb.base/ctf-ptype.c: Same.
	* gdb.base/long_long.c: Same.
	* gdb.dwarf2/dw2-op-out-param.S: Same.
	* gdb.python/py-evthreads.c: Same.
	* gdb.reverse/i387-stack-reverse.c: Same.
	* gdb.trace/tfile.c: Same.
	* lib/compiler.c: Same.
	* lib/compiler.cc: Same.

Change-Id: I8573d84a577894270179ae30f46c48d806fc1beb
2019-10-26 09:55:32 +02:00
Tom Tromey 7523da63ca Make TUI window handle a unique_ptr
This changes tui_gen_win_info::handle to be a specialization of
unique_ptr.  This is perhaps mildly uglier in some spots, due to the
proliferation of "get"; but on the other hand it cleans up some manual
management and it allows for the removal of tui_delete_win.

gdb/ChangeLog
2019-10-09  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_delete_win): Don't declare.
	* tui/tui-stack.c (tui_locator_window::rerender): Update.
	* tui/tui-command.c (tui_cmd_window::resize)
	(tui_refresh_cmd_win): Update.
	* tui/tui-win.c (tui_resize_all, tui_set_focus_command): Update.
	* tui/tui.c (tui_rl_other_window, tui_enable): Update.
	* tui/tui-data.c (~tui_gen_win_info): Remove.
	* tui/tui-layout.c (tui_gen_win_info::resize): Update.
	* tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts)
	(tui_redisplay_readline, tui_mld_flush)
	(tui_mld_erase_entire_line, tui_mld_getc, tui_getc): Update.
	* tui/tui-regs.c (tui_data_window::delete_data_content_windows)
	(tui_data_window::erase_data_content)
	(tui_data_item_window::rerender)
	(tui_data_item_window::refresh_window): Update.
	* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window)
	(box_win, tui_gen_win_info::make_window)
	(tui_gen_win_info::make_visible): Update.
	(tui_delete_win): Remove.
	* tui/tui-winsource.c
	(tui_source_window_base::do_erase_source_content): Update.
	(tui_show_source_line, tui_source_window_base::update_tab_width)
	(tui_source_window_base::update_exec_info): Update.
	* tui/tui-data.h (struct curses_deleter): New.
	(struct tui_gen_win_info) <handle>: Now a unique_ptr.
	(struct tui_gen_win_info) <~tui_gen_win_info>: Define.
2019-10-09 16:50:35 -06:00
Tom Tromey 5c45899e28 Remove tui_win_is_auxiliary
tui_win_is_auxiliary is not used, so remove it.

gdb/ChangeLog
2019-10-09  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.c (tui_win_is_auxiliary): Remove.
	* tui/tui-data.h (tui_win_is_auxiliary): Don't declare.
2019-10-09 16:50:34 -06:00
Tom Tromey 9abd8a65c1 Change "win_resized" to bool
This changes the "win_resized" global to be a bool and then updates
the uses.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_enable): Update.
	* tui/tui-win.c (tui_sigwinch_handler, tui_async_resize_screen):
	Update.
	* tui/tui-data.h (tui_win_resized, tui_set_win_resized_to):
	Update.
	* tui/tui-data.c (win_resized): Now bool.
	(tui_win_resized): Return bool.
	(tui_set_win_resized_to): Accept a bool.
2019-09-20 13:49:08 -06:00
Tom Tromey 78d5933a43 Remove tui_clear_source_windows_detail
The calls to tui_clear_source_windows_detail in tui_add_win_to_layout
aren't needed, because (after the resize unification) resizing will
update the window contents.  Removing these calls lets us remove
several other things as well.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (tui_clear_source_windows_detail): Don't
	declare.
	* tui/tui-layout.c (tui_add_win_to_layout): Don't call
	tui_clear_source_windows_detail.
	* tui/tui-winsource.h (struct tui_source_window_base)
	<clear_detail>: Don't declare.
	* tui/tui-winsource.c (tui_source_window_base::clear_detail):
	Remove.
	* tui/tui-data.c (tui_clear_source_windows_detail): Remove.
2019-09-20 13:49:04 -06:00
Tom Tromey d6a00eba2a Remove tui_win_info::refresh_all
The TUI has two duplicate "re-render this window" methods, "rerender"
and "refresh_all".  They differ only slightly in semantics, so I
wanted to see if they could be unified.

After looking into this, I decided that refresh_all was not needed.
There are 4 calls to tui_refresh_all_win (the only caller of this
method):

1. tui_enable.  This sets the layout, which renders the windows.

2. tui_cont_sig.  Here, I think it's sufficient to simply redraw the
   current window contents from the curses backing store, because gdb
   state didn't change while it was suspended

3. tui_dispatch_ctrl_char.  This is the C-l handler, and here it's
   explicitly enough to just refresh the screen (as above).

4. tui_refresh_all_command.  This is the command equivalent of C-l.

So, this patch removes this method entirely and simplifies
tui_refresh_all_win.

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

	* tui/tui-winsource.h (struct tui_source_window_base)
	<refresh_all>: Don't declare.
	* tui/tui-winsource.c (tui_source_window_base::refresh_all):
	Remove.
	* tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or
	tui_show_locator_content.
	* tui/tui-regs.h (struct tui_data_window) <refresh_all>: Don't
	declare.
	* tui/tui-regs.c (tui_data_window::refresh_all): Remove.
	* tui/tui-data.h (struct tui_win_info) <refresh_all>: Don't
	declare.
2019-08-30 12:57:10 -06:00
Tom Tromey 1f6d2f100a Remove NO_DATA_STRING
NO_DATA_STRING shouldn't be used.  It's referenced in a single spot,
in tui_data_window::display_all_data.  This patch removes the use and
replaces it with the more correct text.  A later patch (though not in
this series) will remove this call entirely, when it's more obviously
correct to do so.

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

	* tui/tui-regs.c (tui_data_window::display_all_data): Change
	text.
	* tui/tui-data.h (NO_DATA_STRING): Remove define.
2019-08-30 12:57:02 -06:00
Christian Biesinger c07aae6e72 Fix g++ 9.1 build breakage
gdb/ChangeLog:

2019-08-21  Christian Biesinger  <cbiesinger@google.com>

	* tui/tui-data.h (tui_gen_win_info): Add an =default
	move constructor, required by some GCC versions.
2019-08-21 15:09:50 -05:00
Tom Tromey 072272ce05 Remove some defines from tui-data.h
This removes the HILITE and NO_HILITE defines from tui-data.h, in
favor of simply passing a bool to box_win.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (box_win): Change type of highlight_flag.
	(tui_unhighlight_win, tui_highlight_win)
	(tui_win_info::make_window): Update.
	* tui/tui-data.h (HILITE, NO_HILITE): Remove.
2019-08-20 16:45:50 -06:00
Tom Tromey 973961bda3 Move some defines to tui-stack.c
Some #defines in tui-data.h are only used in tui-stack.c, so move them
there.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (PROC_PREFIX, LINE_PREFIX, PC_PREFIX)
	(MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH)
	(MAX_PID_WIDTH): Move to tui-stack.c.
	* tui/tui-stack.c (PROC_PREFIX, LINE_PREFIX, PC_PREFIX)
	(MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH)
	(MAX_PID_WIDTH): Move from tui-data.h.
2019-08-20 16:45:50 -06:00
Tom Tromey ab0e1f1a45 Change tui_make_window to be a method
I combined several small changes into one patch here.  I believe I
started by noticing that the "title" is not needed by tui_gen_win_info
and could be self-managing (i.e. std::string).  Moving this revealed
that "can_box" is also a property of tui_win_info and not
tui_gen_win_info; and this in turn caused the changes to
tui_make_window and box_win.

2019-08-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.h (tui_make_window): Don't declare.
	* tui/tui-wingeneral.c (box_win): Change type of win_info.
	(box_win): Update.
	(tui_gen_win_info::make_window): Rename from tui_make_window.
	(tui_win_info::make_window): New method.
	(tui_gen_win_info::make_visible): Update.
	* tui/tui-source.c (tui_source_window::set_contents): Update.
	* tui/tui-regs.c (tui_data_window::show_register_group): Update.
	(tui_data_window::display_registers_from): Update.
	* tui/tui-layout.c (tui_gen_win_info::resize): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <make_window>:
	Declare.
	<can_box>: Remove.
	<title>: Remove.
	(struct tui_win_info) <make_window>: Declare.
	<can_box>: Now virtual.
	<title>: New member.
	* tui/tui-data.c (~tui_gen_win_info): Don't free title.
	* tui/tui-command.c (tui_cmd_window::resize): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey 605dc2c21d Some i18n fixes for the TUI
The TUI has a few #defines that hold user-visible strings.  As these
are only used in a single spot, this patch removes the defines,
preferring direct use of the string where needed.  Furthermore, now
the strings are wrapped in _(), which is friendlier for i18n purposes.

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

	* tui/tui-source.h (struct tui_source_window): Update.
	* tui/tui-regs.c (tui_show_registers): Update.
	* tui/tui-disasm.h (struct tui_disasm_window): Update.
	* tui/tui-data.h (NO_SRC_STRING, NO_DISASSEM_STRING)
	(NO_REGS_STRING): Remove defines.
2019-08-20 16:22:03 -06:00
Tom Tromey 2d83e710a1 Remove separate visibility flag
TUI windows keep track of their visibility in a boolean field.
However, this is not needed, because a window is visible if and only
if it has an underlying curses handle.  So, we can remove this
separate field.

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

	* tui/tui.c (tui_is_window_visible): Update.
	* tui/tui-wingeneral.c (tui_make_window)
	(tui_gen_win_info::make_visible, tui_refresh_all): Update.
	* tui/tui-win.c (window_name_completer, tui_refresh_all_win)
	(tui_set_focus_command, tui_all_windows_info, update_tab_width)
	(tui_set_win_height_command, parse_scrolling_args): Update.
	* tui/tui-source.c (tui_source_window::style_changed): Update.
	* tui/tui-regs.c (tui_show_registers)
	(tui_data_window::first_data_item_displayed)
	(tui_data_window::delete_data_content_windows)
	(tui_check_register_values, tui_reg_command): Update.
	* tui/tui-disasm.c (tui_show_disassem): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New
	method.
	<is_visible>: Remove field.
	* tui/tui-data.c (tui_next_win, tui_prev_win)
	(tui_delete_invisible_windows): Update.
2019-08-16 11:28:33 -06:00
Tom Tromey 3df505f60e TUI resize unification
The TUI currently has two different ways to resize a window: the
resize method, and the methods make_invisible_and_set_new_height and
make_visible_with_new_height.

There's no deep reason to have two different ways to resize a window,
so this patch unifies them, leaving just the "resize" method.

This also changes the locator to be handled more like an ordinary
window and less like an adjunct of the associated source window.

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

	* tui/tui-io.c (tui_puts_internal): Check TUI_CMD_WIN before
	calling update_cmdwin_start_line.
	* tui/tui-winsource.h (struct tui_source_window_base)
	<do_make_visible_with_new_height, set_new_height>: Don't declare.
	<rerender>: Declare.
	* tui/tui-winsource.c (tui_source_window_base::update_tab_width):
	Call rerender.
	(tui_source_window_base::set_new_height): Remove.
	(tui_source_window_base::rerender): Rename from
	do_make_visible_with_new_height.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use
	resize method.
	(tui_win_info::make_invisible_and_set_new_height)
	(tui_win_info::make_visible_with_new_height): Remove.
	* tui/tui-stack.h (struct tui_locator_window) <rerender>:
	Declare.
	* tui/tui-stack.c (tui_locator_window::rerender): New method.
	* tui/tui-regs.h (struct tui_data_window) <set_new_height,
	do_make_visible_with_new_height>: Don't declare.
	<rerender>: Declare.
	* tui/tui-regs.c (tui_data_window::rerender): Rename from
	set_new_height.
	(tui_data_window::do_make_visible_with_new_height): Remove.
	* tui/tui-layout.c (show_source_disasm_command, show_data): Don't
	call tui_show_locator_content.
	(tui_gen_win_info::resize): Call rerender.
	(show_source_or_disasm_and_command): Don't call
	tui_show_locator_content.
	* tui/tui-data.h (struct tui_gen_win_info) <rerender>: New
	method.
	(struct tui_win_info) <rerender>: Declare.
	<set_new_height, make_invisible_and_set_new_height,
	make_visible_with_new_height>: Don't declare.
	* tui/tui-data.c (tui_win_list::rerender): New method.
	* tui/tui-command.h (struct tui_cmd_window)
	<do_make_visible_with_new_height>: Don't declare.
	* tui/tui-command.c
	(tui_cmd_window::do_make_visible_with_new_height): Remove.

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

	* gdb.tui/empty.exp: Enable resizing tests.
2019-08-15 14:17:11 -06:00
Tom Tromey 3891b65efe Change TUI source window iteration
Currently the TUI does separate bookkeeping to track which source
windows exist.  It seems better to me to just refer to the list of
windows for this, so this patch removes the special handling and
instead adds a new iterator.

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

	* tui/tui-winsource.h (struct tui_source_window_iterator): New.
	(struct tui_source_windows): New.
	* tui/tui-winsource.c (tui_display_main): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
	(new_height_ok, parse_scrolling_args): Update.
	* tui/tui-layout.c (show_layout, show_data): Update.
	* tui/tui-data.h (tui_source_windows, tui_clear_source_windows)
	(tui_add_to_source_windows): Don't declare.
	* tui/tui-data.c (source_windows, tui_source_windows)
	(tui_clear_source_windows, tui_add_to_source_windows): Remove.
2019-08-15 12:29:28 -06:00
Tom Tromey ee556432c4 Rename the "reset" method to "resize"
tui_gen_win_info::reset really just resizes the window.  This patch
renames it to reflect this.

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

	* tui/tui-winsource.h (struct tui_source_window_base) <resize>:
	Rename from reset.
	* tui/tui-winsource.c (tui_source_window_base::resize): Rename.
	* tui/tui-layout.c (show_source_disasm_command, show_data):
	Update.
	(tui_gen_win_info::resize): Rename.
	(show_source_or_disasm_and_command): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <resize>: Rename from
	reset.
2019-08-15 12:29:28 -06:00
Tom Tromey 46f438e3d5 Remove tui_initialize_static_data
tui_initialize_static_data is not needed, because locator moving and
resizing is already handled in the layout code.

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

	* tui/tui-stack.c (tui_initialize_static_data): Remove.
	* tui/tui-interp.c (tui_interp::init): Don't call
	tui_initialize_static_data.
	* tui/tui-data.h (tui_initialize_static_data): Don't declare.
2019-08-15 12:29:28 -06:00
Tom Tromey f2dda47784 Move locator code to tui-stack.c
The locator is mostly implemented in tui-stack.c.  This moves the
remaining bits to tui-stack.c and tui-stack.h, as appropriate.

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

	* tui/tui-wingeneral.c: Include tui-stack.h.
	* tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN)
	(struct tui_locator_window): Move from tui-data.h.
	* tui/tui-stack.c (_locator, tui_locator_win_info_ptr)
	(tui_initialize_static_data): Move from tui-data.c.
	* tui/tui-data.h (MAX_LOCATOR_ELEMENT_LEN)
	(struct tui_locator_window): Move to tui-stack.c.
	* tui/tui-data.c (_locator, tui_locator_win_info_ptr)
	(tui_initialize_static_data): Move to tui-stack.c.
2019-08-15 12:29:28 -06:00
Tom Tromey 65962b20b6 Simplify TUI boxing
In the TUI, whether or not a window can be boxed is a property of the
window's type.  This adds a can_box method to the window classes, and
changes tui_make_window to defer to this, removing the "box_it"
paramter.  This also lets us remove "enum tui_box", as it is no longer
used.

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

	* tui/tui-wingeneral.h (tui_make_window): Update.
	* tui/tui-wingeneral.c (tui_make_window): Remove "box_it"
	parameter.
	(tui_gen_win_info::make_visible): Update.
	* tui/tui-regs.c (tui_data_window::display_registers_from):
	Update.
	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method.
	(enum tui_box): Remove.
	(struct tui_win_info) <can_box>: New method.
	* tui/tui-command.h (struct tui_cmd_window) <can_box>: New
	method.
2019-08-15 12:29:28 -06:00
Tom Tromey 6405cd73c0 Remove tui_gen_win_info::last_visible_line
The last_visible_line field of tui_gen_win_info is not used, so remove
it.

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

	* tui/tui-data.h (struct tui_gen_win_info) <last_visible_line>:
	Remove.
	* tui/tui-data.c (tui_initialize_static_data): Update.
2019-08-13 14:52:10 -06:00
Tom Tromey 7b56485db5 Move code to tui-winsource.h
This moves code related to the execution info window from tui-data.h
to tui-winsource.h.  It fits better here because the execution info is
conceptually part of the source and disassembly windows, and
tui-winsource.h is where this common class lives.

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

	* tui/tui-data.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element)
	(TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS)
	(TUI_EXECINFO_SIZE, tui_exec_info_content): Move ...
	* tui/tui-winsource.h (enum tui_bp_flag, tui_bp_flags, struct
	tui_source_element, TUI_BP_HIT_POS, TUI_BP_BREAK_POS)
	(TUI_EXEC_POS, TUI_EXECINFO_SIZE, tui_exec_info_content):
	... here.
2019-08-13 14:52:09 -06:00
Tom Tromey b4ef5aeb3a Change tui_check_and_display_highlight_if_needed to be a method
This changes tui_check_and_display_highlight_if_needed to be a method
on tui_win_info.  This makes it clear that the NULL check in that
function is not needed, so it is removed here.

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

	* tui/tui-winsource.c (tui_erase_source_content)
	(tui_show_source_content, tui_source_window_base::refresh_all):
	Update.
	* tui/tui-wingeneral.h
	(tui_check_and_display_highlight_if_needed): Don't declare.
	* tui/tui-wingeneral.c
	(tui_win_info::check_and_display_highlight_if_needed): Rename from
	check_and_display_highlight_if_needed.
	* tui/tui-win.c (tui_rehighlight_all)
	(tui_win_info::make_visible_with_new_height): Update.
	* tui/tui-regs.c (tui_data_window::display_registers_from_line)
	(tui_data_window::erase_data_content)
	(tui_data_window::display_all_data): Update.
	* tui/tui-data.h (struct tui_win_info)
	<check_and_display_highlight_if_needed>: Declare.
2019-08-13 14:52:09 -06:00
Tom Tromey fede52738f Delete invisible TUI windows
This changes the TUI so that when the layout changes, any windows that
are invisible are now deleted.  This makes it simpler to understand
window lifetimes.

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

	* tui/tui-win.c (tui_resize_all): Call
	tui_delete_invisible_windows.
	* tui/tui-layout.c (show_layout): Call
	tui_delete_invisible_windows.
	* tui/tui-data.h (tui_delete_invisible_windows): Declare.
	* tui/tui-data.c (tui_delete_invisible_windows): New function.
2019-08-13 14:52:09 -06:00
Tom Tromey 62cf57fee7 Move current_layout to tui-layout.c
This moves the current_layout global to tui-layout.c.  This allows for
the removal of an accessor function; but also it just seems clearer to
have it here.

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

	* tui/tui-layout.c (current_layout, tui_current_layout): Move from
	tui-data.c.
	(show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Don't use
	tui_set_current_layout_to.
	* tui/tui-data.h (tui_set_current_layout_to): Don't declare.
	* tui/tui-data.c (current_layout, tui_current_layout): Move to
	tui-layout.c.
	(tui_set_current_layout_to): Remove.
2019-08-13 14:52:09 -06:00
Tom Tromey 2afade5dbe Remove struct tui_layout_def
"layout_def" isn't actually used in the TUI, so remove it.

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

	* tui/tui-layout.c (tui_set_layout): Update.
	* tui/tui-data.h (struct tui_layout_def): Remove.
	(tui_layout_def): Don't declare.
	* tui/tui-data.c (layout_def): Remove.
	(tui_layout_def): Remove.
2019-08-13 14:52:09 -06:00
Tom Tromey a3504e9654 clear_detail can only be called on TUI source windows
The clear_detail method can only be called on source windows, so
remove definitions from the base of the class hierarchy, leaving only
a single non-virtual method.

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

	* tui/tui-winsource.h (struct tui_source_window_base)
	<clear_detail>: No longer "override".
	* tui/tui-regs.h (struct tui_data_window) <clear_detail>: Remove.
	* tui/tui-regs.c (tui_data_window::clear_detail): Remove.
	* tui/tui-data.h (struct tui_win_info) <clear_detail>: Remove.
	* tui/tui-command.h (struct tui_cmd_window) <clear_detail>:
	Remove.
	* tui/tui-command.c (tui_cmd_window::clear_detail): Remove.
2019-08-13 14:52:09 -06:00
Tom Tromey 5104fe361d Move source window common to code to tui-winsource.[ch]
Like the previous rearranging patches, this moves the source and
disassembly window base class code to tui-winsource.[ch].  The
execution info window is also moved, because it is associated with
this base class.

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

	* tui/tui-winsource.h (struct tui_exec_info_window)
	(struct tui_source_window_base): Move from tui-data.h.
	* tui/tui-winsource.c: Move many method definitions from
	elsewhere.  Remove "structuring" comments.
	* tui/tui-wingeneral.c (tui_source_window_base::make_visible)
	(tui_source_window_base::refresh_window): Move to
	tui-winsource.c.
	* tui/tui-win.c (tui_source_window_base::refresh_all)
	(tui_source_window_base::update_tab_width)
	(tui_source_window_base::set_new_height)
	(tui_source_window_base::do_make_visible_with_new_height): Move to
	tui-winsource.c.
	* tui/tui-source.h: Update.
	* tui/tui-source.c (tui_source_window_base::reset): Move to
	tui-winsource.c.
	* tui/tui-disasm.h: Update.
	* tui/tui-data.h (struct tui_exec_info_window): Move to
	tui-winsource.h.
	(struct tui_source_window_base): Likewise.
	* tui/tui-data.c (tui_source_window_base::clear_detail)
	(tui_source_window_base, ~tui_source_window_base): Move to
	tui-winsource.c.
2019-07-17 12:19:25 -06:00
Tom Tromey daa15dde72 Change make_invisible_and_set_new_height to be a method
This changes make_invisible_and_set_new_height to be a method on
tui_win_info.  I felt that this was cleaner.

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

	* tui/tui-win.c (tui_resize_all)
	(tui_source_window_base::update_tab_width)
	(tui_adjust_win_heights): Update.
	(tui_win_info::make_invisible_and_set_new_height): Rename from
	make_invisible_and_set_new_height.
	* tui/tui-data.h (struct tui_win_info)
	<make_invisible_and_set_new_height>: New method.
2019-07-17 12:19:24 -06:00
Tom Tromey bfad453707 Move tui_source_window to tui-source.h
This moves tui_source_window to tui-source.h.  In this case there were
no method definitions to be moved.

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

	* tui/tui.c: Update.
	* tui/tui-source.h (struct tui_source_window): Move from
	tui-data.h.
	* tui/tui-layout.c: Update.
	* tui/tui-disasm.c: Update.
	* tui/tui-data.h (struct tui_source_window): Move to
	tui-source.h.
2019-07-17 12:19:24 -06:00
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 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 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