Commit Graph

757 Commits

Author SHA1 Message Date
Tom Tromey 7f6aba03b9 Introduce metadata style
This introduces a new "metadata" style and changes many places in gdb
to use it.  The idea here is to let the user distinguish gdb output
from output that (conceptually at least) comes directly from the
inferior.  The newly-styled category includes text that gdb
traditionally surrounds in "<...>", like "<unavailable>".

I only added a single test for this.  In many cases this output is
difficult to test.  Also, while developing this errors in the
implementation of the new printf formats showed up as regressions.

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

	* p-lang.c (pascal_printstr): Use metadata style.
	* value.c (show_convenience): Use metadata style.
	* valprint.c (valprint_check_validity, val_print_optimized_out)
	(val_print_not_saved, val_print_unavailable)
	(val_print_invalid_address, generic_val_print, val_print)
	(value_check_printable, val_print_array_elements): Use metadata
	style.
	* ui-out.h (class ui_out) <field_fmt>: New overload.
	<do_field_fmt>: Add style parameter.
	* ui-out.c (ui_out::field_fmt): New overload.
	* typeprint.c (type_print_unknown_return_type)
	(val_print_not_allocated, val_print_not_associated): Use metadata
	style.
	* tui/tui-out.h (class tui_ui_out) <do_field_fmt>: Add style
	parameter.
	* tui/tui-out.c (tui_ui_out::do_field_fmt): Update.
	* tracepoint.c (tvariables_info_1): Use metadata style.
	* stack.c (print_frame_arg, print_frame_info, print_frame)
	(info_frame_command_core): Use metadata style.
	* skip.c (info_skip_command): Use metadata style.
	* rust-lang.c (rust_print_enum): Use metadata style.
	* python/py-prettyprint.c (print_stack_unless_memory_error): Use
	metadata style.
	* python/py-framefilter.c (py_print_single_arg): Use metadata
	style.
	* printcmd.c (do_one_display, print_variable_and_value): Use
	metadata style.
	* p-valprint.c (pascal_val_print)
	(pascal_object_print_value_fields): Use metadata style.
	* p-typeprint.c (pascal_type_print_base): Use metadata style.
	* mi/mi-out.h (class mi_ui_out) <do_field_fmt>: Add style
	parameter.
	* mi/mi-out.c (mi_ui_out::do_field_fmt): Update.
	* m2-valprint.c (m2_print_long_set): Use metadata style.
	* m2-typeprint.c (m2_print_type): Use metadata style.
	* infcmd.c (print_return_value_1): Use metadata style.
	* gnu-v3-abi.c (print_one_vtable): Use metadata style.
	* f-valprint.c (info_common_command_for_block): Use metadata
	style.
	* f-typeprint.c (f_type_print_base): Use metadata style.
	* expprint.c (print_subexp_standard): Use metadata style.
	* cp-valprint.c (cp_print_value_fields): Use metadata style.
	* cli/cli-style.h (class cli_style_option): Add constructor.
	(metadata_style): Declare.
	* cli/cli-style.c (metadata_style): New global.
	(_initialize_cli_style): Register metadata style.
	* cli-out.h (class cli_ui_out) <do_field_fmt>: Add style
	parameter.
	* cli-out.c (cli_ui_out::do_field_fmt): Update.
	* c-typeprint.c (c_type_print_base_struct_union)
	(c_type_print_base_1): Use metadata style.
	* breakpoint.c (watchpoint_value_print)
	(print_one_breakpoint_location): Use metadata style.
	* break-catch-syscall.c (print_one_catch_syscall): Use metadata
	style.
	* break-catch-sig.c (signal_catchpoint_print_one): Use metadata
	style.
	* ada-valprint.c (val_print_packed_array_elements, printstr)
	(print_field_values, ada_val_print_ref, ada_val_print): Use
	metadata style.
	* ada-typeprint.c (print_array_type, ada_print_type): Use metadata
	style.
	* ada-tasks.c (print_ada_task_info, info_task): Use metadata
	style.
	* ada-lang.c (user_select_syms): Use metadata style.

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

	* lib/gdb-utils.exp (style): Handle "metadata" argument.
	* gdb.base/style.exp: Add metadata style test.
