Commit Graph

174 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 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
Tom Tromey 0b5ec21882 Introduce tui_data_window::last_regs_line_no method
This changes tui_last_regs_line_no into a method on tui_data_window,
allowing the removal of uses of the TUI_DATA_WIN global.

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

	* tui/tui-regs.h (tui_last_regs_line_no): Don't declare.
	* tui/tui-regs.c (tui_data_window::last_regs_line_no): Rename from
	tui_last_regs_line_no.
	(tui_display_reg_element_at_line)
	(tui_display_registers_from_line): Update.
	* tui/tui-data.h (struct tui_data_window) <last_regs_line_no>: New
	method.
2019-07-17 12:18:53 -06:00
Tom Tromey 06210ce428 Introduce can_scroll method
This introduces a "can_scroll" method, removing a spot that explicitly
checks a window's type.

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

	* tui/tui-data.h (struct tui_win_info) <can_scroll>: New method.
	(struct tui_cmd_window) <can_scroll>: New method.
	* tui/tui-command.c (tui_dispatch_ctrl_char): Use can_scroll
	method.
2019-07-17 12:18:51 -06:00
Tom Tromey 0598af4880 Fix TUI use of "has_break" field
The TUI uses the "has_break" in two different ways: sometimes as a
boolean, and sometimes as flags.

This patch changes the TUI to be more type-safe here, and fixes the
code.  I could not find a bug that this caused, so apparently this is
just cosmetic.

This deletes some code from tui_set_disassem_content.  Whenver this is
called, I believe the TUI updates the breakpoint information
afterward, so this assignment is redundant; which is good because it
is also incorrect.

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

	PR tui/24724:
	* tui/tui-winsource.c (tui_clear_source_content): Update.
	(tui_source_window_base::set_is_exec_point_at): Fix comment.
	(tui_update_breakpoint_info): Update.
	(tui_set_exec_info_content): Update.
	* tui/tui-source.c (tui_set_source_content_nil): Update.
	* tui/tui-disasm.c (tui_set_disassem_content): Don't set
	has_break.
	* tui/tui-data.h (enum tui_bp_flag): New.
	(tui_bp_flags): New enum flags type.
	(struct tui_source_element) <break_mode>: Change type.  Rename
	from has_break.
	(TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT)
	(TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): Don't define.  Now enum
	constants.
	* tui/tui-winsource.h: Fix comment.
2019-07-04 10:36:31 -06:00
Tom Tromey fb54fa768d Make tui_gen_win_info constructor protected
Now that all the window types have their own concrete classes, the
tui_gen_win_info constructor can be protected.

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

	* tui/tui-layout.c (init_and_make_win): Assert on unrecognized
	type.
	* tui/tui-data.h (struct tui_gen_win_info): Make constructor
	protected.
2019-06-25 07:48:51 -06:00
Tom Tromey 53e7cdbaa1 Remove union tui_which_element
This removes union tui_which_element, instead moving the content
directly into tui_source_window_base.  This allows for the deletion of
a fair amount of code.  Now the TUI window hierarchy is more
type-safe.  In particular, there is never any confusion now about
which members are in use by which subtype.

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

	* tui/tui-winsource.h (tui_update_source_window_as_is)
	(tui_alloc_source_buffer, tui_line_is_displayed)
	(tui_addr_is_displayed): Change type of win_info.
	* tui/tui-winsource.c (tui_update_source_window_as_is)
	(tui_clear_source_content, tui_show_source_line)
	(tui_show_source_content, tui_source_window_base::refill)
	(tui_source_window_base::set_is_exec_point_at)
	(tui_source_window_base::set_is_exec_point_at)
	(tui_update_breakpoint_info, tui_set_exec_info_content): Update.
	(tui_alloc_source_buffer, tui_line_is_displayed)
	(tui_addr_is_displayed): Change type of win_info.  Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
	(tui_source_window_base::do_make_visible_with_new_height):
	Update.
	* tui/tui-source.c (tui_set_source_content)
	(tui_set_source_content_nil)
	(tui_source_window::do_scroll_vertical): Update.
	* tui/tui-layout.c (show_layout): Update.
	* tui/tui-disasm.c (tui_set_disassem_content)
	(tui_disasm_window::do_scroll_vertical): Update.
	* tui/tui-data.h (tui_win_content): Remove.
	(struct tui_gen_win_info) <content, content_size>: Remove.
	(struct tui_source_element): Add initializers and destructor.
	(union tui_which_element, struct tui_win_element): Remove.
	(struct tui_source_window_base) <content>: New field.
	(struct tui_data_window): Remove destructor.
	(tui_alloc_content, tui_free_win_content)
	(tui_free_all_source_wins_content): Don't declare.
	* tui/tui-data.c (tui_initialize_static_data): Update.
	(init_content_element, tui_alloc_content): Remove.
	(~tui_gen_win_info): Update.
	(~tui_data_window, tui_free_all_source_wins_content)
	(tui_free_win_content, free_content, free_content_elements):
	Remove.
2019-06-25 07:48:50 -06:00
Tom Tromey 02c28df011 Use bool for is_exec_point
This changes tui_source_element::is_exec_point to be a bool.  I looked
at also changing "has_break", but it turns out that this field is used
inconsistently (sometimes as flags and sometimes as a bool), and so
needs more invesstigation before it can be changed.

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

	* tui/tui-winsource.c (tui_clear_source_content)
	(tui_source_window_base::set_is_exec_point_at): Update.
	* tui/tui-source.c (tui_set_source_content_nil): Update.
	* tui/tui-data.h (struct tui_source_element) <is_exec_point>: Now
	a bool.
	* tui/tui-data.c (init_content_element): Update.
2019-06-25 07:48:49 -06:00
Tom Tromey 6658b1bf6c Fix "auxiliary" typo
The TUI has a function called tui_win_is_auxillary, but the word
should actually be spelled "auxiliary".  This fixes the typo.

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

	* tui/tui-wingeneral.c (tui_gen_win_info::make_visible): Update.
	* tui/tui-win.c (make_invisible_and_set_new_height): Update.
	* tui/tui-layout.c (init_and_make_win): Update.
	* tui/tui.h (enum tui_win_type): Update.
	* tui/tui-data.h (tui_win_is_auxiliary): Rename from
	tui_win_is_auxillary.
	* tui/tui-data.c (tui_win_is_auxiliary): Rename from
	tui_win_is_auxillary.
