Tom Tromey [Sun, 16 Jun 2019 20:24:42 +0000 (14:24 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 20:22:21 +0000 (14:22 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 20:14:10 +0000 (14:14 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 20:06:18 +0000 (14:06 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 20:04:11 +0000 (14:04 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 20:03:04 +0000 (14:03 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 19:55:51 +0000 (13:55 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 19:46:18 +0000 (13:46 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 17:37:49 +0000 (11:37 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 17:29:45 +0000 (11:29 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 22:31:56 +0000 (16:31 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 17:22:38 +0000 (11:22 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 17:08:43 +0000 (11:08 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 16:52:27 +0000 (10:52 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 16:49:45 +0000 (10:49 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 16:42:09 +0000 (10:42 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 16:37:25 +0000 (10:37 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 16:32:35 +0000 (10:32 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 16:23:10 +0000 (10:23 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 16:13:13 +0000 (10:13 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 15:43:21 +0000 (09:43 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 15:41:06 +0000 (09:41 -0600)]
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.
Jan Beulich [Tue, 25 Jun 2019 10:02:23 +0000 (12:02 +0200)]
ld/plugins: avoid shadowing a C library symbol
With my (oldish) gcc/glibc combination I'm seeing
.../ld/plugin.c: In function \91get_lto_kind\92:
.../ld/plugin.c:664: error: declaration of \91index\92 shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here
.../ld/plugin.c: In function \91get_lto_resolution\92:
.../ld/plugin.c:685: error: declaration of \91index\92 shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here
.../ld/plugin.c: In function \91get_lto_visibility\92:
.../ld/plugin.c:711: error: declaration of \91index\92 shadows a global declaration
/usr/include/string.h:487: error: shadowed declaration is here
Jan Beulich [Tue, 25 Jun 2019 10:01:50 +0000 (12:01 +0200)]
bfd/elf-properties: avoid shadowing a C library symbol
With my (oldish) gcc/glibc combination I'm seeing
.../bfd/elf-properties.c: In function \91elf_find_and_remove_property\92:
.../bfd/elf-properties.c:244: error: declaration of \91remove\92 shadows a global declaration
/usr/include/stdio.h:157: error: shadowed declaration is here
Jan Beulich [Tue, 25 Jun 2019 09:09:22 +0000 (11:09 +0200)]
readelf: avoid shadowing a libiberty symbol
With my (oldish) gcc I'm seeing
.../binutils/readelf.c: In function \91dump_ctf_indent_lines\92:
.../binutils/readelf.c:13851: error: declaration of \91spaces\92 shadows a global declaration
.../binutils/../include/libiberty.h:253: error: shadowed declaration is here
Jan Beulich [Tue, 25 Jun 2019 09:08:53 +0000 (11:08 +0200)]
objdump: avoid shadowing a libiberty symbol
With my (oldish) gcc I'm seeing
.../binutils/objdump.c: In function \91dump_ctf_indent_lines\92:
.../binutils/objdump.c:3210: error: declaration of \91spaces\92 shadows a global declaration
.../binutils/../include/libiberty.h:253: error: shadowed declaration is here
Jan Beulich [Tue, 25 Jun 2019 07:41:33 +0000 (09:41 +0200)]
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.
Jan Beulich [Tue, 25 Jun 2019 07:40:44 +0000 (09:40 +0200)]
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.
Jan Beulich [Tue, 25 Jun 2019 07:28:33 +0000 (09:28 +0200)]
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.)
Jan Beulich [Tue, 25 Jun 2019 07:27:49 +0000 (09:27 +0200)]
x86: don't open code is_any_vex_encoding()
Jan Beulich [Tue, 25 Jun 2019 07:27:05 +0000 (09:27 +0200)]
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.
Jan Beulich [Tue, 25 Jun 2019 07:25:26 +0000 (09:25 +0200)]
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.
Jan Beulich [Tue, 25 Jun 2019 07:23:48 +0000 (09:23 +0200)]
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.
Jan Beulich [Tue, 25 Jun 2019 07:22:38 +0000 (09:22 +0200)]
x86: add CVT{,T}PS2PI cases to xmmwords test
I've (not so) recently noticed this further pair which should be tested
here.
Alan Modra [Tue, 25 Jun 2019 07:26:16 +0000 (16:56 +0930)]
Fix logical expression in last commit
* config/tc-ppc.c (ppc_handle_align): Add parentheses.
Alan Modra [Tue, 25 Jun 2019 00:42:58 +0000 (10:12 +0930)]
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.
GDB Administrator [Tue, 25 Jun 2019 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Mon, 24 Jun 2019 20:50:10 +0000 (13:50 -0700)]
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.
H.J. Lu [Mon, 24 Jun 2019 18:08:40 +0000 (11:08 -0700)]
elf: Remove the property after reporting its removal
commit
d2ef37ebd9f771d06edf1fdea37970f60b242b2d
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.
Tom de Vries [Mon, 24 Jun 2019 16:26:10 +0000 (18:26 +0200)]
[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.
Tom de Vries [Mon, 24 Jun 2019 11:29:23 +0000 (13:29 +0200)]
[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.
Tom de Vries [Mon, 24 Jun 2019 10:20:39 +0000 (12:20 +0200)]
[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:
GDB Administrator [Mon, 24 Jun 2019 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sun, 23 Jun 2019 02:58:39 +0000 (12:28 +0930)]
PR24704, Internal error building skiboot for powerpc64-linux-gnu
While the skiboot linker script bears some culpability in this PR,
it's also true that the GOT indirect to GOT relative optimisation for
16-bit offsets isn't safe. At least, it isn't safe to remove the GOT
entry based on distance between the GOT pointer and symbol calculated
from the preliminary layout. So this patch removes that optimisation,
and reduces the range allowed for 32-bit and 34-bit offsets.
PR 24704
bfd/
* elf64-ppc.c (R_PPC64_GOT16_DS): Don't set has_gotrel.
(ppc64_elf_edit_toc): Don't remove R_PPC64_GOT16_DS got entries.
Reduce range of offsets allowed for other GOT relocs.
ld/
* testsuite/ld-powerpc/elfv2exe.d: Update.
* testsuite/ld-powerpc/elfv2so.d: Update.
Alan Modra [Sun, 23 Jun 2019 02:40:02 +0000 (12:10 +0930)]
PR24689 again, string table corruption
Depending on optimisation level and gcc version, git commit
890f750a3b
introduces a false positive warning that i_shdrp may be used
uninitialized.
PR 24689
* elfcode.h (elf_object_p): Warning fix.
GDB Administrator [Sun, 23 Jun 2019 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 22 Jun 2019 17:50:19 +0000 (11:50 -0600)]
Remove tui_first_data_element_no_in_line
tui_first_data_element_no_in_line is never used. This patch removes
it. Tested by rebuilding, and by grep.
gdb/ChangeLog
2019-06-22 Tom Tromey <tom@tromey.com>
* tui/tui-windata.h (tui_first_data_element_no_in_line): Don't
declare.
* tui/tui-windata.c (tui_first_data_element_no_in_line): Remove.
Tom Tromey [Sun, 16 Jun 2019 16:04:49 +0000 (10:04 -0600)]
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.
Tom de Vries [Sat, 22 Jun 2019 08:59:37 +0000 (10:59 +0200)]
[gdb] Fix s390x -m31 build
When building gdb on s390x with -m31, we run into this Wformat
warning (which Werror turns into an error):
...
gdb/dwarf2read.c: In function \
'void create_addrmap_from_aranges(dwarf2_per_objfile*, \
dwarf2_section_info*)':
gdb/dwarf2read.c:3277:22: error: format '%zu' expects argument of type \
'size_t', but argument 3 has type 'int' [-Werror=format=]
warning (_("Section .debug_aranges in %s entry at offset %zu "
...
The Wformat warning is triggered in this statement:
...
warning (_("Section .debug_aranges in %s entry at offset %zu "
"length %s exceeds section length %s, "
"ignoring .debug_aranges."),
objfile_name (objfile), entry_addr - section->buffer,
plongest (bytes_read + entry_length),
pulongest (section->size));
...
where 'entry_addr - section->buffer' is of type ptrdiff_t and '%zu' prints an
unsigned with the same size as size_t/ssize_t.
On s390x with -m31, we have:
- size_t : unsigned long int (32-bit)
- ptrdiff_t: int (32-bit)
Wformat warns against this because even though long int and int have the same
size, the types are not compatible.
[ The Wformat warning is to similar to what we would get for x86_64 -m32
(where long and int are also the same size) and:
...
int i;
printf ("%ld", i);
... ]
Fix this by using '%s' and plongest instead of '%zu' to print ptrdiff_t.
Build and reg-tested on x86_64.
gdb/ChangeLog:
2019-06-22 Tom de Vries <tdevries@suse.de>
* dwarf2read.c (create_addrmap_from_aranges)
(read_debug_names_from_section): Print ptrdiff_t using '%s' and plongest
instead of '%zu'.
GDB Administrator [Sat, 22 Jun 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Fri, 21 Jun 2019 21:56:18 +0000 (23:56 +0200)]
[gdb/testsuite] Compile index-cache.c with -Wl,--build-id
When testing gdb.base/index-cache.exp using a gcc build without
--enable-linker-build-id we get:
...
FAIL: gdb.base/index-cache.exp: \
test_cache_enabled_miss: at least one file was created
FAIL: gdb.base/index-cache.exp: \
test_cache_enabled_miss: couldn't get executable build id
FAIL: gdb.base/index-cache.exp: \
test_cache_enabled_hit: check index-cache stats
...
With "set debug index-cache on" we find:
...
(gdb) file index-cache
Reading symbols from index-cache...
index cache: objfile index-cache has no build id
...
The problem is that a build-id is required for the index-cache functionality.
Fix this by compiling index-cache.c with -Wl,--build-id.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-06-21 Tom de Vries <tdevries@suse.de>
* gdb.base/index-cache.exp: Add additional_flags=-Wl,--build-id.
H.J. Lu [Fri, 21 Jun 2019 20:18:41 +0000 (13:18 -0700)]
i386: Break i386-dis-evex.h into small files
Break i386-dis-evex.h into small files such that each file is included
just once.
* i386-dis-evex.h: Break into ...
* i386-dis-evex-len.h: New file.
* i386-dis-evex-mod.h: Likewise.
* i386-dis-evex-prefix.h: Likewise.
* i386-dis-evex-reg.h: Likewise.
* i386-dis-evex-w.h: Likewise.
* i386-dis.c: Include i386-dis-evex-reg.h, i386-dis-evex-prefix.h,
i386-dis-evex.h, i386-dis-evex-len.h, i386-dis-evex-w.h and
i386-dis-evex-mod.h.
Simon Marchi [Fri, 21 Jun 2019 18:10:15 +0000 (14:10 -0400)]
dwarf2read: Get rid of VEC (dwarf2_section_info_def)
This patch removes uses of VEC (dwarf2_section_info_def) in favor of
std::vector<dwarf2_section_info>. The conversion is relatively
straightforward, no function changes are intended.
gdb/ChangeLog:
* dwarf2read.h (dwarf2_section_info_def): Remove.
(DEF_VEC_O (dwarf2_section_info_def)): Remove.
* dwarf2read.c (struct dwo_sections) <types>: Change type to
std::vector<dwarf2_section_info>.
(struct dwo_file) <~dwo_file>: Remove.
(dwarf2_per_objfile::~dwarf2_per_objfile): Don't manually free
types field.
(dwarf2_per_objfile::locate_sections): Adjust to std::vector.
(dwarf2_read_debug_names): Likewise.
(create_debug_types_hash_table): Change parameter type to
array_view, adjust code accordingly.
(dwarf2_locate_dwo_sections): Adjust to std::vector.
(partial_die_info::fixup): Likewise.
(determine_prefix): Likewise.
* dwarf-index-write.c (write_psymtabs_to_index): Adjust.
Simon Marchi [Fri, 21 Jun 2019 18:10:57 +0000 (14:10 -0400)]
dwarf2read: Make dwo_file::dbfd a gdb_bfd_ref_ptr
This removes the manual call to gdb_bfd_ref in favor of gdb_bfd_ref_ptr.
gdb/ChangeLog:
* dwarf2read.c (struct dwo_file) <dbfd>: Change type to
gdb_bfd_ref_ptr.
<~dwo_file>: Remove call to gdb_bfd_unref.
(open_and_init_dwo_file): Move gdb_bfd_ref_ptr into dbfd field. Call
gdb_bfd_ref_ptr::get.
Simon Marchi [Fri, 21 Jun 2019 18:10:14 +0000 (14:10 -0400)]
dwarf2read: C++ify dwo_file
This patch changes dwo_file to be allocated/deallocated with new/delete,
so that we can start using C++ features in it, and in struct
dwo_sections.
The free_dwo_file function becomes the destructor of struct dwo_file
(and will disappear in upcoming patches, which will use gdb_bfd_ref_ptr
for dbfd and an std::vector for sections.types).
gdb/ChangeLog:
* dwarf2read.h (struct dwarf2_per_objfile) <dwo_files>: Change
type to htab_up.
* dwarf2read.c (struct dwo_file): Initialize fields.
<~dwo_file>: New.
(free_dwo_file): Remove, move content to ~dwo_file.
(struct dwo_file_deleter): Remove.
(dwo_file_up>: Remove custom deleter.
(free_dwo_files): Remove.
(dwarf2_per_objfile::~dwarf2_per_objfile): Don't explicitly free
dwo_files.
(process_skeletonless_type_units): Call unique_ptr::get.
(allocate_dwo_file_hash_table): Add deleter to created hash
table. Change return type to htab_up.
(lookup_dwo_file_slot): Don't memset dwo_file, call
unique_ptr::get.
(create_dwo_unit_in_dwp_v1): Allocate dwo_file with new.
(create_dwo_unit_in_dwp_v2): Likewise.
(open_and_init_dwo_file): Likewise.
(free_dwo_file_from_slot): Remove.
Simon Marchi [Fri, 21 Jun 2019 18:10:13 +0000 (14:10 -0400)]
dwarf2read: Use bool for dwarf2_section_info fields
Use bool instead of char where applicable in dwarf2_section_info.
No functional changes intended.
gdb/ChangeLog:
* dwarf2read.h (struct dwarf2_section_info) <readin,
is_virtual>: Change type to bool.
* dwarf2read.c (dwarf2_read_section, create_dwp_v2_section): Use
true instead of 1.
Tom de Vries [Fri, 21 Jun 2019 15:03:27 +0000 (17:03 +0200)]
[gdb/testsuite] Mark ptype_union.exp as unsupported for cc-with-gdb-index
When testing gdb with board cc-with-gdb-index, we run into:
...
FAIL: gdb.ada/ptype_union.exp: ptype global
FAIL: gdb.ada/ptype_union.exp: print global
...
The index is not supported for Ada (PR24713), and cc-with-gdb-index does not
add an index for Ada test-cases. However, this test-case compiles C sources,
for which cc-with-gdb-index does add an index. In gdb we load the executable
containing the index and set the language to Ada, resulting in gdb trying to
handle something that is not supported.
Fix the fail by marking this unsupported.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-06-21 Tom de Vries <tdevries@suse.de>
PR testsuite/24518
PR ada/24713
* gdb.ada/ptype_union.exp: Mark as unsupported if executable contains
index.
Andreas Schwab [Fri, 21 Jun 2019 12:42:22 +0000 (14:42 +0200)]
Add gnulib to gdb release tarball
* src-release.sh (GDB_SUPPORT_DIRS): Add gnulib.
Gary Benson [Fri, 21 Jun 2019 12:23:59 +0000 (13:23 +0100)]
Fix gnulib/update-gnulib.sh
This commit fixes two paths in update-gnulib.sh that weren't updated
when gnulib was moved to toplevel.
gnulib/ChangeLog:
* update-gnulib.sh: Adjust paths.
Nick Alcock [Wed, 19 Jun 2019 14:56:52 +0000 (15:56 +0100)]
libctf: fix ctf_open endianness problems with raw CTF files
ctf_open (or, rather, ctf_fdopen, which underlies it) has several
endianness problems, even though it was written after the
endian-swapping code was implemented, so should have been endian-aware.
Even though the comment right above the relevant check says that it wil
check for CTF magic in any endianness, it only checks in the native
endianness, so opening raw LE CTF files on BE, or vice-versa, will fail.
It also checks the CTF version by hand, without ever endianness-swapping
the header, so that too will fail, and is entirely redundant because
ctf_simple_open does the job properly in any case. We have a similar
problem in the next if block, which checks for raw CTF archives: we are
checking in the native endianness while we should be doing a le64toh()
on it to check in little-endian form only: so opening CTF archives
created on the local machine will fail if the local machine is
big-endian.
Adding insult to injury, if ctf_simple_open then fails, we go on and try
to turn it into a single-element CTF archive regardless, throwing the
error away. Since this involves dereferencing null pointers it is not
likely to work very well.
libctf/
* ctf-open-bfd.c: Add swap.h and ctf-endian.h.
(ctf_fdopen): Check for endian-swapped raw CTF magic, and
little-endian CTF archive magic. Do not check the CTF version:
ctf_simple_open does that in endian-safe ways. Do not dereference
null pointers on open failure.
Nick Alcock [Wed, 19 Jun 2019 11:34:56 +0000 (12:34 +0100)]
libctf: endianness fixes
Testing of the first code to generate CTF_K_SLICEs on big-endian
revealed a bunch of new problems in this area. Most importantly, the
trick we did earlier to avoid wasting two bytes on padding in the
ctf_slice_t is best avoided: because it leads to the whole file after
that point no longer being naturally aligned, all multibyte accesses
from then on must use memmove() to avoid unaligned access on platforms
where that is fatal. In future, this is planned, but for now we are
still doing direct access in many places, so we must revert to making
ctf_slice_t properly aligned for storage in an array.
Rather than wasting bytes on padding, we boost the size of cts_offset
and cts_bits. This is still a waste of space (we cannot have offsets or
bits in bitfields > 256) but it cannot be avoided for now, and slices
are not so common that this will be a serious problem.
A possibly-worse endianness problem fixed at the same time involves
a codepath used only for foreign-endian, uncompressed CTF files, where
we were not copying the actual CTF data into the buffer, leading to
libctf reading only zeroes (or, possibly, uninitialized garbage).
Finally, when we read in a CTF file, we copy the header and work from
the copy. We were flipping the endianness of the header copy, and of
the body of the file buffer, but not of the header in the file buffer
itself: so if we write the file back out again we end up with an
unreadable frankenfile with header and body of different endiannesses.
Fix by flipping both copies of the header.
include/
* ctf.h (ctf_slice_t): Make cts_offset and cts_bits unsigned
short, so following structures are properly aligned.
libctf/
* ctf-open.c (get_vbytes_common): Return the new slice size.
(ctf_bufopen): Flip the endianness of the CTF-section header copy.
Remember to copy in the CTF data when opening an uncompressed
foreign-endian CTF file. Prune useless variable manipulation.
Nick Alcock [Wed, 19 Jun 2019 11:27:18 +0000 (12:27 +0100)]
libctf: unidentified type kinds on open are a sign of file corruption
If we see a CTF type with a kind we do not recognize in its ctt_info
during opening, we cannot skip it and continue opening the file: if the
type kind is unknown, we do not know how long its vlen is, and we cannot
have skipped past it: so if we continue reading we will almost certainly
read in part of the vlen as if it were a new ctf_type_t.
Avoid this trouble by considering unknown type kinds to be a reason to
return ECTF_CORRUPT, just like everything else that reads in type kinds
does.
libctf/
* ctf-open.c (ctf_types): Fail when unidentified type kinds are
seen.
Nick Alcock [Wed, 19 Jun 2019 11:23:38 +0000 (12:23 +0100)]
libctf: dump header offsets into the debugging output
This is an essential first piece of info needed to debug both libctf
writing and reading problems, and we weren't recording it anywhere!
(This is a short-term fix: fairly soon, we will record all of this in a
form that outlives ctf_bufopen, and then ctf_dump() will be able to dump
it like it can everything else.)
libctf/
* ctf-open.c (ctf_bufopen): Dump header offsets into the debugging
output.
Nick Alcock [Wed, 19 Jun 2019 11:20:47 +0000 (12:20 +0100)]
libctf: drop mmap()-based CTF data allocator
This allocator has the ostensible benefit that it lets us mprotect() the
memory used for CTF storage: but in exchange for this it adds
considerable complexity, since we have to track allocation sizes
ourselves for use at freeing time, note whether the data we are storing
was ctf_data_alloc()ed or not so we know if we can safely mprotect()
it... and while the mprotect()ing has found few bugs, it *has* been the
cause of more than one due to errors in all this tracking leading to us
mprotect()ing bits of the heap and stuff like that.
We are about to start composing CTF buffers from pieces so that we can
do usage-based optimizations on the strtab. This means we need
realloc(), which needs nonportable mremap() and *more* tracking of the
*original* allocation size, and the complexity and bureaucracy of all of
this is just too high for its negligible benefits.
Drop the whole thing and just use malloc() like everyone else. It knows
better than we do when it is safe to use mmap() under the covers,
anyway.
While we're at it, don't leak the entire buffer if ctf_compress_write()
fails to compress it.
libctf/
* ctf-subr.c (_PAGESIZE): Remove.
(ctf_data_alloc): Likewise.
(ctf_data_free): Likewise.
(ctf_data_protect): Likewise.
* ctf-impl.h: Remove declarations.
* ctf-create.c (ctf_update): No longer call ctf_data_protect: use
ctf_free, not ctf_data_free.
(ctf_compress_write): Use ctf_data_alloc, not ctf_alloc. Free
the buffer again on compression error.
* ctf-open.c (ctf_set_base): No longer track the size: call
ctf_free, not ctf_data_free.
(upgrade_types): Likewise. Call ctf_alloc, not ctf_data_alloc.
(ctf_bufopen): Likewise. No longer call ctf_data_protect.
Nick Alcock [Wed, 19 Jun 2019 11:14:16 +0000 (12:14 +0100)]
libctf: handle errors on dynhash insertion better
We were missing several cases where dynhash insertion might fail, likely
due to OOM but possibly for other reasons. Pass the errors on.
libctf/
* ctf-create.c (ctf_dtd_insert): Pass on error returns from
ctf_dynhash_insert.
(ctf_dvd_insert): Likewise.
(ctf_add_generic): Likewise.
(ctf_add_variable): Likewise.
* ctf-impl.h: Adjust declarations.
Alan Modra [Fri, 21 Jun 2019 02:21:38 +0000 (11:51 +0930)]
PR24689, string table corruption
The testcase in the PR had a e_shstrndx section of type SHT_GROUP.
hdr->contents were initialized by setup_group rather than being read
from the file, thus last byte was not zero and string dereference ran
off the end of the buffer.
PR 24689
* elfcode.h (elf_object_p): Check type of e_shstrndx section.
GDB Administrator [Fri, 21 Jun 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Thu, 20 Jun 2019 09:31:36 +0000 (11:31 +0200)]
[gdbserver] Fix s390x -m31 gdbserver build
When building gdb on s390x with -m31, we run into this error:
...
gdb/gdbserver/linux-s390-ipa.c: \
In function 'const target_desc* get_ipa_tdesc(int)':
gdb/gdbserver/linux-s390-ipa.c:371:18: error: 's390_te_ft_collect_regmap' \
was not declared in this scope
SET_REGMAP(s390_te_ft_collect_regmap, 0);
The offending line is part of this code snippet:
...
case S390_TDESC_GS:
SET_REGMAP(s390_te_ft_collect_regmap, 0);
return tdesc_s390_gs_linux64;
...
introduced in commit
ce29f8439f "S390: Make IPA recognize tdescs with guarded
storage".
The snippet is part of an #ifdef __s390x__ construct, in the false branch, and
in the true branch we find a snippet introduced by the same commit:
...
case S390_TDESC_GS:
SET_REGMAP(s390x_te_ft_collect_regmap, 0);
return tdesc_s390x_gs_linux64;
...
which is paired with a comment update for s390x_te_ft_collect_regmap:
...
-/* Used for s390x-te-linux64, s390x-tevx-linux64. */
+/* Used for s390x-te-linux64, s390x-tevx-linux64, and
+ s390x-gs-linux64. */
static const int s390x_te_ft_collect_regmap[] = {
...
A similar comment update is added in the same commit for
s390_te_linux64_ft_collect_regmap:
...
-/* Used for s390-te-linux64, s390-tevx-linux64. */
+/* Used for s390-te-linux64, s390-tevx-linux64, and s390-gs-linux64. */
static const int s390_te_linux64_ft_collect_regmap[] = {
...
but not paired with any update.
Fix the build breaker by making the offending SET_REGMAP use the regmap
indicated by the comment.
...
- SET_REGMAP(s390_te_ft_collect_regmap, 0);
+ SET_REGMAP(s390_te_linux64_ft_collect_regmap, 0);
...
Build on s390x-linux with -m31.
gdb/gdbserver/ChangeLog:
2019-06-20 Tom de Vries <tdevries@suse.de>
* linux-s390-ipa.c (get_ipa_tdesc)[!__s390x__]: Use
s390_te_linux64_ft_collect_regmap for S390_TDESC_GS.
Tom Tromey [Thu, 20 Jun 2019 04:24:30 +0000 (22:24 -0600)]
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.
Tom Tromey [Sun, 16 Jun 2019 22:06:14 +0000 (16:06 -0600)]
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.
GDB Administrator [Thu, 20 Jun 2019 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Wed, 19 Jun 2019 17:01:27 +0000 (10:01 -0700)]
i386: Check vector length for EVEX broadcast instructions
Since not all vector lengths are supported by EVEX broadcast instructions,
decode them only with supported vector lengths.
gas/
PR binutils/24700
* testsuite/gas/i386/disassem.s: Add test for vbroadcasti32x8
with invalid vector length.
* testsuite/gas/i386/x86-64-disassem.s: Likewise.
* testsuite/gas/i386/disassem.d: Updated.
* testsuite/gas/i386/x86-64-disassem.d: Likewise.
opcodes/
PR binutils/24700
* i386-dis-evex.h (evex_table): Update EVEX_W_0F3819_P_2,
EVEX_W_0F381A_P_2, EVEX_W_0F381B_P_2, EVEX_W_0F385A_P_2 and
EVEX_W_0F385B_P_2.
(evex_len_table): Add EVEX_LEN_0F3819_P_2_W_0,
EVEX_LEN_0F3819_P_2_W_1, EVEX_LEN_0F381A_P_2_W_0,
EVEX_LEN_0F381A_P_2_W_1, EVEX_LEN_0F381B_P_2_W_0,
EVEX_LEN_0F381B_P_2_W_1, EVEX_LEN_0F385A_P_2_W_0,
EVEX_LEN_0F385A_P_2_W_1, EVEX_LEN_0F385B_P_2_W_0 and
EVEX_LEN_0F385B_P_2_W_1.
* i386-dis.c (EVEX_LEN_0F3819_P_2_W_0): New enum.
(EVEX_LEN_0F3819_P_2_W_1): Likewise.
(EVEX_LEN_0F381A_P_2_W_0): Likewise.
(EVEX_LEN_0F381A_P_2_W_1): Likewise.
(EVEX_LEN_0F381B_P_2_W_0): Likewise.
(EVEX_LEN_0F381B_P_2_W_1): Likewise.
(EVEX_LEN_0F385A_P_2_W_0): Likewise.
(EVEX_LEN_0F385A_P_2_W_1): Likewise.
(EVEX_LEN_0F385B_P_2_W_0): Likewise.
(EVEX_LEN_0F385B_P_2_W_1): Likewise.
Tom de Vries [Wed, 19 Jun 2019 15:17:38 +0000 (17:17 +0200)]
[gdb] Fix clang buildbreaker
Building gdb with clang, I run into:
...
src/gdb/gdbserver/linux-low.c:6190:41: error: comparison of unsigned \
expression < 0 is always false [-Werror,-Wtautological-compare]
if (debug_write ("sigchld_handler\n",
sizeof ("sigchld_handler\n") - 1) < 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
...
This regression is introduced by commit
a7e559cc08 "gdbserver: Ensure all
debug output uses debug functions", which replaces calls to write with result
type ssize_t with calls to debug_write with result type size_t.
Fix this by making debug_write return ssize_t.
Build and reg-tested on x86_64-linux.
gdb/gdbserver/ChangeLog:
2019-06-19 Tom de Vries <tdevries@suse.de>
* debug.h (debug_write): Change return type to ssize_t.
* debug.c (debug_write): Same.
Tom de Vries [Wed, 19 Jun 2019 14:56:23 +0000 (16:56 +0200)]
[gdb] Fix build breaker with gcc 4.8
When compiling with gcc 4.8, we run into:
...
/usr/include/c++/4.8/bits/unordered_map.h:100:18: required from \
‘class std::unordered_map<sect_offset, std::vector<sect_offset> >’
src/gdb/dwarf2read.h:260:5: required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of \
incomplete type ‘struct std::hash<sect_offset>’
...
Fix this by setting the Hash template parameter of the unordered_map to
gdb::hash_enum<sect_offset>, rather than using the default
std::hash<sect_offset>.
Build and reg-tested on x86_64-linux with gcc 4.8.
gdb/ChangeLog:
2019-06-19 Tom de Vries <tdevries@suse.de>
* dwarf2read.h (abstract_to_concrete): Change type to
std::unordered_map<sect_offset, std::vector<sect_offset>,
gdb::hash_enum<sect_offset>>.
Tom Tromey [Wed, 19 Jun 2019 14:32:35 +0000 (08:32 -0600)]
Add intro comment to length_cond.exp
Pedro pointed out that the new length_cond.exp test did not have an
intro comment. This adds one.
gdb/testsuite/ChangeLog
2019-06-19 Tom Tromey <tromey@adacore.com>
* gdb.ada/length_cond.exp: Add intro comment.
Tom Tromey [Thu, 30 May 2019 20:13:10 +0000 (14:13 -0600)]
Fix crash when setting breakpoint condition
gdb could crash when setting a breakpoint condition on a breakpoint
when using the Ada language. The problem occurred because the
ada_evaluate_subexp would try to evaluate the array to compute its
attributes, but evaluating can't really be done at this time.
This patch fixes the problem by arranging not to try to evaluate in
EVAL_AVOID_SIDE_EFFECTS mode when computing an attribute.
Tested on x86-64 Fedora 29. Because this is Ada-specific, and because
Joel approved it internally, I am checking it in.
gdb/ChangeLog
2019-06-19 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_evaluate_subexp) <case OP_ATR_FIRST>: Handle
EVAL_AVOID_SIDE_EFFECTS specially.
gdb/testsuite/ChangeLog
2019-06-19 Tom Tromey <tromey@adacore.com>
* gdb.ada/length_cond.exp: New file.
* gdb.ada/length_cond/length_cond.adb: New file.
* gdb.ada/length_cond/pck.adb: New file.
* gdb.ada/length_cond/pck.ads: New file.
Tom Tromey [Tue, 18 Jun 2019 18:18:24 +0000 (12:18 -0600)]
Instantiate a single source highlighter
It occurred to me that there's no reason to make a new source
highlighter each time gdb needs to highlight some source code.
Instead, a single one can be created and then simply reused each time.
This patch implements this idea. Tested on x86-64 Fedora 29.
gdb/ChangeLog
2019-06-19 Tom Tromey <tromey@adacore.com>
* source-cache.c (highlighter): New global.
(source_cache::get_source_lines): Create a highlighter on demand.
Alan Modra [Wed, 19 Jun 2019 04:25:59 +0000 (13:55 +0930)]
PR24697, R_PPC_EMB_SDA21 relocation
PR 24697
* elf32-ppc.c (ppc_elf_relocate_section): Don't read insn for
R_PPC_EMB_RELSDA. Mask low bit of R_PPC_EMB_SDA21 r_offset.
Alan Modra [Tue, 18 Jun 2019 01:04:14 +0000 (10:34 +0930)]
PowerPC64 notoc calls
Calls from functions that don't have a valid toc pointer in r2 (these
calls are marked with _NOTOC relocs) to functions that require r2
valid must go via the callee global entry point. This patch corrects
the condition the linker was using to detect functions that require r2
to be valid. Values of both zero and one in st_other local entry bits
mean a function doesn't care about r2.
* elf64-ppc.c (ppc64_elf_inline_plt): Correct st_other test for
functions that require r2 valid to use local entry.
(ppc64_elf_size_stubs, ppc64_elf_relocate_section): Likewise.
GDB Administrator [Wed, 19 Jun 2019 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Tue, 18 Jun 2019 12:08:36 +0000 (13:08 +0100)]
gdb: Remove use of deprecated_interactive_hook
The deprecated_interactive_hook is not used within GDB. It is used in
gdbtk, however this patch removes that use:
https://sourceware.org/ml/insight/2019-q2/msg00001.html
So I think there is no longer a reason to keep this hook around.
This patch removes it. There should be no user visible changes after
this commit.
gdb/ChangeLog:
* defs.h (deprecated_interactive_hook): Delete declaration.
* interps.c (clear_interpreter_hooks): Remove use of
deprecated_interactive_hook.
* top.c (deprecated_interactive_hook): Delete definition.
* utils.c (maybe_quit): Remove use of deprecated_interactive_hook.
Tom de Vries [Tue, 18 Jun 2019 17:03:38 +0000 (19:03 +0200)]
[gdb/testsuite] Use -fuse-ld=gold in fission.exp
The target board fission.exp requires the gold linker (because it supports
--gdb-index).
When running the target board on a system where the default linker is not
gold, most tests will fail to compile.
Fix this by adding "-fuse-ld=gold" ( supported in gcc since version 4.8).
gdb/testsuite/ChangeLog:
2019-06-18 Tom de Vries <tdevries@suse.de>
* boards/fission.exp (debug_flags): Add "-fuse-ld=gold".
Tom de Vries [Tue, 18 Jun 2019 16:59:51 +0000 (18:59 +0200)]
[gdb] Fix abstract_to_concrete type
The test-case varval.exp fails here:
...
FAIL: gdb.dwarf2/varval.exp: print varval2
...
with boards readnow/cc-with-gdb-index/cc-with-debug-names, as well as if gdb
is build with -fsanitize=address -lasan.
The problem is that the abstract_to_concrete map in which we track the
association of abstract to concrete DIEs (for DW_OP_GNU_variable_value
support) has type std::unordered_map<die_info_ptr, std::vector<die_info_ptr>>,
and the die_info_ptrs that we register in the map may be invalid by the time
that we start to lookup DIEs in the map.
Fix this by using the sect_offset instead to identify the DIEs in the map.
Build and tested on x86_64-linux.
gdb/ChangeLog:
2019-06-18 Tom de Vries <tdevries@suse.de>
PR gdb/24515
* dwarf2read.h (abstract_to_concrete): Change type from
std::unordered_map<die_info_ptr, std::vector<die_info_ptr>> to
std::unordered_map<sect_offset, std::vector<sect_offset>>.
* dwarf2read.c (read_variable): Update.
(dwarf2_fetch_die_loc_sect_off): Update.
Simon Marchi [Tue, 18 Jun 2019 16:40:13 +0000 (12:40 -0400)]
doc: fix false claim about second argument to gdb
Section "Invoking GDB" of the manual states that if you try to launch
gdb with:
gdb program 1234
it will try to attach to the process with id 1234, unless there is a
file named 1234 in the current working directory, in which case it will
try to open that file as a core. In fact, when the second argument
starts with a digit, GDB tries to attach to process 1234 first, before
trying to open file 1234 as a core. So that last remark is not true and
therefore this patch removes it.
The same remark is present in the man page, so it is removed there too.
Section "Choosing Files" correctly states:
If the second argument begins with a decimal digit, GDB will first
attempt to attach to it as a process, and if that fails, attempt to
open it as a corefile.
so it is unchanged.
Finally, the man page has an additional detail compared to section
"Invoking GDB", regarding the use of the -p switch, so I added the same
detail to the "Invoking GDB" section.
gdb/doc/ChangeLog:
* gdb.texinfo (Invoking GDB): Remove sentence about how GDB
deals with a file that has the same name as the specified pid to
attach to. Add example using -p option.
(gdb man): Remove same sentence as in previous item.
Tom Tromey [Tue, 18 Jun 2019 15:27:45 +0000 (09:27 -0600)]
Add comment to list0.h
Pedro suggested adding a comment to list0.h to explain the control
character.
Tested on x86-64 Fedora 29.
gdb/testsuite/ChangeLog
2019-06-18 Tom Tromey <tromey@adacore.com>
* gdb.base/list0.h: Add comment explaining control character.
Tom de Vries [Tue, 18 Jun 2019 06:52:16 +0000 (08:52 +0200)]
[gdb/testsuite] Break up long debug_flags line in fission.exp
gdb/testsuite/ChangeLog:
2019-06-18 Tom de Vries <tdevries@suse.de>
* boards/fission.exp: Break up long debug_flags line.
GDB Administrator [Tue, 18 Jun 2019 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Mon, 17 Jun 2019 20:25:06 +0000 (22:25 +0200)]
[gdb] Fix heap-buffer-overflow in child_path
When compiling gdb with '-lasan -fsanitizer=address' and running tests with:
- export ASAN_OPTIONS="detect_leaks=0:alloc_dealloc_mismatch=0", and
- a target board using local-board.exp, which sets sysroot to ""
we run into a heap-buffer-overflow in child_path for f.i. gdb.arch/amd64-byte:
...
==3997==ERROR: AddressSanitizer: heap-buffer-overflow on address \
0x60200002abcf at pc 0x5602acdf6872 bp 0x7ffe5237a090 sp 0x7ffe5237a080
READ of size 1 at 0x60200002abcf thread T0
#0 0x5602acdf6871 in child_path(char const*, char const*) \
gdb/common/pathstuff.c:161
#1 0x5602adb06587 in find_separate_debug_file gdb/symfile.c:1483
#2 0x5602adb06f2f in find_separate_debug_file_by_debuglink[abi:cxx11](...) \
gdb/symfile.c:1563
#3 0x5602ad13b743 in elf_symfile_read gdb/elfread.c:1293
#4 0x5602adb01cfa in read_symbols gdb/symfile.c:798
#5 0x5602adb03769 in syms_from_objfile_1 gdb/symfile.c:1000
#6 0x5602adb039d0 in syms_from_objfile gdb/symfile.c:1017
#7 0x5602adb04551 in symbol_file_add_with_addrs gdb/symfile.c:1124
#8 0x5602adb04ebf in symbol_file_add_from_bfd(...) gdb/symfile.c:1204
#9 0x5602ada5a78d in solib_read_symbols(...) gdb/solib.c:695
#10 0x5602ada5bdae in solib_add(char const*, int, int) gdb/solib.c:1004
#11 0x5602ada49bcd in enable_break gdb/solib-svr4.c:2394
#12 0x5602ada4dae9 in svr4_solib_create_inferior_hook gdb/solib-svr4.c:3028
#13 0x5602ada5d4f1 in solib_create_inferior_hook(int) gdb/solib.c:1215
#14 0x5602ad347f66 in post_create_inferior(target_ops*, int) \
gdb/infcmd.c:467
#15 0x5602ad348b3c in run_command_1 gdb/infcmd.c:663
#16 0x5602ad348e55 in run_command gdb/infcmd.c:686
#17 0x5602acd7d32b in do_const_cfunc gdb/cli/cli-decode.c:106
#18 0x5602acd84bfe in cmd_func(cmd_list_element*, char const*, int) \
gdb/cli/cli-decode.c:1892
#19 0x5602adc62a90 in execute_command(char const*, int) gdb/top.c:630
#20 0x5602ad5053e6 in catch_command_errors gdb/main.c:372
#21 0x5602ad507eb1 in captured_main_1 gdb/main.c:1138
#22 0x5602ad5081ec in captured_main gdb/main.c:1163
#23 0x5602ad508281 in gdb_main(captured_main_args*) gdb/main.c:1188
#24 0x5602ac9ddc3a in main gdb/gdb.c:32
#25 0x7f582b56eb96 in __libc_start_main \
(/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
#26 0x5602ac9dda09 in _start \
(/home/smarchi/build/binutils-gdb/gdb/gdb+0x19a2a09)
0x60200002abcf is located 1 bytes to the left of 1-byte region \
[0x60200002abd0,0x60200002abd1)
allocated by thread T0 here:
#0 0x7f582e0e4b50 in __interceptor_malloc \
(/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
#1 0x5602acdd3656 in xmalloc gdb/common/common-utils.c:44
#2 0x5602aefe17d1 in xstrdup libiberty/xstrdup.c:34
#3 0x5602acdf61f6 in gdb_realpath(char const*) gdb/common/pathstuff.c:80
#4 0x5602adb06278 in find_separate_debug_file gdb/symfile.c:1444
#5 0x5602adb06f2f in find_separate_debug_file_by_debuglink[abi:cxx11](...) \
gdb/symfile.c:1563
#6 0x5602ad13b743 in elf_symfile_read gdb/elfread.c:1293
#7 0x5602adb01cfa in read_symbols gdb/symfile.c:798
#8 0x5602adb03769 in syms_from_objfile_1 gdb/symfile.c:1000
#9 0x5602adb039d0 in syms_from_objfile gdb/symfile.c:1017
#10 0x5602adb04551 in symbol_file_add_with_addrs gdb/symfile.c:1124
#11 0x5602adb04ebf in symbol_file_add_from_bfd(...) gdb/solib.c:695
#13 0x5602ada5bdae in solib_add(char const*, int, int) gdb/solib.c:1004
#14 0x5602ada49bcd in enable_break gdb/solib-svr4.c:2394
#15 0x5602ada4dae9 in svr4_solib_create_inferior_hook gdb/solib-svr4.c:3028
#16 0x5602ada5d4f1 in solib_create_inferior_hook(int) gdb/solib.c:1215
#17 0x5602ad347f66 in post_create_inferior(target_ops*, int) \
gdb/infcmd.c:467
#18 0x5602ad348b3c in run_command_1 gdb/infcmd.c:663
#19 0x5602ad348e55 in run_command gdb/infcmd.c:686
#20 0x5602acd7d32b in do_const_cfunc gdb/cli/cli-decode.c:106
#21 0x5602acd84bfe in cmd_func(cmd_list_element*, char const*, int) \
gdb/cli/cli-decode.c:1892
#22 0x5602adc62a90 in execute_command(char const*, int) gdb/top.c:630
#23 0x5602ad5053e6 in catch_command_errors gdb/main.c:372
#24 0x5602ad507eb1 in captured_main_1 gdb/main.c:1138
#25 0x5602ad5081ec in captured_main gdb/main.c:1163
#26 0x5602ad508281 in gdb_main(captured_main_args*) gdb/main.c:1188
#27 0x5602ac9ddc3a in main gdb/gdb.c:32
#28 0x7f582b56eb96 in __libc_start_main \
(/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
SUMMARY: AddressSanitizer: heap-buffer-overflow gdb/common/pathstuff.c:161 \
in child_path(char const*, char const*)
Shadow bytes around the buggy address:
0x0c047fffd520: fa fa fd fd fa fa fd fd fa fa fd fa fa fa fd fa
0x0c047fffd530: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c047fffd540: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa
0x0c047fffd550: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fa
0x0c047fffd560: fa fa fd fa fa fa fd fa fa fa fd fa fa fa 00 00
=>0x0c047fffd570: fa fa 07 fa fa fa 00 fa fa[fa]01 fa fa fa fa fa
0x0c047fffd580: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffd590: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffd5a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffd5b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c047fffd5c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==3997==ABORTING
...
The direct cause is that child_path gets called with parent == "", so this
test:
...
if (IS_DIR_SEPARATOR (parent[parent_len - 1]))
...
accesses parent[-1].
[ There is an open discussion (1) about whether an empty sysroot should indeed
be represented internally as "". But this patch focuses on fixing the
heap-buffer-overflow without any redesign. ]
Fix this by guarding the test with 'parent_len > 0'.
Note that the fix makes child_path behave the same for:
- parent == "/" && child == "/foo" (returns "foo")
- parent == "" and child == "/foo" (returns "foo").
Build and reg-tested on x86_64-linux.
(1) https://sourceware.org/ml/gdb-patches/2019-05/msg00193.html
gdb/ChangeLog:
2019-06-17 Tom de Vries <tdevries@suse.de>
PR gdb/24617
* common/pathstuff.c (child_path): Make sure parent_len > 0 before
accessing parent[parent_len - 1].
Paul Pluzhnikov [Mon, 17 Jun 2019 17:49:15 +0000 (10:49 -0700)]
PR gdb/24364: Don't call dtrace_process_dof with NULL dof.
H.J. Lu [Mon, 17 Jun 2019 17:20:04 +0000 (10:20 -0700)]
i386: Check vector length for vshufXXX/vinsertXXX/vextractXXX
Since not all vector lengths are supported by vshufXXX, vinsertXXX and
vextractXXX, decode them only with supported vector lengths.
gas/
PR binutils/24691
* testsuite/gas/i386/disassem.s: Add test for vshuff32x4 with
invalid vector length.
* testsuite/gas/i386/x86-64-disassem.s: Likewise.
* testsuite/gas/i386/disassem.d: Updated.
* testsuite/gas/i386/x86-64-disassem.d: Likewise.
opcodes/
PR binutils/24691
* i386-dis-evex.h (evex_table): Update EVEX_W_0F3A23_P_2,
EVEX_W_0F3A38_P_2, EVEX_W_0F3A39_P_2, EVEX_W_0F3A3A_P_2,
EVEX_W_0F3A3B_P_2 and EVEX_W_0F3A43_P_2.
(evex_len_table): Add EVEX_LEN_0F3A23_P_2_W_0,
EVEX_LEN_0F3A23_P_2_W_1, EVEX_LEN_0F3A38_P_2_W_0,
EVEX_LEN_0F3A38_P_2_W_1, EVEX_LEN_0F3A39_P_2_W_0,
EVEX_LEN_0F3A39_P_2_W_1, EVEX_LEN_0F3A3A_P_2_W_0,
EVEX_LEN_0F3A3A_P_2_W_1, EVEX_LEN_0F3A3B_P_2_W_0,
EVEX_LEN_0F3A3B_P_2_W_1, EVEX_LEN_0F3A43_P_2_W_0 and
EVEX_LEN_0F3A43_P_2_W_1.
* i386-dis.c (EVEX_LEN_0F3A23_P_2_W_0): New enum.
(EVEX_LEN_0F3A23_P_2_W_1): Likewise.
(EVEX_LEN_0F3A38_P_2_W_0): Likewise.
(EVEX_LEN_0F3A38_P_2_W_1): Likewise.
(EVEX_LEN_0F3A39_P_2_W_0): Likewise.
(EVEX_LEN_0F3A39_P_2_W_1): Likewise.
(EVEX_LEN_0F3A3A_P_2_W_0): Likewise.
(EVEX_LEN_0F3A3A_P_2_W_1): Likewise.
(EVEX_LEN_0F3A3B_P_2_W_0): Likewise.
(EVEX_LEN_0F3A3B_P_2_W_1): Likewise.
(EVEX_LEN_0F3A43_P_2_W_0): Likewise.
(EVEX_LEN_0F3A43_P_2_W_1): Likewise.
Szabolcs Nagy [Mon, 10 Jun 2019 15:40:54 +0000 (16:40 +0100)]
aarch64: remove unnecessary loc_hash_table traversal
The loc_hash_table should only contain local ifunc symbols. The current
code already aborts if there is anything else and for defined ifunc
symbols elfNN_aarch64_allocate_dynrelocs is a no-op.
bfd/ChangeLog:
* elfnn-aarch64.c (elfNN_aarch64_allocate_local_dynrelocs): Remove.
(elfNN_aarch64_size_dynamic_sections): Remove loc_hash_table traversal
with elfNN_aarch64_allocate_local_dynrelocs.
GDB Administrator [Mon, 17 Jun 2019 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Sun, 16 Jun 2019 21:57:17 +0000 (23:57 +0200)]
[gdb/contrib] Fix gdb/contrib/gdb-add-index.sh for dwz-m-ed execs
Atm gdb-add-index.exp fails with target board cc-with-dwz-m.
Fix this by updating gdb/contrib/gdb-add-index.sh to handle a dwz-m-ed
executable.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-06-16 Tom de Vries <tdevries@suse.de>
PR gdb/24445
* contrib/gdb-add-index.sh: Update to handle dwz-m-ed executable.
Tom Tromey [Sun, 16 Jun 2019 20:10:25 +0000 (14:10 -0600)]
Don't cast a tui_win_info directly to tui_gen_win_info
I found a few spots that directly cast a tui_win_info to a
tui_gen_win_info. However, I think it's a bit better here to take the
address of the "generic" member. As far as I know, nothing relies on
being able to downcast here, so this gives us the freedom to rearrange
the structure.
gdb/ChangeLog
2019-06-16 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win)
(make_all_visible): Use address of member.
Tom Tromey [Sun, 16 Jun 2019 19:48:21 +0000 (13:48 -0600)]
Remove more unnecessary casts of NULL
I found a few more spots that unnecessarily cast NULL to a pointer
type. My earlier search included a "*" in the cast, but these use a
typedef to a pointer type instead. This patch removes these casts.
gdb/ChangeLog
2019-06-16 Tom Tromey <tom@tromey.com>
* tui/tui-data.c (tui_clear_win_detail, init_win_info)
(tui_free_window, free_content, free_content_elements): Remove
unnecessary cast.
* tui/tui-windata.c (tui_display_all_data): Remove unnecessary
cast.
* tui/tui-regs.c (tui_show_register_group)
(tui_display_registers_from, tui_display_reg_element_at_line):
Remove unnecessary cast.
Andrew Burgess [Sun, 16 Jun 2019 16:34:22 +0000 (17:34 +0100)]
gdb: Remove unused signal mask
In the following commit:
commit
7feb7d068ae65557ede03c36468ebac61b0939ca
Date: Mon May 11 12:08:03 2009 +0000
The last useful uses of normal_mask in linux-nat.c were removed, since
then this variable has sat around being initialised, but never used.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* linux-nat.c (normal_mask): Delete.
(_initialize_linux_nat): Don't initialise normal_mask.
Simon Marchi [Sun, 16 Jun 2019 14:13:56 +0000 (10:13 -0400)]
Write index for dwz -m file
PR 24445 ("dwz multifile index not written to index cache") exposed the
fact that we are not doing things right when we generate an index for an
object file that has is linked to a dwz file. The same happens whether
the index is generated with the intent of populating the index cache or
using the save gdb-index command.
The problem can be observed when running these tests with the
cc-with-dwz-m board:
FAIL: gdb.base/index-cache.exp: test_cache_enabled_hit: check index-cache stats
FAIL: gdb.dwarf2/gdb-index.exp: index used
FAIL: gdb.dwarf2/gdb-index.exp: index used after symbol reloading
When generating the index for such file and inspecting the CU list of the
resulting index (with readelf --debug-dump=gdb_index), we can see something
like:
CU table:
[ 0] 0x0 - 0xb9
[ 1] 0x0 - 0x44
This is supposed to be a sorted list of the ranges of all CUs in the
file this index represents, so already having some overlap is a red
flag. It turns out that we save the ranges of CUs coming from both the
main file and the dwz file in the same index.
After digging a little bit, it became quite obvious that the index in
the main file should only list the CUs present in the main file, and a
separate index should be generated for the dwz file, listing the CUs
present in that file.
First, that's what happens if you run dwz on a file that already has a
GDB index embedded. Second, dwarf2read.c has code to read an index from
a dwz file. The index in the dwz file is actually required to be
present, if the main file has an index.
So this patch changes write_psymtabs_to_index to generate an index for
the dwz file, if present. That index only contains a CU list, just like
what the dwz tool does when processing a file that already contains an
index.
Some notes about the implementation:
- The file management (creating a temp file, make sure it's
close/removed on error - in the right order) is a bit heavy in
write_psymtabs_to_index, and I needed to add a third file. I factored
this pattern in a separate class, index_wip_file.
- It became a bit tedious to keep the call to assert_file_size in
write_psymtabs_to_index, write_gdbindex would have had to return two
sizes. Instead, I moved the calls to assert_file_size where the file
is written. The downside is that we lose the filename at this point,
but it was only used for the very improbable case of ftell failing, so
I think it's not a problem.
- The actual writing of the index file is factored out to
write_gdbindex_1, so it can be re-used for both index files.
- While the "save gdb-index" command will now write two .gdb-index
files, this patch does not update the gdb-add-index.sh script, this
will come in a later patch.
gdb/ChangeLog:
YYYY-MM-DD Simon Marchi <simon.marchi@efficios.com>
PR gdb/24445
* dwarf-index-write.h (write_psymtabs_to_index): Add
dwz_basename parameter.
* dwarf-index-write.c (write_gdbindex): Move file writing to
write_gdbindex_1. Change return type void.
(assert_file_size): Move up, remove filename parameter.
(write_gdbindex_1): New function.
(write_debug_names): Change return type to void, call
assert_file_size.
(struct index_wip_file): New struct.
(write_psymtabs_to_index): Add dwz_basename parameter. Move
file logic to index_wip_file. Write index for dwz file if
needed.
(save_gdb_index_command): Pass basename of dwz file, if present.
* dwarf-index-cache.c (index_cache::store): Obtain and pass
build-id of dwz file, if present.
* dwarf2read.c (struct dwz_file): Move to dwarf2read.h.
(dwarf2_get_dwz_file): Likewise.
* dwarf2read.h (struct dwz_file): Move from dwarf2read.c.
(dwarf2_get_dwz_file): Likewise.
gdb/testsuite/ChangeLog:
YYYY-MM-DD Tom de Vries <tdevries@suse.de>
PR gdb/24445
* gdb.dwarf2/gdb-index.exp (add_gdb_index): Update dwz file with
generated index.
Tom Tromey [Sun, 16 Jun 2019 16:00:52 +0000 (10:00 -0600)]
Replace uses of concat with xstrdup
I noticed a couple of spots using concat that could use xstrdup
instead. This patch fixes these.
gdb/ChangeLog
2019-06-16 Tom Tromey <tom@tromey.com>
* coffread.c (process_coff_symbol): Use xstrdup.
* value.c (create_internalvar): Use xstrdup.
Tom Tromey [Sun, 16 Jun 2019 15:56:35 +0000 (09:56 -0600)]
Remove unnecessary casts of NULL
I noticed some unnecessary casts of NULL. This removes all the
unnecessary ones, leaving only ones where we must ensure that NULL has
pointer type for passing through varargs.
I removed a couple of useless casts of 0 that I noticed while writing
this.
Tested by rebuilding.
gdb/ChangeLog
2019-06-16 Tom Tromey <tom@tromey.com>
* valops.c (value_cast, value_slice): Remove unnecessary cast.
* breakpoint.c (stopin_command, stopat_command)
(until_break_command, decode_location_default): Remove unnecessary
cast.
* utils.c (subset_compare): Remove unnecessary cast.
* ada-lang.c (ada_update_initial_language): Remove unnecessary
cast.
* linespec.c (decode_line_with_last_displayed): Remove unnecessary
cast.
* infcmd.c (path_command): Remove unnecessary cast.
* coffread.c (decode_type): Remove unnecessary cast.
* xcoffread.c (read_xcoff_symtab): Remove unnecessary cast.
* mipsread.c (mipscoff_symfile_read): Remove unnecessary cast.
* tui/tui-stack.c (tui_show_locator_content)
(tui_show_frame_info): Remove unnecessary cast.
* tui/tui-win.c (tui_scroll_forward_command)
(tui_scroll_backward_command, tui_set_focus, tui_set_win_height)
(parse_scrolling_args): Remove unnecessary cast.
* tui/tui-data.c (init_win_info, tui_del_window)
(tui_free_window, tui_del_data_windows, tui_free_data_content)
(free_content_elements): Remove unnecessary cast.
* tui/tui-windata.c (tui_first_data_item_displayed): Remove
unnecessary cast.
* tui/tui-source.c (tui_set_source_content)
(tui_vertical_source_scroll): Remove unnecessary cast.
* tui/tui-layout.c (tui_default_win_height): Remove unnecessary
cast.
* tui/tui-io.c (tui_initialize_io): Remove unnecessary cast.
* tui/tui-regs.c (tui_display_registers_from)
(tui_display_register): Remove unnecessary cast.
* tui/tui-wingeneral.c (tui_refresh_win, tui_delete_win)
(tui_unhighlight_win, tui_highlight_win, tui_make_window)
(make_visible): Remove unnecessary cast.
* tui/tui-winsource.c (tui_erase_source_content)
(tui_update_breakpoint_info, tui_set_exec_info_content): Remove
unnecessary cast.
* ax-gdb.c (agent_command_1): Remove unnecessary cast.
* cli/cli-setshow.c (cmd_show_list): Remove unnecessary cast.
* stabsread.c (read_type, read_array_type, read_range_type):
Remove unnecessary cast.
* mdebugread.c (mdebug_build_psymtabs): Remove unnecessary cast.
(parse_symbol, parse_type, upgrade_type, parse_external)
(parse_partial_symbols, psymtab_to_symtab_1, cross_ref): Remove
unnecessary cast.
* gdb_bfd.c (gdb_bfd_map_section): Remove unnecessary cast.
Andrew Burgess [Sun, 16 Jun 2019 15:17:59 +0000 (16:17 +0100)]
gdb/testsuite: Improve detection of bug gdb/24541
In bug gdb/24686 a testsuite failure was reported, this failure was
actually just another instance of bug gdb/24541, however, due to the
non-deterministic nature of bug gdb/24541 the testsuite pattern that
was intended to catch this bug failed.
This commit adds a second pattern to help detect gdb/24541, which
should change the FAIL reported in gdb/24686 into a KFAIL.
gdb/testsuite/ChangeLog:
PR gdb/24686
* gdb.mi/mi-catch-cpp-exceptions.exp: Add an extra pattern to
improve detection of bug gdb/24541.