2019-10-01 15:12:40 -06:00
Tom Tromey e43b10e10e Remove the ui_out_style_kind enum
This removes the ui_out_style_kind enum, in favor of simply using
ui_file_style references.  This simplifies the code somewhat.

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

	* ui-out.h (enum class ui_out_style_kind): Remove.
	(class ui_out) <field_string, field_stsream, do_field_string>:
	Change type of "style".
	* ui-out.c (ui_out::field_core_addr, ui_out::field_stream)
	(ui_out::field_string): Update.
	* tui/tui-out.h (class tui_ui_out) <do_field_string>: Change type
	of "style".
	* tui/tui-out.c (tui_ui_out::do_field_string): Update.
	* tracepoint.c (print_one_static_tracepoint_marker): Update.
	* stack.c (print_frame_arg, print_frame_info, print_frame):
	Update.
	* source.c (print_source_lines_base): Update.
	* solib.c (info_sharedlibrary_command): Update.
	* skip.c (info_skip_command): Update.
	* record-btrace.c (btrace_call_history_src_line)
	(btrace_call_history): Update.
	* python/py-framefilter.c (py_print_frame): Update.
	* mi/mi-out.h (class mi_ui_out) <do_field_string>: Change type of
	"style".
	* mi/mi-out.c (mi_ui_out::do_table_header)
	(mi_ui_out::do_field_signed, mi_ui_out::do_field_unsigned)
	(mi_ui_out::do_field_string): Update.
	* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
	Update.
	* cli-out.h (class cli_ui_out) <do_field_string>: Change type of
	"style".
	* cli-out.c (cli_ui_out::do_table_header)
	(cli_ui_out::do_field_signed, cli_ui_out::do_field_unsigned)
	(cli_ui_out::do_field_skip, cli_ui_out::do_field_string)
	(cli_ui_out::do_field_fmt): Update.
	* breakpoint.c (print_breakpoint_location): Update.
	(update_static_tracepoint): Update.
2019-10-01 15:12:37 -06:00
Tom Tromey 78e8cb91cd Change TUI window commands to be case-sensitive
The TUI window-related commands like "focus" are case insensitive.
This is not the norm in gdb, and I don't see a good reason to have it
here.  This patch changes the TUI to be case sensitive, like the rest
of gdb.

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

	* NEWS: Mention case-sensitivity of TUI commands.
	* tui/tui-win.c (tui_set_focus_command): Now case-sensitive.
	(tui_set_win_height_command, parse_scrolling_args): Likewise.
	* tui/tui-layout.c (tui_layout_command): Now case-sensitive.
2019-09-20 13:49:12 -06:00
Tom Tromey f074b67ec8 Use make_unique_xstrdup in TUI
This changes a couple of spots in the TUI to use make_unique_xstrdup.
This simplifies the code slightly.

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

	* tui/tui-source.c (tui_source_window::set_contents): Use
	make_unique_xstrdup.
	* tui/tui-disasm.c (tui_disasm_window::set_contents): Use
	make_unique_xstrdup.
2019-09-20 13:49:12 -06:00
Tom Tromey 63c4bf1922 Remove separator comments from TUI
This removes various separator comments from the TUI.  These aren't
used elsewhere in gdb, and they were incorrect in some cases as well.

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

	* tui/tui-data.c: Remove separator comments.
	* tui/tui-layout.c: Remove separator comments.
	* tui/tui-win.c: Remove separator comments.
	* tui/tui-wingeneral.c: Remove separator comments.