2019-06-25 07:48:49 -06:00
Tom Tromey 21e1c91ef9 Separate out data window
This removes "data_window" from union tui_which_element and updates
the uses.  It also changes how tui_data_window refers to the register
data, and changes it not to need the "content" field at all (though as
this is in a base class, it can't yet be removed).

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

	* tui/tui-wingeneral.c (tui_data_window::refresh_window): Update.
	* tui/tui-windata.c (tui_data_window::first_data_item_displayed)
	(tui_delete_data_content_windows, tui_display_all_data)
	(tui_data_window::do_scroll_vertical, tui_display_data_from):
	Update.
	* tui/tui-win.c (tui_data_window::set_new_height): Simplify.
	* tui/tui-regs.c (tui_last_regs_line_no)
	(tui_line_from_reg_element_no, tui_first_reg_element_no_inline)
	(tui_show_registers): Update.
	(tui_show_register_group): Return void.  Update.
	(tui_display_registers_from, tui_display_reg_element_at_line)
	(tui_display_registers_from_line, tui_check_register_values):
	Update.
	* tui/tui-data.h (union tui_which_element) <data_window>: Remove
	member.
	(struct tui_data_window) <regs_content>: Now a std::vector.
	<regs_content_count>: Remove.
	(tui_add_content_elements, tui_free_data_content): Don't declare.
	* tui/tui-data.c (tui_data_window::clear_detail): Update.
	(init_content_element): Remove DATA_WIN case.  Add assert.
	(tui_add_content_elements): Remove.
	(tui_data_window): Update.
	(tui_free_data_content): Remove.
	(free_content_elements): Remove DATA_WIN case.
2019-06-25 07:48:48 -06:00
Tom Tromey 115ac53b85 Remove "data_content" and "data_content_count" from TUI data window
The TUI has some stub code for adding data other than registers to the
data window.  However, it doesn't do anything, and apparently never
has.  This removes the dead code.

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

	* tui/tui-data.c (tui_data_item_window): Update.
	* tui/tui-windata.h (tui_check_data_values): Don't declare.
	* tui/tui-windata.c (tui_display_all_data)
	(tui_display_data_from_line): Update.
	(tui_check_data_values): Remove.
	* tui/tui-regs.c (tui_show_register_group)
	(tui_display_reg_element_at_line): Update.
	* tui/tui-hooks.c (tui_register_changed)
	(tui_refresh_frame_and_register_information): Call
	tui_check_register_values.
	* tui/tui-data.h (struct tui_data_window) <data_content,
	data_content_count, data_type>: Remove.
	(enum tui_data_type): Remove.
2019-06-25 07:48:48 -06:00
Tom Tromey eaf9738bed Turn tui_first_data_item_displayed into a method
tui_first_data_item_displayed is only called from tui_data_window
methods, so turn it into a method as well.

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

	* tui/tui-windata.h (tui_first_data_item_displayed): Don't
	declare.
	* tui/tui-windata.c (tui_data_window::first_data_item_displayed):
	Rename from tui_first_data_item_displayed.  Update.
	(tui_data_window::refresh_all)
	(tui_data_window::do_scroll_vertical): Update.
	* tui/tui-data.h (struct tui_data_window)
	<first_data_item_displayed>: Declare new method.
2019-06-25 07:48:48 -06:00
Tom Tromey 31ca47237f Remove tui_init_generic_part
tui_init_generic_part has a single caller, so simply inline it there.

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

	* tui/tui-data.h (tui_init_generic_part): Don't declare.
	* tui/tui-data.c (tui_init_generic_part): Remove, moving
	contents...
	(tui_initialize_static_data): ...here.
2019-06-25 07:48:47 -06:00
Tom Tromey 41bcff7fee Separate out data item window
This introduces a new subclass of tui_gen_win_info for the data item
windows, letting us remove another element from tui_which_element.

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

	* tui/tui-regs.c (tui_show_registers, tui_show_register_group)
	(tui_display_registers_from, tui_check_register_values): Update.
	(tui_display_register): Remove win_info parameter; update.
	(tui_get_register): Change type of parameters.
	* tui/tui-data.h (struct tui_data_element): Remove.
	(union tui_which_element) <data>: Remove.
	<data_window>: Change type.
	(struct tui_data_item_window): New.
	* tui/tui-data.c (init_content_element): Remove DATA_ITEM_WIN
	case.  Add assert.
	(~tui_data_item_window): New destructor.
	(free_content_elements): Remove DATA_ITEM_WIN case.
2019-06-25 07:48:47 -06:00
Tom Tromey dd835f8b70 Remove command from tui_which_element
union tui_which_element has a "command" member, but it is never used.
This removes it.

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

	* tui/tui-data.h (struct tui_command_element): Remove.
	(union tui_which_element) <command>: Remove.
	* tui/tui-data.c (init_content_element): Remove CMD_WIN case.  Add
	assert.
	(free_content_elements): Remove CMD_WIN case.
2019-06-25 07:48:46 -06:00
Tom Tromey bd7db367c4 Remove layout_def::split
The "split" field in struct layout_def is never used, so this patch
removes it.

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

	* tui/tui-layout.c (tui_set_layout): Update.
	* tui/tui-data.h (struct tui_layout_def) <split>: Remove.
	* tui/tui-data.c (layout_def): Update.
2019-06-25 07:48:45 -06:00
Tom Tromey 3add462fff Separate out locator window
This introduces a new subclass of tui_gen_win_info for the locator,
letting us remove another element from union tui_which_element.

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

	* tui/tui-wingeneral.c (tui_refresh_all): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
	(tui_source_window_base::set_new_height): Update.
	* tui/tui-stack.c (tui_make_status_line): Change parameter type.
	Update.
	(tui_set_locator_fullname, tui_set_locator_info)
	(tui_show_frame_info): Update.
	* tui/tui-source.c (tui_set_source_content)
	(tui_source_is_displayed): Update.
	* tui/tui-layout.c (show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-disasm.c (tui_set_disassem_content)
	(tui_get_begin_asm_address): Update.
	* tui/tui-data.h (struct tui_locator_element): Remove.
	(union tui_which_element) <locator>: Remove.
	(struct tui_locator_window): New.
	(tui_locator_win_info_ptr): Change return type.
	* tui/tui-data.c (_locator): Change type.
	(tui_locator_win_info_ptr): Change return type.
	(init_content_element): Remove LOCATOR_WIN case.  Add assert.
	(tui_alloc_content): Add assert.
2019-06-25 07:48:45 -06:00
Tom Tromey 489e9d8b7b Separate out execution-info window
This pulls the EXEC_INFO_WIN case out into its own subclass of
tui_gen_win_info.  This lets us remove an element from
union tui_which_element.

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

	* tui/tui-winsource.c
	(tui_exec_info_window::maybe_allocate_content): New method.
	(tui_set_exec_info_content, tui_show_exec_info_content): Update.
	* tui/tui-layout.c (init_and_make_win): Add EXEC_INFO_WIN case.
	(make_source_or_disasm_window): Add cast.
	* tui/tui-data.h (union tui_which_element) <simple_string>:
	Remove.
	(struct tui_source_info): New.
	(struct tui_source_window_base) <execution_info>: Change type.
	* tui/tui-data.c (init_content_element): Remove EXEC_INFO_WIN
	case, and add assert.
	(tui_alloc_content): Add assert.
2019-06-25 07:48:44 -06:00
Tom Tromey c3fabb7d69 Remove tui_alloc_win_info
There is only a single caller of tui_alloc_win_info, and we're going
to add more "new" cases to that caller, so remove tui_alloc_win_info
and inline it into init_and_make_win.

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

	* tui/tui-data.h (tui_alloc_win_info): Don't declare.
	* tui/tui-layout.c (init_and_make_win): Use "new" directly.
	* tui/tui-data.c (tui_alloc_win_info): Remove.
2019-06-25 07:48:44 -06:00
Tom Tromey 5fcee43a96 Introduce tui_win_info::make_visible_with_new_height
This changes make_visible_with_new_height to be a method on
tui_win_info, letting us remove a spot that checks the window type.

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

	* tui/tui-win.c (tui_source_window_base::update_tab_width): Call
	make_visible_with_new_height method.
	(tui_win_info::make_visible_with_new_height): New method.
	(tui_source_window_base::do_make_visible_with_new_height)
	(tui_data_window::do_make_visible_with_new_height)
	(tui_cmd_window::do_make_visible_with_new_height): New methods.
	(make_visible_with_new_height): Remove.
	(tui_resize_all, tui_adjust_win_heights): Use
	make_visible_with_new_height method.
	* tui/tui-data.h (struct tui_win_info)
	<do_make_visible_with_new_height, make_visible_with_new_height>:
	New methods.
	(struct tui_source_window_base, struct tui_data_window)
	(struct tui_cmd_window) <do_make_visible_with_new_height>: New
	methods.
2019-06-25 07:48:43 -06:00
Tom Tromey d83f1fe65d Introduce tui_win_info::update_tab_width
This introduces a new tui_win_info::update_tab_width method, and
changes the TUI to call it.  This fixes another spot that was checking
the window type.

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

	* tui/tui-win.c (tui_source_window_base::update_tab_width): New
	method.
	(update_tab_width): Call update_tab_width method.
	* tui/tui-data.h (struct tui_win_info)
	(struct tui_source_window_base) <update_tab_width>: New methods.
2019-06-25 07:48:43 -06:00
Tom Tromey 17374de40e Introduce enum tui_box
This adds a new enum to the TUI, replacing two #define constants,
providing better type safety.

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

	* tui/tui-wingeneral.h (tui_make_window): Change type of "box_it"
	parameter.
	* tui/tui-wingeneral.c (tui_make_window): Change type of "box_it"
	parameter.
	(tui_gen_win_info::make_visible): Update.
	* tui/tui-layout.c (init_and_make_win): Change type of "box_it"
	parameter.
	* tui/tui-data.h (enum tui_box): New enum.
	(BOX_WINDOW, DONT_BOX_WINDOW): Remove defines.
2019-06-25 07:48:42 -06:00
Tom Tromey f936bca26d Remove some TUI static allocations
The TUI statically allocates the "execution_info" for the source and
disassembly windows.  However, there's no deep reason to do this, and
this approach makes it harder to allow multiple such windows.

This patch removes the static data and changes the code to simply
allocate these windows as needed.  This required pushing some code
into the tui_gen_win_info destructor, but that seems like a good idea
anyhow.

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

	* tui/tui-layout.c (make_source_or_disasm_window): Always use
	init_and_make_win for EXEC_INFO_WIN.
	* tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: No
	longer inline.
	(struct tui_win_info) <~tui_win_info>: Inline.
	(tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr):
	Don't declare.
	* tui/tui-data.c (source_win, disasm_win): Remove globals.
	(tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr):
	Remove.
	(tui_initialize_static_data): Update.
	(~tui_gen_win_info): Handle more cleanup here.
	(~tui_source_window_base): Delete "execution_info".
	(~tui_win_info): Move code to ~tui_gen_win_info; remove.
2019-06-25 07:48:42 -06:00
Tom Tromey d6ba6a1164 Introduce tui_gen_win_info::reset method
This introduces the tui_gen_win_info::reset method and changes various
places to use it.  This led to the realization that the can_highlight
member only needs to be set during construction, so this patch makes
that change as well.  Finally, init_and_make_win is drastically
simplified.

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

	* tui/tui-layout.c (make_command_window): Don't set
	can_highlight.
	(show_source_disasm_command): Call the reset method.
	(show_data): Don't set can_highlight.  Call the reset method.
	(tui_gen_win_info::reset): Rename from init_gen_win_info
	(init_and_make_win): Simplify.  Return tui_gen_win_info.
	(show_source_or_disasm_and_command): Call the reset method.
	* tui/tui-data.h (struct tui_gen_win_info) <reset>: New method.
	(struct tui_cmd_window): Set can_highlight.
2019-06-25 07:48:41 -06:00
Tom Tromey 48a3bd16c2 Move make_visible method to tui_gen_win_info
This moves the make_visible method from tui_win_info to its base
class, tui_gen_win_info.  This allows the removal of another window
type check.

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

	* tui/tui-wingeneral.c (tui_gen_win_info::make_visible): Rename
	from make_visible.
	(tui_make_visible, tui_make_invisible): Rewrite.
	(tui_win_info::make_visible): Remove.
	(tui_source_window_base::make_visible): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <make_visible>: New
	method.  Moved from...
	(struct tui_win_info) <make_visible>: ...here.
2019-06-25 07:48:41 -06:00
Tom Tromey c3bd716ffc Remove tui_scroll_direction enum
The tui_scroll_direction enum is not really needed, because it's
simple to adapt the various scrolling methods to use the sign of their
argument as the direction in which to scroll.

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

	* tui/tui-winsource.c
	(tui_source_window_base::do_scroll_horizontal): Remove direction
	parameter.
	* tui/tui-windata.c (tui_data_window::do_scroll_vertical): Remove
	direction parameter.
	* tui/tui-win.c (tui_win_info::forward_scroll)
	(tui_win_info::backward_scroll, tui_win_info::left_scroll)
	(tui_win_info::right_scroll): Update.
	* tui/tui-source.c (tui_source_window::do_scroll_vertical): Remove
	direction parameter.
	* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Remove
	direction parameter.
	* tui/tui-data.h (enum tui_scroll_direction): Remove.
	(struct tui_win_info) <do_scroll_vertical, do_scroll_horizontal>:
	Remove direction parameter.
	(struct tui_source_window_base, struct tui_source_window)
	(struct tui_disasm_window, struct tui_data_window)
	(struct tui_cmd_window): Update.
2019-06-25 07:48:41 -06:00
Tom Tromey 152f3f4b33 Introduce tui_gen_win_info::name method
This removes tui_win_name and replaces it with a method on
tui_gen_win_info, removing another spot that switched on window type.

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

	* tui/tui-win.c (window_name_completer, tui_set_focus)
	(tui_all_windows_info): Use name method.
	* tui/tui-data.h (struct tui_gen_win_info)
	(struct tui_source_window, struct tui_disasm_window)
	(struct tui_data_window, struct tui_cmd_window) <name>: New
	method.
	(tui_win_name): Don't declare.
	* tui/tui-data.c (tui_partial_win_by_name): Use name method.
	(tui_win_name): Remove.
2019-06-25 07:48:38 -06:00
Tom Tromey 5b81daba91 Introduce refresh_window method
This replaces tui_refresh_win with a new refresh_window method.  This
removes another spot that was checking the window's type.

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

	* tui/tui-winsource.c (tui_erase_source_content)
	(tui_show_source_content, tui_show_exec_info_content)
	(tui_erase_exec_info_content): Use refresh_window method.
	* tui/tui-wingeneral.h (tui_refresh_win): Don't declare.
	* tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Rename
	from tui_refresh_win.
	(tui_data_window::refresh_window): New method.
	(tui_win_info::refresh, tui_source_window_base::refresh)
	(tui_refresh_all): Use refresh_window method.
	* tui/tui-stack.c (tui_show_locator_content): Call refresh_window
	method.
	* tui/tui-regs.c (tui_display_register): Call refresh_window
	method.
	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Call refresh_window method.
	* tui/tui-data.h (struct tui_gen_win_info)
	(struct tui_data_window, struct tui_cmd_window) <refresh_window>:
	New method.
2019-06-25 07:48:38 -06:00
Tom Tromey cb2ce89305 Derive tui_win_info from tui_gen_win_info
This changes tui_win_info to derive from tui_gen_win_info, rather than
having a tui_gen_win_info as a member.  This removes a layer of member
access from the entire TUI, which is why this patch is so large.  This
change will enable further removal of switches based on window type.

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

	* tui/tui.c (tui_rl_other_window, tui_enable)
	(tui_is_window_visible, tui_get_command_dimension): Update.
	* tui/tui-winsource.c (tui_update_source_window_as_is)
	(tui_clear_source_content, tui_erase_source_content)
	(tui_show_source_line, tui_source_window_base::refill)
	(tui_source_window_base::do_scroll_horizontal)
	(tui_source_window_base::set_is_exec_point_at)
	(tui_update_breakpoint_info, tui_set_exec_info_content)
	(tui_alloc_source_buffer, tui_line_is_displayed)
	(tui_addr_is_displayed): Update.
	* tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win)
	(tui_check_and_display_highlight_if_needed)
	(tui_win_info::make_visible, tui_win_info::refresh)
	(tui_refresh_all): Update.
	* tui/tui-windata.c (tui_first_data_item_displayed)
	(tui_delete_data_content_windows, tui_erase_data_content)
	(tui_display_all_data, tui_data_window::refresh_all)
	(tui_check_data_values): Update.
	* tui/tui-win.c (window_name_completer, tui_update_gdb_sizes)
	(tui_set_win_focus_to, tui_win_info::forward_scroll)
	(tui_win_info::backward_scroll, tui_refresh_all_win)
	(tui_resize_all, tui_set_focus, tui_all_windows_info)
	(update_tab_width, tui_set_win_height, tui_adjust_win_heights)
	(tui_source_window_base::set_new_height)
	(tui_data_window::set_new_height)
	(make_invisible_and_set_new_height)
	(make_visible_with_new_height, new_height_ok)
	(parse_scrolling_args): Update.
	* tui/tui-stack.c (tui_show_frame_info): Update.
	* tui/tui-source.c (tui_set_source_content)
	(tui_set_source_content_nil, tui_source_is_displayed)
	(tui_source_window::do_scroll_vertical): Update.
	* tui/tui-regs.c (tui_show_registers, tui_show_register_group)
	(tui_display_registers_from, tui_display_reg_element_at_line)
	(tui_check_register_values, tui_reg_command): Update.
	* tui/tui-layout.c (tui_default_win_height)
	(show_source_disasm_command, show_data, init_and_make_win)
	(show_source_or_disasm_and_command): 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_cont_sig)
	(tui_getc): Update.
	* tui/tui-disasm.c (tui_set_disassem_content)
	(tui_disasm_window::do_scroll_vertical): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>:
	Now virtual.
	(struct tui_win_info): Derive from tui_gen_win_info.
	<~tui_win_info>: Mark as override.
	<generic>: Remove member.
	* tui/tui-data.c (tui_cmd_window::clear_detail, tui_next_win)
	(tui_prev_win, tui_partial_win_by_name, tui_win_info)
	(~tui_data_window, ~tui_win_info)
	(tui_free_all_source_wins_content): Update.
	* tui/tui-command.c (tui_refresh_cmd_win): Update.
