Commit Graph

98177 Commits

Author SHA1 Message Date
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 8e2daf1532 Remove redundant check from make_visible
This removes a check of the window type from make_visible.  This
function already checks that the window type is not CMD_WIN near the
top, so this condition can never be false.

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

	* tui/tui-wingeneral.c (make_visible): Remove check of window
	type.
2019-06-25 07:48:35 -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 6a0ee02c22 Remove an unneeded NULL check
show_source_or_disasm_and_command will either create or reset the
source window, so the final NULL check is not necessary.  This patch
removes it.

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

	* tui/tui-layout.c (show_source_or_disasm_and_command): Remove
	NULL check.
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 f83d391c5a Don't use TUI_DISASM_WIN in tui_disasm_window method
The previous patch made it clear that the diassembly window scrolling
method was written to assume there could only ever be a single
disassembly window.  This changes that spot to use "this" rather than
the TUI_DISASM_WIN global.

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

	* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Use
	"this", not TUI_DISASM_WIN.
2019-06-25 07:48:28 -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 0ed69edaab Simplify source and disassembly window creation
Similar to the previous patch, neither make_source_window nor
make_disasm_window could be called when *win_info_ptr was non-NULL.
This patch simplifies the functions by removing the parameter and
having them return their results directly.

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

	* tui/tui-layout.c (make_source_window, make_disasm_window)
	(make_source_or_disasm_window): Remove win_info_ptr parameter.
	Return the new window.
	(show_source_disasm_command, show_data)
	(show_source_or_disasm_and_command): Update.
2019-06-25 07:48:26 -06:00
Tom Tromey 82432e1014 Simplify command window creation
make_command_window is never called when *win_info_ptr is non-NULL, so
this patch simplifies the function by removing the parameter and
having it return its result directly.  This in turn makes it more
obvious that a NULL check in show_source_disasm_command can be
removed.

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

	* tui/tui-layout.c (make_command_window): Remove win_info_ptr
	parameter.  Return the new window.
	(show_source_disasm_command): Update and remove NULL check.
	(show_source_or_disasm_and_command): Update.
2019-06-25 07:48:25 -06:00
Tom Tromey ec328aa512 Remove an unnecessary NULL check from the TUI
In init_and_make_win, opaque_win_info can't be NULL after a new window
is allocated.  This patch removes an unnecessary NULL check.

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

	* tui/tui-layout.c (init_and_make_win): Remove NULL check.
2019-06-25 07:48:25 -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
Jan Beulich 8e5cb9a54e ld/plugins: avoid shadowing a C library symbol
With my (oldish) gcc/glibc combination I'm seeing

.../ld/plugin.c: In function ‘get_lto_kind’:
.../ld/plugin.c:664: error: declaration of ‘index’ shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here
.../ld/plugin.c: In function ‘get_lto_resolution’:
.../ld/plugin.c:685: error: declaration of ‘index’ shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here
.../ld/plugin.c: In function ‘get_lto_visibility’:
.../ld/plugin.c:711: error: declaration of ‘index’ shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here
2019-06-25 12:02:23 +02:00
Jan Beulich ab9f654ca3 bfd/elf-properties: avoid shadowing a C library symbol
With my (oldish) gcc/glibc combination I'm seeing

.../bfd/elf-properties.c: In function ‘elf_find_and_remove_property’:
.../bfd/elf-properties.c:244: error: declaration of ‘remove’ shadows a global declaration
/usr/include/stdio.h:157: error: shadowed declaration is here
2019-06-25 12:01:50 +02:00
Jan Beulich 3e50a591d9 readelf: avoid shadowing a libiberty symbol
With my (oldish) gcc I'm seeing

.../binutils/readelf.c: In function ‘dump_ctf_indent_lines’:
.../binutils/readelf.c:13851: error: declaration of ‘spaces’ shadows a global declaration
.../binutils/../include/libiberty.h:253: error: shadowed declaration is here
2019-06-25 11:09:22 +02:00
Jan Beulich 63160fc996 objdump: avoid shadowing a libiberty symbol
With my (oldish) gcc I'm seeing