2019-09-20 13:49:11 -06:00
Tom Tromey 43df9b2fcc Remove strcat_to_buf
An earlier patch in the series removed the last call to strcat_to_buf,
so this patch removes the function entirely.

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

	* tui/tui.h (strcat_to_buf): Don't declare.
	* tui/tui.c (strcat_to_buf): Remove.
2019-09-20 13:49:11 -06:00
Tom Tromey 7226433c44 Rename a private data member in tui_source_window
This renames tui_source_window::fullname to add the "m_" prefix, as it
is a private data member.

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

	* tui/tui-source.h (struct tui_source_window) <m_fullname>: Rename
	from "fullname".
	* tui/tui-source.c (tui_source_window::set_contents)
	(tui_source_window::location_matches_p)
	(tui_source_window::maybe_update): Update.
2019-09-20 13:49:11 -06:00
Tom Tromey 80df33379e Rename private data members of tui_data_window
As Pedro suggested, this patch renames the private data members of
tui_data_window to use the "m_" prefix.

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

	* tui/tui-regs.h (struct tui_data_window) <get_current_group>:
	Update.
	<m_regs_content, m_regs_column_count, m_current_group>: Add "m_"
	prefix.
	* tui/tui-regs.c (tui_data_window::last_regs_line_no)
	(tui_data_window::line_from_reg_element_no)
	(tui_data_window::first_reg_element_no_inline)
	(tui_data_window::show_registers)
	(tui_data_window::show_register_group)
	(tui_data_window::display_registers_from)
	(tui_data_window::display_registers_from_line)
	(tui_data_window::first_data_item_displayed)
	(tui_data_window::delete_data_content_windows)
	(tui_data_window::erase_data_content)
	(tui_data_window::do_scroll_vertical)
	(tui_data_window::refresh_window)
	(tui_data_window::check_register_values): Update.
2019-09-20 13:49:10 -06:00
Tom Tromey 9923f347c4 Change members of tui_locator_window to std::string
This changes two members of tui_locator_window to have type
std::string.  This removes a static limit.

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

	* tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN): Remove define.
	(struct tui_locator_window) <full_name, proc_name>: Now
	std::string.
	* tui/tui-stack.c (tui_locator_window::make_status_line)
	(tui_locator_window::set_locator_fullname)
	(tui_locator_window::set_locator_info): Update.
	* tui/tui-source.c (tui_source_window::set_contents)
	(tui_source_window::showing_source_p): Update.
2019-09-20 13:49:10 -06:00
Tom Tromey b76251abaf Remove a call to tui_locator_win_info_ptr
Commit e594a5d1 ("Turn two locator functions into methods") turned
set_locator_fullname into a method on tui_locator_window.  I missed it
at the time, but this change allows for the removal of a call to
tui_locator_win_info_ptr.

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

	* tui/tui-stack.c (tui_locator_window::set_locator_fullname):
	Don't call tui_locator_win_info_ptr.
2019-09-20 13:49:09 -06:00
Tom Tromey 0891be0835 Don't call refresh in tui_resize_all
There's no reason to call refresh in tui_resize_all.  This call
flushes the curses window contents to the terminal -- but, because
we're about the resize all the windows, we're going to be sending more
data to the terminal momentarily.  This patch removes the call.

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

	* tui/tui-win.c (tui_resize_all): Don't call refresh.