2019-06-25 07:48:37 -06:00
Tom Tromey ab313b35e5 Use new and delete for tui_gen_win_info
This changes tui_gen_win_info to be allocated with new and destroyed
with delete.

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

	* tui/tui-layout.c (init_and_make_win): Use new.
	* tui/tui-data.h (struct tui_gen_win_info): Add constructor,
	destructor, initializers.
	(tui_alloc_generic_win_info): Don't declare.
	* tui/tui-data.c (_locator): Add argument to constructor.
	(source_win, disasm_win): New globals.
	(exec_info): Remove.
	(tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr):
	Update.
	(tui_alloc_generic_win_info): Remove.
	(init_content_element): Use new.
	(tui_win_info::tui_win_info): Update.
	(free_content_elements) <case DATA_WIN>: Use delete.
2019-06-25 07:48:37 -06:00
Tom Tromey dc2c33e456 Change tui_which_element::data_window to be a pointer
A coming patch will add a constructor to tui_gen_win_info.  However,
because the tui_which_element union contains an object of this type,
first something must be done here in order to avoid having a union
with a member that has a constructor.  This patch changes this element
to be a pointer instead.

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

	* tui/tui-wingeneral.c (tui_refresh_win): Update.
	* tui/tui-windata.c (tui_first_data_item_displayed)
	(tui_delete_data_content_windows): Update.
	* tui/tui-win.c (tui_data_window::set_new_height): Update.
	* tui/tui-regs.c (tui_show_registers, tui_show_register_group)
	(tui_display_registers_from, tui_check_register_values): Update.
	* tui/tui-data.h (union tui_which_element) <data_window>: Now a
	pointer.
	* tui/tui-data.c (init_content_element): Update.  Allocate the new
	window.
	(tui_free_data_content): Update.
	(free_content_elements) <case DATA_WIN>: Free the window.
2019-06-25 07:48:36 -06:00
Tom Tromey 214a5cbea6 Introduce set_highlight method
This introduces the tui_win_info::set_highlight method, and changes
the highlighting-related code to use bool rather than int.

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

	* tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win):
	Update.
	* tui/tui-layout.c (make_command_window)
	(show_source_disasm_command, show_data, init_and_make_win)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-data.h (struct tui_win_info) <set_highlight>: New
	method.
	<can_highight, is_highlighted>: Now bool.
	(tui_set_win_highlight): Don't declare.
	* tui/tui-data.c (tui_set_win_highlight): Remove.
2019-06-25 07:48:36 -06:00
Tom Tromey 8903bd8a37 Introduce max_height method
This introduces the tui_win_info::max_height method and changes
new_height_ok to use it, rather than checking the window type
directly.

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

	* tui/tui-win.c (tui_win_info::max_height)
	(tui_cmd_window::max_height): New methods.
	(new_height_ok): Call max_height.
	* tui/tui-data.h (struct tui_win_info, struct tui_cmd_window)
	<max_height>: New method.
2019-06-25 07:48:35 -06:00
Tom Tromey 3f02ce1e3d Introduce set_new_height method
This introduces tui_win_info::set_new_height and implements it in the
subclasses as appropriate.  This removes another switch on the window
type.

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

	* tui/tui-win.c (tui_source_window_base::set_new_height)
	(tui_data_window::set_new_height): New methods.
	(make_invisible_and_set_new_height): Call set_new_height method.
	* tui/tui-data.h (struct tui_win_info)
	(struct tui_source_window_base, struct tui_data_window)
	<set_new_height>: New method.
2019-06-25 07:48:34 -06:00
Tom Tromey 1825f487ae Introduce the refresh_all method
This introduces the tui_win_info::refresh_all method and implements it
as needed in subclasses.  The name and comment are a bit of a guess on
my part.  The main benefit of this patch is removing another switch on
the type of the window.

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

	* tui/tui.c (tui_rl_other_window): Call the refresh_all method.
	* tui/tui-windata.c (tui_data_window::refresh_all): Rename from
	tui_refresh_data_win.
	* tui/tui-win.c (tui_source_window_base::refresh_all): New
	method.
	(tui_refresh_all_win): Call the refresh_all method.
	(tui_set_focus): Likewise.
	* tui/tui-data.h (struct tui_win_info) <refresh_all>: New method.
	(struct tui_source_window_base, struct tui_data_window) <refresh>:
	Likewise.
2019-06-25 07:48:34 -06:00
Tom Tromey ad54d15bdb Introduce two TUI source window methods
This adds two methods to the TUI source window.  These are just
renamings of existing functions.  It also changes the source window
list to have a more precise type, letting the code be more type-safe.
This will be useful again later.

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

	* tui/tui-winsource.h (tui_refill_source_window)
	(tui_set_is_exec_point_at): Don't declare.
	* tui/tui-winsource.c (tui_update_source_windows_with_addr)
	(tui_source_window_base::refill): Rename from
	tui_refill_source_window.
	(tui_source_window_base::do_scroll_horizontal): Update.
	(tui_source_window_base::set_is_exec_point_at): Rename from
	tui_set_is_exec_point_at.
	(tui_update_all_breakpoint_info): Update.
	* tui/tui-stack.c (tui_show_frame_info): Update.
	* tui/tui-layout.c (show_data): Add cast.
	* tui/tui-hooks.c (tui_redisplay_source): Call refill method.
	* tui/tui-data.h (struct tui_source_window_base) <refill,
	set_is_exec_point_at>: New methods.
	(tui_source_windows, tui_add_to_source_windows): Update types.
	(tui_add_to_source_windows): Remove redundant declaration.
	* tui/tui-data.c (source_windows): Store tui_source_window_base.
	(tui_source_windows): Change return type.
	(tui_clear_source_windows_detail): Update.
	(tui_add_to_source_windows): Change type of parameter.
	(tui_free_all_source_wins_content): Update.
2019-06-25 07:48:34 -06:00
Tom Tromey 2042b506c8 Introduce the refresh method
This adds tui_win_info::refresh and updates tui_source_window_base to
implement it as well.  This lets us simplify tui_refresh_all, removing
a check of the window type.

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

	* tui/tui-wingeneral.c (tui_win_info::refresh)
	(tui_source_window_base::refresh): New methods.
	(tui_refresh_all): Call the refresh method.
	* tui/tui-data.h (struct tui_win_info)
	(struct tui_source_window_base) <refresh>: New method.
2019-06-25 07:48:33 -06:00
Tom Tromey 56122977c0 Use bool for visibility
This changes the visibility-related functions and data members in the
TUI to use bool rather than int.

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

	* tui/tui.h (tui_is_window_visible): Return bool.
	* tui/tui.c (tui_is_window_visible): Return bool.
	* tui/tui-wingeneral.c (tui_make_window, make_visible)
	(tui_make_visible, tui_make_invisible)
	(tui_win_info::make_visible)
	(tui_source_window_base::make_visible, make_all_visible)
	(tui_make_all_visible, tui_make_all_invisible): Update.
	* tui/tui-windata.c (tui_delete_data_content_windows): Update.
	* tui/tui-data.h (struct tui_gen_win_info) <is_visible>: Now
	bool.
	(struct tui_win_info, struct tui_source_window_base)
	(struct tui_cmd_window) <make_visible>: Change parameter to bool.
	* tui/tui-data.c (tui_init_generic_part): Update.
2019-06-25 07:48:33 -06:00
Tom Tromey cda37efbff Introduce make_visible method
This introduceds the make_visible to tui_win_info and overrides it in
subclasses as appropriate.  This allows the removal of the
tui_win_is_source_type, as it is no longer used.

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

	* tui/tui-wingeneral.c (tui_win_info::make_visible)
	(tui_source_window_base::make_visible): New methods.
	(make_all_visible): Make method call.
	* tui/tui-data.h (struct tui_win_info) <make_visible>: New method.
	(struct tui_source_window_base, struct tui_cmd_window): Override
	make_visible.
	(tui_win_is_source_type): Don't declare.
	* tui/tui-data.c (tui_win_is_source_type): Remove.
2019-06-25 07:48:32 -06:00
Tom Tromey 63901aeccf Inline constructors and initializers
This inlines the constructors and initializers for tui_cmd_window and
tui_data_window.  This makes the code a bit simpler.

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

	* tui/tui-data.h (struct tui_data_window, struct tui_cmd_window):
	Inline constructor.  Add initializers for members.
	* tui/tui-data.c (tui_data_window, tui_cmd_window): Remove
	constructors; now inline in class.
2019-06-25 07:48:31 -06:00
Tom Tromey ceb13a1382 Change tui_data_window::display_regs to bool
This changes tui_data_window::display_regs to bool and updates the
uses.

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

	* tui/tui-regs.c (tui_show_registers): Update.
	* tui/tui-data.h (struct tui_data_window) <display_regs>: Now
	bool.
	* tui/tui-data.c (tui_data_window::clear_detail)
	(tui_data_window): Update.
2019-06-25 07:48:31 -06:00
Tom Tromey 238eb706f9 Remove struct tui_data_info
Like the previous two patches, this removes struct tui_data_info in
favor of inlining its contents into tui_data_window.  This was the
last member of the tui_win_info detail union, so that is removed.

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

	* tui/tui-windata.c (tui_display_all_data)
	(tui_display_data_from_line, tui_display_data_from)
	(tui_check_data_values, tui_data_window::do_scroll_vertical):
	Update.
	* tui/tui-regs.c (tui_last_regs_line_no)
	(tui_line_from_reg_element_no, tui_first_reg_element_no_inline)
	(tui_show_registers, tui_show_register_group)
	(tui_display_registers_from, tui_display_reg_element_at_line)
	(tui_display_registers_from_line, tui_check_register_values)
	(tui_reg_next, tui_reg_prev): Update.
	* tui/tui-layout.c (tui_set_layout, show_data): Update.
	* tui/tui-data.h (struct tui_data_info): Remove.  Move contents to
	tui_data_window.
	(struct tui_win_info) <detail>: Remove.  Add new fields from
	tui_data_info.
	(TUI_DATA_WIN): Add cast.
	* tui/tui-data.c (tui_data_window::clear_detail, tui_data_window)
	(~tui_data_window): Simplify.