.../binutils/objdump.c: In function ‘dump_ctf_indent_lines’:
.../binutils/objdump.c:3210: error: declaration of ‘spaces’ shadows a global declaration
.../binutils/../include/libiberty.h:253: error: shadowed declaration is here
2019-06-25 11:08:53 +02:00
Jan Beulich 2c70385689 x86: correct / adjust debug printing
For quite some time we've been using combinations of bits for
specifying various registers in operands and templates. I think it was
Alan who had indicated that likely the debug printing would need
adjustment as a result. Here we go.

Accumulator handling for GPRs gets changed to match that for FPU regs.
For this to work, OPERAND_TYPE_ACC{32,64} get repurposed, with their
original uses replaced by direct checks of the two bits of interest,
which is cheaper than operand_type_equal() invocations.

For SIMD registers nothing similar appears to be needed, as respective
operands get stripped from the (copy of the) template before pt() is
reached.

The type change on pi() is to silence a compiler diagnostic. Arguably
its other parameter could also be const-qualified.
2019-06-25 09:41:33 +02:00
Jan Beulich 4970191fa5 x86: document certain command line options as "dangerous"
Errata BT36, BT41, and BT230 mean that gas may, when using one ofthese
options, produce code that causes #UD on (at least) SandyBridge systems.
2019-06-25 09:40:44 +02:00
Jan Beulich 54fbadc0c3 x86: drop dqa_mode
I assume this mode was needed when EVEX.W handling wasn't really correct
yet for other than 64-bit mode. It's clearly not needed anymore. Its
elimination also allows dropping the EVEX.W split of VCVT{,U}SI2SS. (For
the record, the dropped mode would have been wrong if used in any table
entry not already guaranteeing EVEX.W=1.)
2019-06-25 09:35:17 +02:00
Jan Beulich a38d71189b x86: don't open code is_any_vex_encoding() 2019-06-25 09:35:17 +02:00
Jan Beulich a280ab8e81 x86: simplify OP_I64()
The only meaningful difference from OP_I() is the handling of the
VEX.W=1 case in 64-bit mode for bytemode being v_mode. Funnel
everything else into OP_I(), and drop no longer needed local
variables.
2019-06-25 09:35:17 +02:00
Jan Beulich e1a1babdad x86: fix (dis)assembly of certain SSE2 insns in 16-bit mode
MOVNTI was wrongly assembled with a 66h prefix. Add IgnoreSize to
address this. It and the scalar to/from integer conversion insns also
were also wrongly using Ev / Gv, leading to 16-bit register names being
printed when 32-bit ones were meant.

Clone the 32-bit SSE2 test to cover both assembler and disassembler.
2019-06-25 09:35:17 +02:00
Jan Beulich b8364fa775 x86-64: also optimize ANDQ with immediate fitting in 7 bits
The same reasoning applies here as did/does for immediates fitting in
31 bits.
2019-06-25 09:35:17 +02:00
Jan Beulich 2a410bd1c3 x86: add CVT{,T}PS2PI cases to xmmwords test
I've (not so) recently noticed this further pair which should be tested
here.
2019-06-25 09:35:17 +02:00
Alan Modra de62696504 Fix logical expression in last commit
* config/tc-ppc.c (ppc_handle_align): Add parentheses.
2019-06-25 16:57:15 +09:30
Alan Modra 22f72c4868 PowerPC nops
This patch corrects ppc rs_align_code handling to choose the alignment
nops based on the machine in force at the alignment directive rather
than the machine at the end of file.

	* config/tc-ppc.h (ppc_nop_select): Declare.
	(NOP_OPCODE): Define.
	* config/tc-ppc.c (ppc_elf_end, ppc_xcoff_end): Zero ppc_cpu.
	(ppc_nop_encoding_for_rs_align_code): New enum.
	(ppc_nop_select): New function.
	(ppc_handle_align): Don't use ppc_cpu here.  Get nop type from frag.
	* testsuite/gas/ppc/groupnop.d,
	* testsuite/gas/ppc/groupnop.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2019-06-25 13:04:40 +09:30