2019-09-20 13:49:09 -06:00
Tom Tromey 1b935acf7e Set TUI locator height to 1
The TUI has long had code to resize the locator, using 2 as the
height.  However the code has "1" in a comment, like:

    locator->resize (2 /* 1 */ ,

This patch fixes the resizing code to set the height to 1.  Doing this
revealed what was probably the reason for setting the height to 2 in
the first place: this caused the locator window to scroll.  However,
this is easily handled by calling scrollok on the locator window.

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

	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use 1 as
	height for locator.
	* tui/tui-stack.c (tui_locator_window::rerender): Call scrollok.
	* tui/tui-layout.c (show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Use 1 as height for locator.
2019-09-20 13:49:08 -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 b545782674 Use "bool" in tui_data_window::show_register_group
This changes tui_data_window::show_register_group to use "bool" rather
than "int".

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

	* tui/tui-regs.h (struct tui_data_window) <show_register_group>:
	Change type of "refresh_values_only".
	* tui/tui-regs.c (tui_data_window::show_register_group): Change
	type of "refresh_values_only".
2019-09-20 13:49:07 -06:00
Tom Tromey 6b915f7d0c Simplify TUI disassembly
This simplifies TUI disassembly somewhat, by removing manual memory
management.

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

	* tui/tui-disasm.c (struct tui_asm_line) <addr_string, insn>: Now
	std::string.
	(tui_disassemble): Add "pos" parameter.
	(tui_disasm_window::set_contents): Simplify.
2019-09-20 13:49:07 -06:00
Tom Tromey 2ad52f6fb3 Simplify tui_source_window_base::show_source_content
tui_source_window_base::show_source_content is not used outside the
class any more, so this makes it private.  Examining the callers shows
that it can't be called without source contents, so it can be
simplified as well.

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

	* tui/tui-winsource.h (struct tui_source_window_base)
	<show_source_content>: Now private.
	* tui/tui-winsource.c
	(tui_source_window_base::show_source_content): Don't handle empty
	content case.
2019-09-20 13:49:06 -06:00
Tom Tromey b3b1bde658 Remove some explicit re-rendering from the TUI
A couple of spots in tui-layout.c still call the show_source_content
method.  However, now that re-rendering is done by the resize method,
these calls are no longer needed.

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

	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Don't call
	show_source_content.
2019-09-20 13:49:06 -06:00
Tom Tromey 71a25ed2e7 Change tui_make_status_line to be a method
This changes tui_make_status_line to be a method on
tui_locator_window.  This is a minor cleanup.

This also changes the new method to use the locator's width, rather
than the terminal width.  This is important if we ever want to allow
windows to be made more narrow.

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

	* tui/tui-stack.h (struct tui_locator_window) <make_status_line>:
	Declare.
	* tui/tui-stack.c (tui_locator_window::make_status_line): Rename
	from tui_make_status_line.
	(tui_locator_window::rerender): Update.
2019-09-20 13:49:05 -06:00
Tom Tromey f853215443 Change tui_make_status_line to return std::string
This changes tui_make_status_line to return std::string.  This cleans
it up a bit, and removes some explicit memory management.

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

	* tui/tui-stack.c (tui_make_status_line): Return std::string.
	(tui_locator_window::rerender): Update.
2019-09-20 13:49:05 -06:00
Tom Tromey 2d81b34998 Move "fullname" to tui_source_window
The "fullname" field in tui_source_window_base is only used by one
subclass.  This patch moves the field to that subclass, and changes it
to be a unique_xmalloc_ptr.

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

	* tui/tui-winsource.h (struct tui_source_window_base)
	<~tui_source_window_base>: Don't declare.
	<fullname>: Remove.
	* tui/tui-winsource.c (~tui_source_window_base): Remove.
	* tui/tui-source.h (struct tui_source_window) <fullname>: New
	member.
	* tui/tui-source.c (tui_source_window::set_contents): Update.
	(tui_source_window::location_matches_p)
	(tui_source_window::maybe_update): Update.
2019-09-20 13:49:05 -06:00
Tom Tromey f14bec587f Change tui_source_element::line to be a unique_xmalloc_ptr
This changes tui_source_element::line to be a unique_xmalloc_ptr,
removing some manual memory management.

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

	* tui/tui-winsource.h (~tui_source_element): Remove.
	(tui_source_element): Update.
	(struct tui_source_element) <line>: Now a unique_xmalloc_ptr.
	* tui/tui-winsource.c (tui_show_source_line): Update.
	* tui/tui-source.c (tui_source_window::set_contents): Update.
	* tui/tui-disasm.c (tui_disasm_window::set_contents): Update.
2019-09-20 13:49:04 -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 11061048d1 Give a name to the TUI SingleKey keymap
Readline 8.0 has a feature that lets an application name a keymap.
This in turn makes it simpler for users to bind keys in keymaps in
their .inputrc.

This patch gives a name to the TUI SingleKey keymap, so that
additional bindings can be made there.  For example:

    $if gdb
    set keymap SingleKey
    "X": "echo hello\\n\n"
    $endif

The call to rl_initialize, in tui_initialize_readline, had to be
removed so that .inputrc was not read too early.  Note that Readline
explicitly documents that this call is not needed.

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

	* NEWS: Add entry.
	* tui/tui.c (tui_initialize_readline): Set name of keymap.  Do not
	call rl_initialize.
	(tui_enable): Do not call rl_initialize.

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

	* gdb.texinfo (Editing): Document readline application name.
	(TUI Single Key Mode): Document TUI SingleKey keymap name.
2019-09-18 15:03:29 -06:00
Tom Tromey 25a2915e8d Use ui_out for "info win"
This changes the "info win" command to use ui-out.  This yields
somewhat nicer table output.

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

	* tui/tui-win.c (tui_all_windows_info): Use ui_out.
2019-09-09 17:06:22 -06:00
Tom Tromey 8634b4628e Truncate long TUI window titles
If a TUI window has a long title, it can overflow the title line.
This changes the TUI to use just the tail part of the title in this
case.

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

	* tui/tui-wingeneral.c (box_win): Truncate long window titles.

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

	* gdb.tui/resize.exp: Remove setup_xfail.
	* gdb.tui/regs.exp: Remove setup_xfail.
	* gdb.tui/basic.exp: Remove setup_xfail.
2019-09-08 14:06:54 -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 55b2657bdc Don't call wrefresh from tui_cont_sig
tui_cont_sig does not need to call wrefresh, because this is already
done by tui_refresh_all_win.

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

	* tui/tui-io.c (tui_cont_sig): Don't call wrefresh.
2019-08-30 12:57:10 -06:00
Tom Tromey 12a8555a54 Minor rearrangement of tui-stack.c
This move _initialize_tui_stack to the end of tui-stack.c, per the gdb
style; and then removes two unnecessary forward declarations.

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

	* tui/tui-stack.c (_initialize_tui_stack): Move later.
	Remove unnecessary forward declarations.
2019-08-30 12:57:09 -06:00
Tom Tromey 900ac24287 Make tui_locator_window::set_locator_fullname re-render
This changes tui_locator_window::set_locator_fullname to re-render the
locator window, so that the callers don't need to do this.

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

	* tui/tui-stack.c (tui_locator_window::set_locator_fullname): Call
	rerender.
	(tui_update_locator_fullname, tui_show_frame_info): Don't call
	tui_show_locator_content.
2019-08-30 12:57:09 -06:00
Tom Tromey 99ab33fb2d Swap tui_show_locator_content and tui_locator_window::rerender
This swaps the bodies ot tui_show_locator_content and
tui_locator_window::rerender, so that the latter does the work, and
the former is now just an exported convenience wrapper.

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

	* tui/tui-stack.c (tui_show_locator_content): Move lower.  Rewrite.
	(tui_locator_window::rerender): Rewrite using body of previous
	tui_show_locator_content.
2019-08-30 12:57:08 -06:00
Tom Tromey e594a5d19e Turn two locator functions into methods
This changes tui_set_locator_fullname and tui_set_locator_info to be
methods on tui_locator_window.  This enables some subsequent
cleannups.

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

	* tui/tui-stack.h (struct tui_locator_window) <set_locator_info,
	set_locator_fullname>: New methods.
	* tui/tui-stack.c (tui_locator_window::set_locator_fullname):
	Rename from tui_set_locator_fullname.
	(tui_locator_window::set_locator_info): Rename from
	tui_set_locator_info.  Return bool.
	(tui_update_locator_fullname, tui_show_frame_info): Update.
2019-08-30 12:57:07 -06:00
Tom Tromey 715bb467fe Don't call tui_refresh_all from show_layout
show_layout calls tui_refresh_all in one case.  However, it doesn't
need to any more, because the resize method on each window will also
update the contents.

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

	* tui/tui-layout.c (show_layout): Don't call tui_refresh_all.
2019-08-30 12:57:07 -06:00
Tom Tromey 772f3f0398 Don't call touchwin in tui_gen_win_info::refresh_window
The call to touchwin in tui_gen_win_info::refresh_window was an
artifact of some earlier refactorings.  Testing shows it isn't needed
any more -- I believe it was only ever needed for the data item window
display problem; but that's been solved more locally.

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

	* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Don't
	call touchwin.
2019-08-30 12:57:06 -06:00
Tom Tromey 108e13abdf Remove NULL checks from box_win
box_win can't be called with a NULL window, or with an invisible
window.  So, the NULL checks in that function can be removed.

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

	* tui/tui-wingeneral.c (box_win): Assume win_info and
	win_info->handle cannot be NULL.
2019-08-30 12:57:05 -06:00
Tom Tromey cdaa6eb439 Simplify register display
This patch starts with the observation that the code in
tui_data_window::display_registers_from can all be replaced with a
call to resize.  To make this work propertly, it also changes
tui_display_register to be the "rerender" method on
tui_data_item_window.

The refresh_window method is needed due to the use of nested windows
here.  The ncurses man page makes it sound like this is not very well
supported; and experience bears this out: negelecting the touchwin
call in this path will cause the register window to blank when
switching focus.

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

	* tui/tui-regs.h (struct tui_data_item_window) <rerender,
	refresh_window>: Declare.
	* tui/tui-regs.c (tui_data_window::display_registers_from): Call
	resize.
	(tui_data_item_window::rerender): Rename from
	tui_display_register.
	(tui_data_item_window::refresh_window): New method.
	* tui/tui-layout.c (tui_gen_win_info::resize): Do nothing on
	no-op.
2019-08-30 12:57:05 -06:00
Tom Tromey 89df7f9056 Private data members in tui_data_window
This changes tui_data_window so that the data members are private.
This required the addition of a simple accessor method in one case.

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

	* tui/tui-regs.h (struct tui_data_window) <regs_content,
	regs_column_count, current_group>: Move later.  Now private.
	<get_current_group>: New method.
	* tui/tui-regs.c (tui_reg_command): Update.
	* tui/tui-layout.c (tui_set_layout): Update.
2019-08-30 12:57:04 -06:00
Tom Tromey 1bf2866a59 Remove some calls in tui_data_window
This patch removes a call to erase_data_content in refresh_all and
then removes some other calls that are more clearly unnecessary once
one follows calls from that point.

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

	* tui/tui-regs.c (tui_data_window::display_registers_from_line)
	(tui_data_window::rerender): Don't call
	check_and_display_highlight_if_needed.
	(tui_data_window::refresh_all): Remove call to
	erase_data_content.
2019-08-30 12:57:04 -06:00
Tom Tromey 0670413d0e Remove some checks of .empty()
A few methods in tui_data_window check whether the contents are empty;
but all the callers already check this, so these calls can be removed.

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

	* tui/tui-regs.c (tui_data_window::last_regs_line_no)
	(tui_data_window::display_registers_from)
	(tui_data_window::display_reg_element_at_line)
	(tui_data_window::display_registers_from_line): Remove checks of
	"empty".
2019-08-30 12:57:03 -06:00
Tom Tromey 18bb55c722 Remove tui_data_window::display_all_data
tui_data_window::rerender clears the data item windows, and then calls
display_all_data.  However, that method only does anything if the
contents are not empty.  So, display_all_data can be renamed and the
wrapper removed.

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

	* tui/tui-regs.h (struct tui_data_window) <display_all_data>:
	Don't declare.
	* tui/tui-regs.c (tui_data_window::show_registers): Call
	rerender.
	(tui_data_window::rerender): Rename from display_all_data.
	(tui_data_window::rerender): Remove old implementation.
2019-08-30 12:57:02 -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 04c72a68e0 Change some tui_data_window methods to be private
Turning various calls into methods has made it possible to now change
some tui_data_window methods to be private.

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

	* tui/tui-regs.h (struct tui_data_window) <last_regs_line_no,
	line_from_reg_element_no, first_reg_element_no_inline,
	display_all_data, delete_data_content_windows,
	erase_data_content>: Now private.
2019-08-20 16:45:50 -06: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 100c2bf31f Remove tui_data_window::display_regs
There's no need for tui_data_window::display_regs any more (if there
ever was).  All the paths through data window construction will end up
setting this to true.  This patch removes the member.

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

	* tui/tui-regs.h (struct tui_data_window) <display_regs>: Remove.
	* tui/tui-regs.c (tui_data_window::show_registers): Update.
	(tui_data_window::check_register_values): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey fa4dc567ae Remove indirection from tui_data_window::regs_content
tui_data_window::regs_content is currently a vector of unique_ptr.
However, due to the way this is managed now, there is no need to keep
the pointers -- it can simply be a vector of the objects themselves.
This patch removes this extra layer of indirection.

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

	* tui/tui-regs.h (struct tui_data_window): Use
	DISABLE_COPY_AND_ASSIGN.
	<regs_content>: Change type, removing unique_ptr.
	<tui_data_window>: Add move constructor.
	* tui/tui-regs.c (tui_data_window::show_registers)
	(tui_data_window::show_register_group)
	(tui_data_window::display_registers_from)
	(tui_data_window::display_registers_from)
	(tui_data_window::first_data_item_displayed)
	(tui_data_window::delete_data_content_windows)
	(tui_data_window::rerender, tui_data_window::refresh_window)
	(tui_data_window::check_register_values): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey ca02d7c800 Add two methods to tui_data_window
This changes tui_show_registers and tui_show_register_group to be
methods on tui_data_window.

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

	* tui/tui-regs.h (struct tui_data_window) <show_registers,
	show_register_group>: Declare.
	(tui_show_register_group): Don't declare.
	* tui/tui-regs.c (tui_data_window::show_registers): Rename from
	tui_show_registers.
	(tui_data_window::show_register_group): Rename from
	tui_show_register_group.
	(tui_data_window::check_register_values, tui_reg_command):
	Update.
	* tui/tui-layout.c (tui_set_layout): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey 63356bfda1 Change tui_check_register_values to be a method
This changes tui_check_register_values to be a method on
tui_data_window.  An additional check in tui_register_changed is
needed, because TUI_DATA_WIN could be NULL at this point.

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

	* tui/tui-regs.h (struct tui_data_window) <check_register_values>:
	Declare.
	(tui_check_register_values): Don't declare.
	* tui/tui-regs.c (tui_data_window::check_register_values): Rename
	from tui_check_register_values.
	* tui/tui-hooks.c (tui_register_changed): Update.
2019-08-20 16:45:50 -06:00
Tom Tromey 42cc14a753 Rearrange tui-regs.c some more
This moves tui_reg_layout later in tui-regs.c, closer to where it is
used.

It also changes tui_show_registers not to enable the TUI or change the
layout -- this is already done by this point by all the callers.

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

	* tui/tui-regs.c (tui_reg_layout): Move later.
	(tui_show_registers): Don't enable TUI mode or change layout.
2019-08-20 16:45:50 -06:00