2019-06-25 07:48:30 -06:00
Tom Tromey 81491aa096 Remove struct tui_command_info
Like the previous patch, this removes tui_command_info in favor of
putting it elements directly into tui_cmd_window.

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

	* tui/tui-layout.c (show_source_disasm_command)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-io.c (update_cmdwin_start_line)
	(tui_redisplay_readline): Update.
	* tui/tui-data.h (struct tui_command_info): Remove.
	(struct tui_win_info) <detail>: Remove command_info member.
	(struct tui_data_window) <start_line>: New member, from
	tui_command_info.
	(TUI_CMD_WIN): Add casts.
2019-06-25 07:48:30 -06:00
Tom Tromey e6e4150110 Remove struct tui_source_info
The tui_source_info struct is used as a member of the "detail" union
in tui_win_info, and this member of the union is only used by source
and disassembly windows.  This patch removes tui_source_info and moves
its members directly to tui_source_window_base.  This simplifies the
code by removing a layer of references from many places.  In a few
spots, a new cast was needed, but most of these will be removed by the
end of the series.

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

	* tui/tui-winsource.c (tui_update_source_window)
	(tui_refill_source_window)
	(tui_source_window_base::do_scroll_horizontal)
	(tui_update_breakpoint_info, tui_set_exec_info_content)
	(tui_show_exec_info_content, tui_erase_exec_info_content)
	(tui_clear_exec_info_content): Update.
	* tui/tui-wingeneral.c (make_all_visible, tui_refresh_all):
	Update.
	* tui/tui-win.c (make_invisible_and_set_new_height)
	(make_visible_with_new_height): Update.
	* tui/tui-source.c (tui_set_source_content)
	(tui_show_symtab_source): Update.
	* tui/tui-layout.c (extract_display_start_addr)
	(show_source_disasm_command, show_data)
	(make_source_or_disasm_window)
	(show_source_or_disasm_and_command): Update.
	* tui/tui-disasm.c (tui_set_disassem_content): Simplify.
	(tui_disasm_window::do_scroll_vertical): Remove shadowing
	"gdbarch".
	* tui/tui-data.h (struct tui_source_info): Remove.  Move contents
	to tui_source_window_base.
	(struct tui_win_info) <detail>: Remove source_info member.
	(struct tui_source_window_base) <has_locator>: Inline.
	Move contents from tui_source_info; rename has_locator member to
	m_has_locator.
	(TUI_SRC_WIN, TUI_DISASM_WIN): Add casts.
	* tui/tui-data.c (tui_source_window_base::has_locator): Move to
	header file.
	(tui_source_window_base::clear_detail, ~tui_source_window_base):
	Simplify.
	(tui_free_all_source_wins_content): Cast to
	tui_source_window_base.