GDB Administrator 2e7c439dec Automatic date update in version.in 2019-06-25 00:00:35 +00:00
Jim Wilson 04b865dc2e RISC-V: Enable lui relaxation for CODE and MERGE sections.
2019-06-24  Ilia Diachkov  <ilia.diachkov@optimitech.com>
	bfd/
	* elfnn-riscv.c (_bfd_riscv_relax_lui): Delete early exit when
	SEC_MERGE or SEC_CODE flags are set.
	(_bfd_riscv_relax_section): New local symtype.  Set sym_sec and
	symtype consistently.  Don't include sec_addr (sym_sec) in symval.
	Add check for SEC_INFO_TYPE_MERGE and call _bfd_merged_section_offset.
	Add sec_addr (sym_sec) after handling merge sections.
2019-06-24 13:50:10 -07:00
H.J. Lu f93ab3a0b8 elf: Remove the property after reporting its removal
commit d2ef37ebd9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Dec 7 08:30:30 2018 -0800

    elf: Report property change when merging properties

failed to remove the property after reporting it has been removed.  This
patch corrects it.

bfd/

	PR ld/24721
	* elf-properties.c (elf_merge_gnu_property_list): Remove the
	property after reporting property removal.

ld/

	PR ld/24721
	* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24721 tests.
	* testsuite/ld-x86-64/pr24721-x32.d: New file.
	* testsuite/ld-x86-64/pr24721.d: Likewise.
	* testsuite/ld-x86-64/pr24721.map: Likewise.
	* testsuite/ld-x86-64/pr24721a.s: Likewise.
	* testsuite/ld-x86-64/pr24721b.s: Likewise.
2019-06-24 11:08:57 -07:00
Tom de Vries 164e3873cf [gdb/testsuite] Fix label reference in implptr-64bit.exp
When running gdb.dwarf2/implptr-64bit.exp with board cc-with-dwz-m, we run into:
...
dwz: dwz.c:2363: checksum_die: \
  Assertion `\
    ((!op_multifile && !rd_multifile && !fi_multifile) || cu != die_cu (ref)) \
    && (!op_multifile || cu->cu_chunk == die_cu (ref)->cu_chunk)' failed.
cc-with-tweaks.sh: line 218: 13030 Aborted  \
  $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null
...
In other words, PR dwz/24170.

The trigger for the dwz PR is when intra-CU references are encoded using
section-relative encoding DW_FORM_ref_addr, but could have been encoded using
CU-relative encoding DW_FORM_ref4.

Fix the intra-CU '%' label reference in implptr-64bit.exp.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/implptr-64bit.exp: Fix intra-CU '%' label reference.
2019-06-24 18:26:10 +02:00
Tom de Vries 824eacee59 [gdb/testsuite] Fix DW_AT_decl_file in gdb.trace tests
When running gdb.trace/{entry-values.exp,unavailable-dwarf-piece.exp} with
board cc-with-dwz, we run into two failures related to the DW_AT_decl_file
attribute:
- The encoding DW_FOR_sdata is used for DW_AT_decl_file, while the attribute
  is required to have a an "unsigned integer constant" value.
- The DW_AT_decl_file attributes refer to a file with index one, while there's
  no such file.

Fix this by using DW_FOR_udata and the value 0, meaning "no file specified".

Tested on x86_64-linux with board native-gdbserver.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

	* gdb.trace/entry-values.exp: Use DW_FORM_udata instead of
	DW_FOR_sdata for DW_AT_decl_file.  Use 0 for DW_AT_decl_file.
	* gdb.trace/unavailable-dwarf-piece.exp: Same.
2019-06-24 13:29:23 +02:00
Tom de Vries 385b97d3ac [gdb/testsuite] Fix inter-cu refs in inlined_subroutine-inheritance.exp
When running gdb.dwarf2/inlined_subroutine-inheritance.exp with board
cc-with-dwz, we run into:
...
dwz: inlined_subroutine-inheritance: Couldn't find DIE referenced by \
  DW_AT_abstract_origin
...

The problem is that the DW_AT_abstract_origin attributes refer to DIEs in
other CUs, while the references are encoded using the cu-relative encoding
DW_FORM_ref4.

Fix this by forcing the references to use DW_FORM_ref_addr.

Tested on x86_64-linux.

Tested with commit c24bdb023c "Introduce dwarf2_cu::get_builder" reverted,
and verified that the test-case fails in the same way before and after this
patch.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/inlined_subroutine-inheritance.exp:
2019-06-24 12:20:39 +02:00