2019-06-25 07:48:30 -06:00
Tom Tromey 44f0e208eb Introduce has_locator method
This changes tui_win_has_locator to be a method on tui_win_info, and
changes the locator code to use bool rather than int.

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

	* tui/tui-win.c (make_invisible_and_set_new_height)
	(make_visible_with_new_height): Call has_locator method.
	* tui/tui-layout.c (show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Update for bool change.
	* tui/tui-data.h (struct tui_source_info) <has_locator>: Now bool.
	(tui_win_info) <has_locator>: New method.
	(struct tui_source_window_base) <has_locator>: New method.
	(tui_win_has_locator): Don't declare.
	* tui/tui-data.c (tui_source_window_base::has_locator): Rename
	from tui_win_has_locator.
	(tui_source_window_base): Use false, not FALSE.
2019-06-25 07:48:29 -06:00
Tom Tromey 7778b9128f Remove tui_clear_win_detail
An earlier patch changed the context of the sole call to
tui_clear_win_detail to make it clear that this can never be called
with a NULL window pointer.  So, remove tui_clear_win_detail in favor
of calling the method directly.

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

	* tui/tui-data.h (tui_clear_win_detail): Don't declare.
	* tui/tui-data.c (tui_clear_source_windows_detail): Call the
	clear_detail method directly.
	(tui_clear_win_detail): Remove.
2019-06-25 07:48:29 -06:00
Tom Tromey 13446e05a3 Introduce methods for scrolling
This changes the TUI to use virtual methods on the various window
types for scrolling.  Window-specific functions for this purpose are
renamed to be methods, and the generic tui_scroll function is removed
as it is no longer called.

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

	* tui/tui-winsource.h (tui_horizontal_source_scroll):  Don't
	declare.
	* tui/tui-winsource.c
	(tui_source_window_base::do_scroll_horizontal): Rename from
	tui_horizontal_source_scroll.
	* tui/tui-windata.h (tui_vertical_data_scroll): Don't declare.
	* tui/tui-windata.c (tui_data_window::do_scroll_vertical): Rename
	from tui_vertical_data_scroll.
	* tui/tui-win.h (tui_scroll): Don't declare.
	* tui/tui-win.c (tui_win_info::forward_scroll)
	(tui_win_info::backward_scroll, tui_win_info::left_scroll)
	(tui_win_info::right_scroll): Rename and update.
	(tui_scroll_forward_command, tui_scroll_backward_command)
	(tui_scroll_left_command, tui_scroll_right_command): Update.
	(tui_scroll): Remove.
	* tui/tui-source.h: Don't declare tui_vertical_source_scroll.
	* tui/tui-source.c (tui_source_window::do_scroll_vertical): Rename
	from tui_vertical_source_scroll.
	* tui/tui-disasm.h (tui_vertical_disassem_scroll): Don't declare.
	* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Rename
	from tui_vertical_disassem_scroll.
	* tui/tui-data.h (struct tui_win_info) <do_scroll_vertical,
	do_scroll_horizontal>: New methods.
	<forward_scroll, backward_scroll, left_scroll, right_scroll>:
	Likewise.
	(struct tui_source_window_base): Add do_scroll_horizontal.
	(struct tui_source_window, struct tui_disasm_window): Add
	do_scroll_vertical.
	(struct tui_data_window, struct tui_cmd_window): Add
	do_scroll_horizontal and do_scroll_vertical.
	* tui/tui-command.c (tui_dispatch_ctrl_char): Use method calls.
2019-06-25 07:48:28 -06:00
Tom Tromey 5cf82909a7 Create tui_disasm_window
This introduces the new tui_disasm_window class, which represents a
disassembly window.  It shares a lot of behavior with the source
window, so a new tui_source_window_base class is also created.

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

	* tui/tui-data.h (struct tui_source_window_base): New struct.
	(struct tui_source_window): Derive from tui_source_window_base.
	(struct tui_disasm_window): New struct.
	* tui/tui-data.c (tui_source_window_base::clear_detail): Rename
	from tui_source_window::clear_detail.
	(tui_source_window_base): Rename from tui_source_window.
	(~tui_source_window_base): Rename from ~tui_source_window.
	(tui_alloc_win_info): Create a tui_disasm_window.
2019-06-25 07:48:27 -06:00
Tom Tromey ee1d42d6c1 Split the tui_win_info destructor
This patch adds destructors to tui_source_window and tui_data_window,
and splits ~tui_win_info as appropriate.

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

	* tui/tui-data.h (struct tui_source_window)
	(struct tui_data_window): Declare destructors.
	* tui/tui-data.c (~tui_source_window, ~tui_data_window): New
	destructors.
	(tui_win_info): Simplify.
2019-06-25 07:48:27 -06:00
Tom Tromey b4eb24524b Remove tui_list
This removes the tui_list type in favor of a std::vector.

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

	* tui/tui-winsource.c (tui_display_main)
	(tui_update_source_windows_with_addr)
	(tui_update_all_breakpoint_info): Update.
	* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
	(new_height_ok, parse_scrolling_args): Update.
	* tui/tui-stack.c (tui_show_frame_info): Update.
	* tui/tui-data.h (struct tui_list): Remove.
	(tui_source_windows): Return a reference to a std::vector.
	* tui/tui-data.c (source_windows): Now a std::vector.
	(tui_source_windows): Change return type.
	(tui_clear_source_windows): Rewrite.
	(tui_clear_source_windows_detail, tui_add_to_source_windows)
	(tui_free_all_source_wins_content): Rewrite.
2019-06-25 07:48:27 -06:00
Tom Tromey 8761a91b26 Introduce tui_win_info::clear_detail method
This introduces the clear_detail method and updates the various
subclasses of tui_win_info to implement it.  A subsequent patch will
remove tui_clear_win_detail, but that isn't done for now because at
this point it isn't readily obvious that the NULL check is not needed.

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

	* tui/tui-data.h (struct tui_win_info, struct tui_source_window)
	(struct tui_data_window, struct tui_cmd_window): Declare
	clear_detail method.
	* tui/tui-data.c (tui_source_window::clear_detail)
	(tui_cmd_window::clear_detail, tui_data_window::clear_detail): New
	methods.
	(tui_clear_win_detail): Simplify.
2019-06-25 07:48:26 -06:00
Tom Tromey 33b906abfa Create subclasses for different window types
This changes the TUI so that each different major window type has its
own subclass.

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

	* tui/tui-data.h (struct tui_win_info): Make constructor
	protected.  Make destructor virtual.  Add initializers.
	(tui_source_window, tui_data_window, tui_cmd_window): New
	classes.
	* tui/tui-data.c (tui_win_info): Rename from init_win_info.  Now a
	constructor.  Add "type" parameter.
	(tui_source_window, tui_data_window, tui_cmd_window): New
	constructors.
	(tui_alloc_win_info): Instantiate the appropriate subclass.
2019-06-25 07:48:24 -06:00
Tom Tromey e7e11af42d Add destructor to tui_win_info
This changes tui_free_window into a destructor for tui_free_window and
then updates the users.

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

	* tui/tui-win.c (tui_resize_all): Use delete.
	* tui/tui-data.h (struct tui_win_info) <~tui_win_info>: Declare
	destructor.
	(tui_free_window): Don't declare.
	* tui/tui-data.c (~tui_win_info): Rename from tui_free_window.
	Update.
2019-06-25 07:48:24 -06:00
Tom Tromey 6792b55e08 Use new and delete for TUI windows
This changes tui_win_info to use new and delete, rather than XNEW and
xfree.

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

	* tui/tui-data.h (struct tui_win_info): Add constructor.
	* tui/tui-data.c (tui_alloc_win_info): Use new.
	(tui_free_window): Use delete.
2019-06-25 07:48:23 -06:00
Tom Tromey 5bff081c10 Remove two unused functions from the TUI
This removes two unused functions from the TUI.  According to
"git grep -G", they have never been used.

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

	* tui/tui-data.h (tui_del_window, tui_del_data_windows): Don't
	declare.
	* tui/tui-data.c (tui_del_window, tui_del_data_windows): Remove.
2019-06-22 15:22:49 -06:00
Tom Tromey e6a1c5cbcb Don't declare tui_init_content_element
I noticed that tui_init_content_element is declared but never defined.
This removes the declaration.  Tested by rebuilding.  (I should have
merged this with the previous patch but I had forgotten that I found
two of these.)

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

	* tui/tui-data.h (tui_init_content_element): Don't declare.
2019-06-19 22:24:30 -06:00
Tom Tromey 6f6ffbeb5a Don't declare tui_init_win_info
I noticed that tui_init_win_info is declared but never defined.  This
removes the declaration.  Tested by rebuilding.

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

	* tui/tui-data.h (tui_init_win_info): Don't declare.
2019-06-19 22:13:44 -06:00
Tom Tromey 1a5c25988e Normalize include guards in gdb
While working on my other scripts to deal with gdb headers, I noticed
that some files were missing include guards.  I wrote a script to add
the missing ones, but found that using the obvious names for the
guards ran into clashes -- for example, gdb/nat/linux-nat.h used
"LINUX_NAT_H", but this was also the script's choice for
gdb/linux-nat.h.

So, I changed the script to normalize all include guards in gdb.  This
patch is the result.

As usual the script is available here:

    https://github.com/tromey/gdb-refactoring-scripts

Tested by rebuilding; I also ran it through "Fedora-x86_64-m64" on the
buildbot.

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

	* yy-remap.h: Add include guard.
	* xtensa-tdep.h: Add include guard.
	* xcoffread.h: Rename include guard.
	* varobj-iter.h: Add include guard.
	* tui/tui.h: Rename include guard.
	* tui/tui-winsource.h: Rename include guard.
	* tui/tui-wingeneral.h: Rename include guard.
	* tui/tui-windata.h: Rename include guard.
	* tui/tui-win.h: Rename include guard.
	* tui/tui-stack.h: Rename include guard.
	* tui/tui-source.h: Rename include guard.
	* tui/tui-regs.h: Rename include guard.
	* tui/tui-out.h: Rename include guard.
	* tui/tui-layout.h: Rename include guard.
	* tui/tui-io.h: Rename include guard.
	* tui/tui-hooks.h: Rename include guard.
	* tui/tui-file.h: Rename include guard.
	* tui/tui-disasm.h: Rename include guard.
	* tui/tui-data.h: Rename include guard.
	* tui/tui-command.h: Rename include guard.
	* tic6x-tdep.h: Add include guard.
	* target/waitstatus.h: Rename include guard.
	* target/wait.h: Rename include guard.
	* target/target.h: Rename include guard.
	* target/resume.h: Rename include guard.
	* target-float.h: Rename include guard.
	* stabsread.h: Add include guard.
	* rs6000-tdep.h: Add include guard.
	* riscv-fbsd-tdep.h: Add include guard.
	* regformats/regdef.h: Rename include guard.
	* record.h: Rename include guard.
	* python/python.h: Rename include guard.
	* python/python-internal.h: Rename include guard.
	* python/py-stopevent.h: Rename include guard.
	* python/py-ref.h: Rename include guard.
	* python/py-record.h: Rename include guard.
	* python/py-record-full.h: Rename include guard.
	* python/py-record-btrace.h: Rename include guard.
	* python/py-instruction.h: Rename include guard.
	* python/py-events.h: Rename include guard.
	* python/py-event.h: Rename include guard.
	* procfs.h: Add include guard.
	* proc-utils.h: Add include guard.
	* p-lang.h: Add include guard.
	* or1k-tdep.h: Rename include guard.
	* observable.h: Rename include guard.
	* nto-tdep.h: Rename include guard.
	* nat/x86-linux.h: Rename include guard.
	* nat/x86-linux-dregs.h: Rename include guard.
	* nat/x86-gcc-cpuid.h: Add include guard.
	* nat/x86-dregs.h: Rename include guard.
	* nat/x86-cpuid.h: Rename include guard.
	* nat/ppc-linux.h: Rename include guard.
	* nat/mips-linux-watch.h: Rename include guard.
	* nat/linux-waitpid.h: Rename include guard.
	* nat/linux-ptrace.h: Rename include guard.
	* nat/linux-procfs.h: Rename include guard.
	* nat/linux-osdata.h: Rename include guard.
	* nat/linux-nat.h: Rename include guard.
	* nat/linux-namespaces.h: Rename include guard.
	* nat/linux-btrace.h: Rename include guard.
	* nat/glibc_thread_db.h: Rename include guard.
	* nat/gdb_thread_db.h: Rename include guard.
	* nat/gdb_ptrace.h: Rename include guard.
	* nat/fork-inferior.h: Rename include guard.
	* nat/amd64-linux-siginfo.h: Rename include guard.
	* nat/aarch64-sve-linux-sigcontext.h: Rename include guard.
	* nat/aarch64-sve-linux-ptrace.h: Rename include guard.
	* nat/aarch64-linux.h: Rename include guard.
	* nat/aarch64-linux-hw-point.h: Rename include guard.
	* mn10300-tdep.h: Add include guard.
	* mips-linux-tdep.h: Add include guard.
	* mi/mi-parse.h: Rename include guard.
	* mi/mi-out.h: Rename include guard.
	* mi/mi-main.h: Rename include guard.
	* mi/mi-interp.h: Rename include guard.
	* mi/mi-getopt.h: Rename include guard.
	* mi/mi-console.h: Rename include guard.
	* mi/mi-common.h: Rename include guard.
	* mi/mi-cmds.h: Rename include guard.
	* mi/mi-cmd-break.h: Rename include guard.
	* m2-lang.h: Add include guard.
	* location.h: Rename include guard.
	* linux-record.h: Rename include guard.
	* linux-nat.h: Add include guard.
	* linux-fork.h: Add include guard.
	* i386-darwin-tdep.h: Rename include guard.
	* hppa-linux-offsets.h: Add include guard.
	* guile/guile.h: Rename include guard.
	* guile/guile-internal.h: Rename include guard.
	* gnu-nat.h: Rename include guard.
	* gdb-stabs.h: Rename include guard.
	* frv-tdep.h: Add include guard.
	* f-lang.h: Add include guard.
	* event-loop.h: Add include guard.
	* darwin-nat.h: Rename include guard.
	* cp-abi.h: Rename include guard.
	* config/sparc/nm-sol2.h: Rename include guard.
	* config/nm-nto.h: Rename include guard.
	* config/nm-linux.h: Add include guard.
	* config/i386/nm-i386gnu.h: Rename include guard.
	* config/djgpp/nl_types.h: Rename include guard.
	* config/djgpp/langinfo.h: Rename include guard.
	* compile/gcc-cp-plugin.h: Add include guard.
	* compile/gcc-c-plugin.h: Add include guard.
	* compile/compile.h: Rename include guard.
	* compile/compile-object-run.h: Rename include guard.
	* compile/compile-object-load.h: Rename include guard.
	* compile/compile-internal.h: Rename include guard.
	* compile/compile-cplus.h: Rename include guard.
	* compile/compile-c.h: Rename include guard.
	* common/xml-utils.h: Rename include guard.
	* common/x86-xstate.h: Rename include guard.
	* common/version.h: Rename include guard.
	* common/vec.h: Rename include guard.
	* common/tdesc.h: Rename include guard.
	* common/selftest.h: Rename include guard.
	* common/scoped_restore.h: Rename include guard.
	* common/scoped_mmap.h: Rename include guard.
	* common/scoped_fd.h: Rename include guard.
	* common/safe-iterator.h: Rename include guard.
	* common/run-time-clock.h: Rename include guard.
	* common/refcounted-object.h: Rename include guard.
	* common/queue.h: Rename include guard.
	* common/ptid.h: Rename include guard.
	* common/print-utils.h: Rename include guard.
	* common/preprocessor.h: Rename include guard.
	* common/pathstuff.h: Rename include guard.
	* common/observable.h: Rename include guard.
	* common/netstuff.h: Rename include guard.
	* common/job-control.h: Rename include guard.
	* common/host-defs.h: Rename include guard.
	* common/gdb_wait.h: Rename include guard.
	* common/gdb_vecs.h: Rename include guard.
	* common/gdb_unlinker.h: Rename include guard.
	* common/gdb_unique_ptr.h: Rename include guard.
	* common/gdb_tilde_expand.h: Rename include guard.
	* common/gdb_sys_time.h: Rename include guard.
	* common/gdb_string_view.h: Rename include guard.
	* common/gdb_splay_tree.h: Rename include guard.
	* common/gdb_setjmp.h: Rename include guard.
	* common/gdb_ref_ptr.h: Rename include guard.
	* common/gdb_optional.h: Rename include guard.
	* common/gdb_locale.h: Rename include guard.
	* common/gdb_assert.h: Rename include guard.
	* common/filtered-iterator.h: Rename include guard.
	* common/filestuff.h: Rename include guard.
	* common/fileio.h: Rename include guard.
	* common/environ.h: Rename include guard.
	* common/common-utils.h: Rename include guard.
	* common/common-types.h: Rename include guard.
	* common/common-regcache.h: Rename include guard.
	* common/common-inferior.h: Rename include guard.
	* common/common-gdbthread.h: Rename include guard.
	* common/common-exceptions.h: Rename include guard.
	* common/common-defs.h: Rename include guard.
	* common/common-debug.h: Rename include guard.
	* common/cleanups.h: Rename include guard.
	* common/buffer.h: Rename include guard.
	* common/btrace-common.h: Rename include guard.
	* common/break-common.h: Rename include guard.
	* cli/cli-utils.h: Rename include guard.
	* cli/cli-style.h: Rename include guard.
	* cli/cli-setshow.h: Rename include guard.
	* cli/cli-script.h: Rename include guard.
	* cli/cli-interp.h: Rename include guard.
	* cli/cli-decode.h: Rename include guard.
	* cli/cli-cmds.h: Rename include guard.
	* charset-list.h: Add include guard.
	* buildsym-legacy.h: Rename include guard.
	* bfin-tdep.h: Add include guard.
	* ax.h: Rename include guard.
	* arm-linux-tdep.h: Add include guard.
	* arm-fbsd-tdep.h: Add include guard.
	* arch/xtensa.h: Rename include guard.
	* arch/tic6x.h: Add include guard.
	* arch/i386.h: Add include guard.
	* arch/arm.h: Rename include guard.
	* arch/arm-linux.h: Rename include guard.
	* arch/arm-get-next-pcs.h: Rename include guard.
	* arch/amd64.h: Add include guard.
	* arch/aarch64-insn.h: Rename include guard.
	* arch-utils.h: Rename include guard.
	* annotate.h: Add include guard.
	* amd64-darwin-tdep.h: Rename include guard.
	* aarch64-linux-tdep.h: Add include guard.
	* aarch64-fbsd-tdep.h: Add include guard.
	* aarch32-linux-nat.h: Add include guard.

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

	* x86-tdesc.h: Rename include guard.
	* x86-low.h: Add include guard.
	* wincecompat.h: Rename include guard.
	* win32-low.h: Add include guard.
	* utils.h: Rename include guard.
	* tracepoint.h: Rename include guard.
	* tdesc.h: Rename include guard.
	* target.h: Rename include guard.
	* server.h: Rename include guard.
	* remote-utils.h: Rename include guard.
	* regcache.h: Rename include guard.
	* nto-low.h: Rename include guard.
	* notif.h: Add include guard.
	* mem-break.h: Rename include guard.
	* lynx-low.h: Add include guard.
	* linux-x86-tdesc.h: Add include guard.
	* linux-s390-tdesc.h: Add include guard.
	* linux-ppc-tdesc-init.h: Add include guard.
	* linux-low.h: Add include guard.
	* linux-aarch64-tdesc.h: Add include guard.
	* linux-aarch32-low.h: Add include guard.
	* inferiors.h: Rename include guard.
	* i387-fp.h: Rename include guard.
	* hostio.h: Rename include guard.
	* gdbthread.h: Rename include guard.
	* gdb_proc_service.h: Rename include guard.
	* event-loop.h: Rename include guard.
	* dll.h: Rename include guard.
	* debug.h: Rename include guard.
	* ax.h: Rename include guard.
2019-02-07 03:27:23 -07:00
Joel Brobecker 42a4f53d2b Update copyright year range in all GDB files.
This commit applies all changes made after running the gdb/copyright.py
script.

Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.

gdb/ChangeLog:

	Update copyright year range in all GDB files.
2019-01-01 10:01:51 +04:00
Tom Tromey 7806cea723 Deprecate and replace the "tabset" command
The "tabset" command sets the tab width as used by the TUI for source
and disassembly display.

This command has long seemed to be misnamed to me.  It is more in
keeping with gdb design to call it "set tui tab-width".  Also, making
this change allows for the corresponding "show" command to work.

gdb/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	PR tui/18388:
	* NEWS: Mention tabset deprecation.
	* tui/tui-win.c (tui_tab_width, internal_tab_width): New globals.
	(update_tab_width): New function.
	(tui_set_tab_width, tui_show_tab_width): New functions.
	(tui_set_tab_width_command): Use update_tab_width.
	(_initialize_tui_win): Move to end of file.  Deprecate "tabset".
	Add new "set tui tab-width" command.
	* tui/tui-source.c (tui_set_source_content): Update.
	* tui/tui-disasm.c (tui_set_disassem_content): Update.
	* tui/tui-data.h (tui_default_tab_len, tui_set_default_tab_len):
	Don't declare.
	(tui_tab_width): Declare.
	* tui/tui-data.c (default_tab_len, tui_default_tab_len)
	(tui_set_default_tab_len): Remove.

gdb/doc/ChangeLog
2018-10-19  Tom Tromey  <tom@tromey.com>

	PR tui/18388:
	* gdb.texinfo (TUI Commands): Remove tabset documentation.
	(TUI Configuration): Document "set tui tab-width".
2018-10-19 17:22:27 -06:00
Simon Marchi cc5a5ae5b7 Remove unused tui_win_element::highlight
gdb/ChangeLog:

	* tui/tui-data.h (struct tui_win_element) <highlight>: Remove.
	* tui/tui-data.c (init_content_element): Don't initialize it.
2018-09-06 13:35:53 +01:00
Simon Marchi 137be54029 Remove unused tui_win_info::detail::opaque
gdb/ChangeLog:

	* tui/tui-data.h (struct tui_win_info)
	<detail::opaque>: Remove.
	* tui/tui-data.c (init_win_info): Remove assignment.
2018-09-06 12:08:33 +01:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Egeyar Bagcioglu 7fa29be949 Remove unnecessary parentheses in declarations
GCC commit a94975e57 ("C++ warning on vexing parse") introduces new
warnings "unnecessary parentheses in the declaration of ...".  These
cause the build of binutils and gdb to fail.  This patch removes those
parentheses for a successful build.

gdb/ChangeLog:
2017-10-11  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

	* macrotab.h (macro_lookup_inclusion): Remove unnecessary
	parentheses in the declaration.
	(macro_lookup_inclusion): Likewise.
	(macro_lookup_definition): Likewise.
	* p-lang.h (pascal_builtin_types): Likewise.
	* tui/tui-data.c (tui_win_list): Likewise.
	* tui/tui-data.h (tui_win_list): Likewise.
	* utils.h (make_cleanup_free_section_addr_info): Likewise.
2017-10-11 11:00:48 +01:00
Pedro Alves a121b7c1ac -Wwrite-strings: The Rest
This is the remainder boring constification that all looks more of less
borderline obvious IMO.

gdb/ChangeLog:
2017-04-05  Pedro Alves  <palves@redhat.com>

	* ada-exp.y (yyerror): Constify.
	* ada-lang.c (bound_name, get_selections)
	(ada_variant_discrim_type)
	(ada_variant_discrim_name, ada_value_struct_elt)
	(ada_lookup_struct_elt_type, is_unchecked_variant)
	(ada_which_variant_applies, standard_exc, ada_get_next_arg)
	(catch_ada_exception_command_split)
	(catch_ada_assert_command_split, catch_assert_command)
	(ada_op_name): Constify.
	* ada-lang.h (ada_yyerror, get_selections)
	(ada_variant_discrim_name, ada_value_struct_elt): Constify.
	* arc-tdep.c (arc_print_frame_cache): Constify.
	* arm-tdep.c (arm_skip_stub): Constify.
	* ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref)
	(gen_aggregate_elt_ref): Constify.
	* bcache.c (print_bcache_statistics): Constify.
	* bcache.h (print_bcache_statistics): Constify.
	* break-catch-throw.c (catch_exception_command_1):
	* breakpoint.c (struct ep_type_description::description):
	Constify.
	(add_solib_catchpoint): Constify.
	(catch_fork_command_1): Add cast.
	(add_catch_command): Constify.
	* breakpoint.h (add_catch_command, add_solib_catchpoint):
	Constify.
	* bsd-uthread.c (bsd_uthread_state): Constify.
	* buildsym.c (patch_subfile_names): Constify.
	* buildsym.h (next_symbol_text_func, patch_subfile_names):
	Constify.
	* c-exp.y (yyerror): Constify.
	(token::oper): Constify.
	* c-lang.h (c_yyerror, cp_print_class_member): Constify.
	* c-varobj.c (cplus_describe_child): Constify.
	* charset.c (find_charset_names): Add cast.
	(find_charset_names): Constify array and add const_cast.
	* cli/cli-cmds.c (complete_command, cd_command): Constify.
	(edit_command): Constify.
	* cli/cli-decode.c (lookup_cmd): Constify.
	* cli/cli-dump.c (dump_memory_command, dump_value_command):
	Constify.
	(struct dump_context): Constify.
	(add_dump_command, restore_command): Constify.
	* cli/cli-script.c (get_command_line): Constify.
	* cli/cli-script.h (get_command_line): Constify.
	* cli/cli-utils.c (check_for_argument): Constify.
	* cli/cli-utils.h (check_for_argument): Constify.
	* coff-pe-read.c (struct read_pe_section_data): Constify.
	* command.h (lookup_cmd): Constify.
	* common/print-utils.c (decimal2str): Constify.
	* completer.c (gdb_print_filename): Constify.
	* corefile.c (set_gnutarget): Constify.
	* cp-name-parser.y (yyerror): Constify.
	* cp-valprint.c (cp_print_class_member): Constify.
	* cris-tdep.c (cris_register_name, crisv32_register_name):
	Constify.
	* d-exp.y (yyerror): Constify.
	(struct token::oper): Constify.
	* d-lang.h (d_yyerror): Constify.
	* dbxread.c (struct header_file_location::name): Constify.
	(add_old_header_file, add_new_header_file, last_function_name)
	(dbx_next_symbol_text, add_bincl_to_list)
	(find_corresponding_bincl_psymtab, set_namestring)
	(find_stab_function_addr, read_dbx_symtab, start_psymtab)
	(dbx_end_psymtab, read_ofile_symtab, process_one_symbol):
	* defs.h (command_line_input, print_address_symbolic)
	(deprecated_readline_begin_hook): Constify.
	* dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name):
	Constify.
	* event-top.c (handle_line_of_input): Constify and add cast.
	* exceptions.c (catch_errors): Constify.
	* exceptions.h (catch_errors): Constify.
	* expprint.c (print_subexp_standard, op_string, op_name)
	(op_name_standard, dump_raw_expression, dump_raw_expression):
	* expression.h (op_name, op_string, dump_raw_expression):
	Constify.
	* f-exp.y (yyerror): Constify.
	(struct token::oper): Constify.
	(struct f77_boolean_val::name): Constify.
	* f-lang.c (f_word_break_characters): Constify.
	* f-lang.h (f_yyerror): Constify.
	* fork-child.c (fork_inferior): Add cast.
	* frv-tdep.c (struct gdbarch_tdep::register_names): Constify.
	(new_variant): Constify.
	* gdbarch.sh (pstring_ptr, pstring_list): Constify.
	* gdbarch.c: Regenerate.
	* gdbcore.h (set_gnutarget): Constify.
	* go-exp.y (yyerror): Constify.
	(token::oper): Constify.
	* go-lang.h (go_yyerror): Constify.
	* go32-nat.c (go32_sysinfo): Constify.
	* guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify.
	* guile/scm-cmd.c (cmdscm_function): Constify.
	* guile/scm-param.c (pascm_param_value): Constify.
	* h8300-tdep.c (h8300_register_name, h8300s_register_name)
	(h8300sx_register_name): Constify.
	* hppa-tdep.c (hppa32_register_name, hppa64_register_name):
	Constify.
	* ia64-tdep.c (ia64_register_names): Constify.
	* infcmd.c (construct_inferior_arguments): Constify.
	(path_command, attach_post_wait): Constify.
	* language.c (show_range_command, show_case_command)
	(unk_lang_error): Constify.
	* language.h (language_defn::la_error)
	(language_defn::la_name_of_this): Constify.
	* linespec.c (decode_line_2): Constify.
	* linux-thread-db.c (thread_db_err_str): Constify.
	* lm32-tdep.c (lm32_register_name): Constify.
	* m2-exp.y (yyerror): Constify.
	* m2-lang.h (m2_yyerror): Constify.
	* m32r-tdep.c (m32r_register_names): Constify and make static.
	* m68hc11-tdep.c (m68hc11_register_names): Constify.
	* m88k-tdep.c (m88k_register_name): Constify.
	* macroexp.c (appendmem): Constify.
	* mdebugread.c (fdr_name, add_data_symbol, parse_type)
	(upgrade_type, parse_external, parse_partial_symbols)
	(mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab)
	(new_symbol): Constify.
	* memattr.c (mem_info_command): Constify.
	* mep-tdep.c (register_name_from_keyword): Constify.
	* mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env):
	Constify.
	* mi/mi-cmd-stack.c (list_args_or_locals): Constify.
	* mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify.
	* mi/mi-main.c (captured_mi_execute_command): Constify and add
	cast.
	(mi_execute_async_cli_command): Constify.
	* mips-tdep.c (mips_register_name): Constify.
	* mn10300-tdep.c (register_name, mn10300_generic_register_name)
	(am33_register_name, am33_2_register_name)
	* moxie-tdep.c (moxie_register_names): Constify.
	* nat/linux-osdata.c (osdata_type): Constify fields.
	* nto-tdep.c (nto_parse_redirection): Constify.
	* objc-lang.c (lookup_struct_typedef, lookup_objc_class)
	(lookup_child_selector): Constify.
	(objc_methcall::name): Constify.
	* objc-lang.h (lookup_objc_class, lookup_child_selector)
	(lookup_struct_typedef): Constify.
	* objfiles.c (pc_in_section): Constify.
	* objfiles.h (pc_in_section): Constify.
	* p-exp.y (struct token::oper): Constify.
	(yyerror): Constify.
	* p-lang.h (pascal_yyerror): Constify.
	* parser-defs.h (op_name_standard): Constify.
	(op_print::string): Constify.
	(exp_descriptor::op_name): Constify.
	* printcmd.c (print_address_symbolic): Constify.
	* psymtab.c (print_partial_symbols): Constify.
	* python/py-breakpoint.c (stop_func): Constify.
	(bppy_get_expression): Constify.
	* python/py-cmd.c (cmdpy_completer::name): Constify.
	(cmdpy_function): Constify.
	* python/py-event.c (evpy_add_attribute)
	(gdbpy_initialize_event_generic): Constify.
	* python/py-event.h (evpy_add_attribute)
	(gdbpy_initialize_event_generic): Constify.
	* python/py-evts.c (add_new_registry): Constify.
	* python/py-finishbreakpoint.c (outofscope_func): Constify.
	* python/py-framefilter.c (get_py_iter_from_func): Constify.
	* python/py-inferior.c (get_buffer): Add cast.
	* python/py-param.c (parm_constant::name): Constify.
	* python/py-unwind.c (fprint_frame_id): Constify.
	* python/python.c (gdbpy_parameter_value): Constify.
	* remote-fileio.c (remote_fio_func_map): Make 'name' const.
	* remote.c (memory_packet_config::name): Constify.
	(show_packet_config_cmd, remote_write_bytes)
	(remote_buffer_add_string):
	* reverse.c (exec_reverse_once): Constify.
	* rs6000-tdep.c (variant::name, variant::description): Constify.
	* rust-exp.y (rustyyerror): Constify.
	* rust-lang.c (rust_op_name): Constify.
	* rust-lang.h (rustyyerror): Constify.
	* serial.h (serial_ops::name): Constify.
	* sh-tdep.c (sh_sh_register_name, sh_sh3_register_name)
	(sh_sh3e_register_name, sh_sh2e_register_name)
	(sh_sh2a_register_name, sh_sh2a_nofpu_register_name)
	(sh_sh_dsp_register_name, sh_sh3_dsp_register_name)
	(sh_sh4_register_name, sh_sh4_nofpu_register_name)
	(sh_sh4al_dsp_register_name): Constify.
	* sh64-tdep.c (sh64_register_name): Constify.
	* solib-darwin.c (lookup_symbol_from_bfd): Constify.
	* spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify.
	* stabsread.c (patch_block_stabs, read_type_number)
	(ref_map::stabs, ref_add, process_reference)
	(symbol_reference_defined, define_symbol, define_symbol)
	(error_type, read_type, read_member_functions, read_cpp_abbrev)
	(read_one_struct_field, read_struct_fields, read_baseclasses)
	(read_tilde_fields, read_struct_type, read_array_type)
	(read_enum_type, read_sun_builtin_type, read_sun_floating_type)
	(read_huge_number, read_range_type, read_args, common_block_start)
	(find_name_end): Constify.
	* stabsread.h (common_block_start, define_symbol)
	(process_one_symbol, symbol_reference_defined, ref_add):
	* symfile.c (get_section_index, add_symbol_file_command):
	* symfile.h (get_section_index): Constify.
	* target-descriptions.c (tdesc_type::name): Constify.
	(tdesc_free_type): Add cast.
	* target.c (find_default_run_target):
	(add_deprecated_target_alias, find_default_run_target)
	(target_announce_detach): Constify.
	(do_option): Constify.
	* target.h (add_deprecated_target_alias): Constify.
	* thread.c (print_thread_info_1): Constify.
	* top.c (deprecated_readline_begin_hook, command_line_input):
	Constify.
	(init_main): Add casts.
	* top.h (handle_line_of_input): Constify.
	* tracefile-tfile.c (tfile_write_uploaded_tsv): Constify.
	* tracepoint.c (tvariables_info_1, trace_status_mi): Constify.
	(tfind_command): Rename to ...
	(tfind_command_1): ... this and constify.
	(tfind_command): New function.
	(tfind_end_command, tfind_start_command): Adjust.
	(encode_source_string): Constify.
	* tracepoint.h (encode_source_string): Constify.
	* tui/tui-data.c (tui_partial_win_by_name): Constify.
	* tui/tui-data.h (tui_partial_win_by_name): Constify.
	* tui/tui-source.c (tui_set_source_content_nil): Constify.
	* tui/tui-source.h (tui_set_source_content_nil): Constify.
	* tui/tui-win.c (parse_scrolling_args): Constify.
	* tui/tui-windata.c (tui_erase_data_content): Constify.
	* tui/tui-windata.h (tui_erase_data_content): Constify.
	* tui/tui-winsource.c (tui_erase_source_content): Constify.
	* tui/tui.c (tui_enable): Add cast.
	* utils.c (defaulted_query): Constify.
	(init_page_info): Add cast.
	(puts_debug, subset_compare): Constify.
	* utils.h (subset_compare): Constify.
	* varobj.c (varobj_format_string): Constify.
	* varobj.h (varobj_format_string): Constify.
	* vax-tdep.c (vax_register_name): Constify.
	* windows-nat.c (windows_detach): Constify.
	* xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify.
	* xml-support.c (gdb_xml_end_element): Constify.
	* xml-tdesc.c (tdesc_start_reg): Constify.
	* xstormy16-tdep.c (xstormy16_register_name): Constify.
	* xtensa-tdep.c (xtensa_find_register_by_name): Constify.
	* xtensa-tdep.h (xtensa_register_t::name): Constify.

gdb/gdbserver/ChangeLog:
2017-04-05  Pedro Alves  <palves@redhat.com>

	* gdbreplay.c (sync_error): Constify.
	* linux-x86-low.c (push_opcode): Constify.
2017-04-05 19:21:37 +01:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Patrick Palka 6f1cb6eac2 Remove fields curch and cur_line from TUI_CMD_WIN
These fields are currently used to track the location of the cursor
inside the command window.  But their usefulness is questionable because
ncurses already internally keeps track of the location of the cursor,
whose coordinates we can query using the functions getyx(), getcurx() or
getcury().  It is an unnecessary pain to keep these fields in sync with
ncurses, and their meaning is not well-defined anyway.  For instance, it
is not clear whether the coordinates held in these fields are
authoritative, or whether the coordinates reported by ncurses are.

So to keep things simple, this patch removes these fields and replaces
existing reads of these fields with calls to the appropriate ncurses
querying functions, and replaces writes to these fields with calls to
wmove() (when necessary and applicable).

In the function tui_cont_sig(), I removed the call to wmove() entirely
because moving to (start_line, curch) makes no sense.  The move should
have been to (cur_line, curch) -- which would now be a no-op.

Tested on x86_64 Fedora 22, no obvious regressions.

gdb/ChangeLog:

	* tui/tui-data.h (tui_command_info): Remove fields cur_line and
	curch.
	* tui/tui-data.c (tui_clear_win_detail) [CMD_WIN]: Don't set
	cur_line or curch, instead call wmove().
	(init_win_info) [CMD_WIN]: Likewise.
	* tui/tui-io.c (tui_puts): Likewise. Don't read cur_line,
	instead call getcury().
	(tui_redisplay_readline): Don't set cur_line or curch.
	(tui_mld_erase_entire_line): Don't read cur_line, instead call
	getcury().
	(tui_cont_sig): Remove call to wmove.
	(tui_getc): Don't read cur_line or curch, instead call getcury()
	or getyx().  Don't set curch.
	* tui/tui-win.c (make_visible_with_new_height) [CMD_WIN]: Don't
	set cur_line or curch.  Always move cursor to (0,0).
2015-08-20 23:06:47 -04:00
Andrew Burgess 6dce28e413 gdb: Convert TUI windows names to lower case.
This commit converts the window names for the TUI windows to lower case.
The windows names are already lower case in the documentation, and are
shown as lower case in some of the command completion results.

Given that all the commands that take a window name currently accept
upper or lower case, this commit just changes the window names to lower
case in the remaining places they are displayed by gdb.

gdb/ChangeLog:

	* tui/tui-data.h (SRC_NAME): Convert to lower case.
	(CMD_NAME): Likewise.
	(DATA_NAME): Likewise.
	(DISASSEM_NAME): Likewise.
	* tui/tui-win.c (tui_set_focus): Window names are now lower case.
	(tui_set_win_height): Likewise.
	(parse_scrolling_args): Likewise.
2015-07-10 12:37:57 +01:00
Andrew Burgess f41cbf58f4 gdb: tui_win_name: Make parameter and result const.
This commit makes the parameter and the result for 'tui_win_name'
constant.  There's one place in the code that is then updated as a
result of this change.

gdb/ChangeLog:

	* tui/tui-data.c (tui_partial_win_by_name): Window name is const.
	(tui_win_name): Make parameter and result const.
	* tui/tui-data.h (tui_win_name): Make parameter and result const.
2015-07-06 15:54:21 +01:00
Andrew Burgess 7bd0be3a9b gdb: Remove register class specific layout names.
The layout command supports the layout names $FREGS, $GREGS, $SREGS,
and $REGS. The intention of these layout names was to display the tui
register window with a specific set of registers.

First, these layout names no longer work, and haven't for a while, using
any of them will just result in switching to the general register view.

Second there is already the command 'tui reg GROUP' command to set the
displayed register set to GROUP, so making the layout command also
control the register set feels like unnecessary overloading of the
layout command.

This commit removes all code relating to supporting the register set
specific names from the layout command.  Afterwards the user can select
an available layout using the layout command, and control the choice of
register set using the 'tui reg GROUP' command.

gdb/ChangeLog:

	* tui/tui-layout.c (tui_set_layout): Remove
	tui_register_display_type parameter.  Remove all checking of this
	parameter, and reindent function.  Update header comment.
	(tui_set_layout_for_display_command): Rename to...
	(tui_set_layout_by_name): ...this, and don't check for different
	register class types, don't pass a tui_register_display_type to
	tui_set_layout.  Update header comment.
	(layout_names): Remove register set specific names.
	* tui/tui-layout.h (tui_set_layout): Remove
	tui_register_display_type parameter.
	* tui/tui.c (tui_rl_change_windows): Don't pass a
	tui_register_display_type to tui_set_layout.
	(tui_rl_delete_other_windows): Likewise.
	(tui_enable): Likewise.
	* tui/tui-data.h (TUI_FLOAT_REGS_NAME): Remove.
	(TUI_FLOAT_REGS_NAME_LOWER): Remove.
	(TUI_GENERAL_REGS_NAME): Remove.
	(TUI_GENERAL_REGS_NAME_LOWER): Remove.
	(TUI_SPECIAL_REGS_NAME): Remove.
	(TUI_SPECIAL_REGS_NAME_LOWER): Remove.
	(TUI_GENERAL_SPECIAL_REGS_NAME): Remove.
	(TUI_GENERAL_SPECIAL_REGS_NAME_LOWER): Remove.
	(enum tui_register_display_type): Remove.
	(struct tui_layout_def): Remove regs_display_type and
	float_regs_display_type fields.
	(struct tui_data_info): Remove regs_display_type field.
	(tui_layout_command): Use new name for
	tui_set_layout_for_display_command.
	* tui/tui-data.c (layout_def): Don't initialise removed fields.
	(tui_clear_win_detail): Don't initialise removed fields of
	win_info.
	* tui/tui-regs.c (tui_show_registers): Use new name for
	tui_set_layout_for_display_command.
	* tui/tui.h (tui_set_layout_for_display_command): Rename
	declaration to...
	(tui_set_layout_by_name): ...this.
	* printcmd.c (display_command): Remove tui related layout call,
	and reindent.
2015-05-21 20:47:24 +02:00
Patrick Palka 63ed81829e Make type-safe the 'content' field of struct tui_gen_win_info
The 'content' field of struct tui_gen_win_info currently has type
void ** but the field always stores an object of type tui_win_content.
Instead of unnecessarily casting to and from void ** we should just give
the field the type tui_win_content in the first place.

This patch does this and also eliminates all now-redundant casts
involving the 'content' struct field that I could find.

gdb/ChangeLog:

	* tui/tui-data.h (struct tui_win_element): Forward-declare.
	(tui_win_content): Move declaration.
	(struct tui_gen_win_info): Give 'content' field the
	type tui_win_content.
	* tui/tui-data.c (init_content_element): Remove redundant and
	erroneous casts.
	(tui_add_content_elements): Remove erroneous cast.
	* tui/tui-disasm.c (tui_set_disassem_content): Remove redundant
	casts.
	(tui_get_begin_asm_address): Likewise.
	* tui/tui-regs.c (tui_show_registers): Likewise.
	(tui_show_register_group): Likewise.
	(tui_display_registers_from): Likewise.
	(tui_check_register_values): Likewise.
	* tui/tui-source.c (tui_set_source_content): Likewise.
	(tui_set_source_content_nil): Likewise.
	(tui_source_is_displayed): Likewise.
	* tui/tui-stack.c (tui_show_locator_content): Likewise.
	(tui_set_locator_fullname): Likewise.
	(tui_set_locator_info): Likewise.
	(tui_show_frame_info): Likewise.
	* tui/tui-winsource.c (tui_clear_source_content): Likewise.
	(tui_show_source_line): Likewise.
	(tui_horizontal_source_scroll): Likewise.
	(tui_update_breakpoint_info): Likewise.
	(tui_set_exec_info_content): Likewise.
	(tui_show_exec_info_content): Likewise.
	(tui_alloc_source_buffer): Likewise.
	(tui_line_is_displayed): Likewise.
	(tui_addr_is_displayed): Likewise.
2015-04-27 21:19:53 -04:00
Tom Tromey 52059ffd69 Fix struct, union, and enum nesting in C++
In C, an enum or structure defined inside other structure has global
scope just like it had been defined outside the struct in the first
place.  However, in C++, such a nested structure is given a name that
is nested inside the structure.  This patch moves such affected
structures/enums out to global scope, so that code using them works
the same in C++ as it works today in C.

gdb/ChangeLog:
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	* dwarf2-frame.c (enum cfa_how_kind, struct
	dwarf2_frame_state_reg_info): Move out of struct
	dwarf2_frame_state.
	* dwarf2read.c (struct tu_stats): Move out of struct
	dwarf2_per_objfile.
	(struct file_entry): Move out of struct line_header.
	(struct nextfield, struct nextfnfield, struct fnfieldlist, struct
	typedef_field_list): Move out of struct field_info.
	* gdbtypes.h (enum dynamic_prop_kind, union dynamic_prop_data):
	Move out of struct dynamic_prop.
	(union type_owner, union field_location, struct field, struct
	range_bounds, union type_specific): Move out of struct main_type.
	(struct fn_fieldlist, struct fn_field, struct typedef_field)
	(VOFFSET_STATIC): Move out of struct cplus_struct_type.
	(struct call_site_target, union call_site_parameter_u, struct
	call_site_parameter): Move out of struct call_site.
	* m32c-tdep.c (enum m32c_prologue_kind): Move out of struct
	m32c_prologue.
	(enum srcdest_kind): Move out of struct srcdest.
	* main.c (enum cmdarg_kind): Move out of struct cmdarg.
	* prologue-value.h (enum prologue_value_kind): Move out of struct
	prologue_value.
	* s390-linux-tdep.c (enum s390_abi_kind): Move out of struct
	gdbarch_tdep.
	* stabsread.c (struct nextfield, struct next_fnfieldlist): Move
	out of struct field_info.
	* symfile.h (struct other_sections): Move out of struct
	section_addr_info.
	* symtab.c (struct symbol_cache_slot): Move out struct
	block_symbol_cache.
	* target-descriptions.c (enum tdesc_type_kind): Move out of
	typedef struct tdesc_type.
	* tui/tui-data.h (enum tui_line_or_address_kind): Move out of
	struct tui_line_or_address.
	* value.c (enum internalvar_kind, union internalvar_data): Move
	out of struct internalvar.
	* xtensa-tdep.h (struct ctype_cache): Move out of struct
	gdbarch_tdep.
2015-02-27 17:19:15 +00:00
Eli Zaretskii 9f2850baa3 Leave more space in TUI mode for thread ID.
gdb/tui/tui-data.h (LINE_PREFIX): Make shorter
(MAX_PID_WIDTH): Enlarge from 14 to 19, to leave enough space for
"Thread NNNNN.XXXX" thread ID notation on Windows.
2015-01-16 13:24:20 +02:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Jan Kratochvil 56d397a382 gdb/
* source.c (print_source_lines_base): Print for TUI also "fullname".
	* tui/tui-data.c (init_content_element): Change tui_locator_element
	field to full_name.
	* tui/tui-data.h (struct tui_locator_element): Likewise.
	* tui/tui-disasm.c (tui_show_disassem_and_update_source): Rename
	tui_update_locator_filename calls to tui_update_locator_fullname.
	Replace symtab->filename refererence by symtab_to_fullname call.
	* tui/tui-out.c (tui_field_string): Check for "fullname" now.
	* tui/tui-source.c (tui_set_source_content): Change tui_locator_element
	field to full_name.  Replace symtab->filename refererence by
	symtab_to_fullname call.
	(tui_show_symtab_source): Rename parameter to fullname.  Change
	tui_locator_element field to full_name.
	* tui/tui-stack.c: Include source.h.
	(tui_set_locator_filename): Rename the declaration to ...
	(tui_set_locator_fullname): ... here.  Rename its parameter to
	fullname, updates its comment.
	(tui_set_locator_info): Rename its parameter to fullname.
	(tui_set_locator_filename): Rename the definition to ...
	(tui_set_locator_fullname): ... here.  Rename its parameter to
	fullname, updates its comment.  Change tui_locator_element field to
	full_name.
	(tui_set_locator_info): Rename its parameter to fullname.
	(tui_set_locator_info): Rename callee to tui_set_locator_fullname.
	(tui_update_locator_filename): Rename to ...
	(tui_update_locator_fullname): ... here. Rename callee to
	tui_set_locator_fullname.
	(tui_show_frame_info): Replace symtab->filename refererence by
	symtab_to_fullname call.
	* tui/tui-stack.h (tui_update_locator_filename): Rename to ...
	(tui_update_locator_fullname): ... here.
	* tui/tui-winsource.c (tui_display_main): Rename the callee to
	tui_update_locator_fullname.  Replace symtab->filename refererence by
	symtab_to_fullname call.
	* tui/tui.c (tui_show_source): Rename its parameter to fullname.
	Rename the callee to tui_update_locator_fullname.
	* tui/tui.h (tui_show_source): Rename its parameter to fullname.
2013-02-03 16:16:42 +00:00
Jan Kratochvil aa079c9346 gdb/
* tui/tui-data.c (init_win_info, tui_del_window, tui_free_window):
	Rename field reference filename to fullname.
	* tui/tui-data.h (struct tui_source_info): Rename field filename to
	fullname.  New comment for it.
	* tui/tui-source.c (tui_set_source_content): Rename field reference
	filename to fullname.  Initialize field by symtab_to_fullname now.
	* tui/tui-winsource.c (tui_update_breakpoint_info): Rename field
	reference filename to fullname.  Use symtab_to_fullname during
	comparison.
2013-02-03 16:05:09 +00:00
Joel Brobecker 8acc9f485b Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:41:43 +00:00
Pedro Alves 983fb1048b 2012-03-01 Pedro Alves <palves@redhat.com>
* tui/tui-data.c (set_gen_win_origin): Delete.
	* tui/tui-data.h (tui_set_gen_win_origin): Delete declaration.
	* tui/tui-regs.c (tui_last_reg_element_no_in_line): Delete.
2012-03-01 21:08:07 +00:00
Joel Brobecker c5a5708100 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:28:28 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Ulrich Weigand 13274fc342 * disasm.h (gdb_disassembly): Add GDBARCH parameter.
(gdb_print_insn): Likewise.
	* disasm.c (dump_insns): Add GDBARCH parameter.  Use it instead
	of current_gdbarch.
	(do_mixed_source_and_assembly): Add GDBARCH parameter.  Pass to
	dump_insns.
	(do_assembly_only): Likewise.
	(gdb_disassembly): Add GDBARCH parameter.  Use it instead of
	current_gdbarch.  Pass to subroutines.
	(gdb_print_insn): Add GDBARCH parameter.  Use it instead of
	current_gdbarch.

	* stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member.
	(gdb_disassembly_stub): Pass architecture to gdb_disassembly.
	(do_gdb_disassembly): Add GDBARCH argument.  Store into args.
	(print_frame_info): Pass architecture to do_gdb_disassembly.

	* printcmd.c (print_formatted): Pass architecture to gdb_print_insn.

	* mi/mi-cmd-disas.c: Include "arch-utils.h"
	(mi_cmd_disassemble): Pass architecture to gdb_disassembly.

	* cli/cli-cmds.c: Include "arch-utils.h".
	(print_disassembly): Add GDBARCH parameter.  Pass to gdb_disassembly
	and tui_show_assembly.
	(disassemble_current_function): Pass architecture to
	tui_get_low_disassembly_address and print_disassembly.
	(disassemble_command): Pass architecture to
	tui_get_low_disassembly_address and print_disassembly.

	* tui/tui.c (tui_show_assembly): Add GDBARCH parameter.  Pass to
	tui_update_source_windows_with_addr.

	* tui/tui-data.h (struct tui_locator_element): Add GDBARCH member.
	(struct tui_source_info): Likewise.
	* tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch.

	* tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter.
	Pass to gdb_print_insn.
	(tui_find_disassembly_address): Add GDBARCH parameter.  Pass to
	tui_disassemble.
	(tui_set_disassem_content): Add GDBARCH parameter.  Install into
	source_info.gdbarch.  Pass to tui_disassemble.
	(tui_show_disassem): Add GDBARCH parameter.  Pass to
	tui_update_source_window.
	(tui_show_disassem_and_update_source): Add GDBARCH parameter.  Pass to
	tui_show_disassem and tui_update_source_window.

	(tui_get_begin_asm_address): Return locator architecture in addition
	to locator PC value.

	(tui_get_low_disassembly_address): Add GDBARCH parameter.   Pass to
	tui_get_low_disassembly_address.

	(tui_vertical_disassem_scroll): Pass architecture to subroutines.

	* tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter.
	(tui_show_disassem): Likewise.
	(tui_show_disassem_and_update_source): Likewise.
	(tui_get_begin_asm_address): Return architecture and PC value.

	* tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter.
	(tui_show_assembly): Add GDBARCH parameter.

	* tui/tui-layout.c (extract_display_start_addr): Return current window
	architecture in addition to current PC value.

	(tui_set_layout): Update calls to tui_get_low_disassembly_address and
	extract_display_start_addr.  Pass architecture to
	tui_update_source_windows_with_addr.

	* tui/tui-source.c: Include "objfiles.h".
	(tui_set_source_content): Initialize window architecture.
	(tui_show_symtab_source): Add GDBARCH parameter.  Pass to
	tui_update_source_window_as_is

	* tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter.

	* tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter.
	Install locator architecture.
	(tui_set_locator_filename): Update call.
	(tui_show_frame_info): Pass architecture to tui_set_locator_info
	and subroutines.

	* tui/tui-win.c (make_visible_with_new_height): Pass architecture
	to tui_update_source_window.

	* tui/tui-winsource.c: Include "objfiles.h".
	(tui_display_main): Update call to tui_get_begin_asm_address.
	Pass architecture to tui_update_source_windows_with_addr.
	(tui_update_source_window): Add GDBARCH parameter.  Pass to
	tui_update_source_window_as_is.
	(tui_update_source_window_as_is): Add GDBARCH parameter.
	Pass to tui_set_disassem_content.
	(tui_update_source_windows_with_addr): Add GDBARCH parameter.
	Pass to subroutines.
	(tui_update_source_windows_with_line): Pass objfile architecture
	to subroutines.
	(tui_horizontal_source_scroll): Pass architecture to
	tui_update_source_window_as_is.

	* tui/tui-winsource.h (tui_update_source_window): Add GDBARCH
	parameter.
	(tui_update_source_window_as_is): Likewise.
	(tui_update_source_windows_with_addr): Likewise.
2009-07-02 17:17:42 +00:00