external/binutils.git
5 years agoChange tui_line_is_displayed to be a method
Tom Tromey [Sat, 6 Jul 2019 21:09:01 +0000 (15:09 -0600)]
Change tui_line_is_displayed to be a method

This changes tui_line_is_displayed to be a method on
tui_source_window, now that it is obvious that it can only be called
for this type.

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

* tui/tui-winsource.h (tui_line_is_displayed): Don't declare.
* tui/tui-winsource.c (tui_line_is_displayed): Move to
tui-source.c.
* tui/tui-source.h (struct tui_source_window) <line_is_displayed>:
Declare.
* tui/tui-source.c (tui_source_window::line_is_displayed): New
method.
(tui_source_window::maybe_update): Update.

5 years agoChange tui_addr_is_displayed into a method
Tom Tromey [Sat, 6 Jul 2019 21:06:47 +0000 (15:06 -0600)]
Change tui_addr_is_displayed into a method

This changes tui_addr_is_displayed to be a method on
tui_disasm_window, now that it is obvious that it can only be called
for this type.

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

* tui/tui-winsource.h (tui_addr_is_displayed): Don't declare.
* tui/tui-winsource.c (tui_addr_is_displayed): Move to
tui-disasm.c.
* tui/tui-disasm.h (struct tui_disasm_window) <addr_is_displayed>:
Declare.
* tui/tui-disasm.c (tui_disasm_window::addr_is_displayed): New
method.
(tui_disasm_window::maybe_update): Update.

5 years agoMove contents of tui_show_frame_info to new method
Tom Tromey [Sat, 6 Jul 2019 21:04:12 +0000 (15:04 -0600)]
Move contents of tui_show_frame_info to new method

This moves much of the body of tui_show_frame_info to a new method on
tui_source_window_base.  This removes a check for the type of a
window.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<maybe_update>: Declare.
* tui/tui-stack.c (tui_show_frame_info): Call maybe_update
method.
* tui/tui-source.h (struct tui_source_window) <maybe_update>:
Declare.
* tui/tui-source.c (tui_source_window::maybe_update): New method.
* tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>:
Declare.
* tui/tui-disasm.c (tui_disasm_window::maybe_update): New method.

5 years agoAvoid string_file in tui_make_status_line
Tom Tromey [Sat, 6 Jul 2019 19:52:08 +0000 (13:52 -0600)]
Avoid string_file in tui_make_status_line

tui_make_status_line uses string_file where a simple std::string
constructor would do.  This makes this change.

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

* tui/tui-stack.c (tui_make_status_line): Use string constructor.

5 years agoMove locator code to tui-stack.c
Tom Tromey [Sat, 6 Jul 2019 17:32:06 +0000 (11:32 -0600)]
Move locator code to tui-stack.c

The locator is mostly implemented in tui-stack.c.  This moves the
remaining bits to tui-stack.c and tui-stack.h, as appropriate.

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

* tui/tui-wingeneral.c: Include tui-stack.h.
* tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN)
(struct tui_locator_window): Move from tui-data.h.
* tui/tui-stack.c (_locator, tui_locator_win_info_ptr)
(tui_initialize_static_data): Move from tui-data.c.
* tui/tui-data.h (MAX_LOCATOR_ELEMENT_LEN)
(struct tui_locator_window): Move to tui-stack.c.
* tui/tui-data.c (_locator, tui_locator_win_info_ptr)
(tui_initialize_static_data): Move to tui-stack.c.

5 years agoRemove FIXMEs from tui-layout.c
Tom Tromey [Sat, 6 Jul 2019 14:23:34 +0000 (08:23 -0600)]
Remove FIXMEs from tui-layout.c

An earlier patch added a couple of FIXME comments to tui-layout.c.
This removes them.  This is possible due to the previous patch that
changed how boxing works in the TUI -- now, no special case for the
command window is needed in box_win.

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

* tui/tui-layout.c (show_source_disasm_command)
(show_source_or_disasm_and_command): Use make_visible method, not
tui_make_window.
* tui/tui-command.h (struct tui_cmd_window) <make_visible>:
Remove.

5 years agoSimplify TUI boxing
Tom Tromey [Sat, 6 Jul 2019 14:21:38 +0000 (08:21 -0600)]
Simplify TUI boxing

In the TUI, whether or not a window can be boxed is a property of the
window's type.  This adds a can_box method to the window classes, and
changes tui_make_window to defer to this, removing the "box_it"
paramter.  This also lets us remove "enum tui_box", as it is no longer
used.

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

* tui/tui-wingeneral.h (tui_make_window): Update.
* tui/tui-wingeneral.c (tui_make_window): Remove "box_it"
parameter.
(tui_gen_win_info::make_visible): Update.
* tui/tui-regs.c (tui_data_window::display_registers_from):
Update.
* tui/tui-layout.c (show_source_disasm_command)
(show_source_or_disasm_and_command): Update.
* tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method.
(enum tui_box): Remove.
(struct tui_win_info) <can_box>: New method.
* tui/tui-command.h (struct tui_cmd_window) <can_box>: New
method.

5 years agoDisable dw2-dir-file-name.exp on remote and/or Windows host.
Sandra Loosemore [Thu, 15 Aug 2019 17:23:18 +0000 (10:23 -0700)]
Disable dw2-dir-file-name.exp on remote and/or Windows host.

This test has many hardwired assumptions that pathnames on build and
host are the same, and that POSIX pathname syntax is used.  This
results in dozens of failures on a remote Windows host.  Fixing these
assumptions would involve nontrivial rewrites; meanwhile, let's make
the test results reflect the reality that this testcase isn't supported
on remote host.

2019-08-15  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.dwarf2/dw2-dir-file-name.exp: Skip on remote or
Windows host.

5 years agoSkip batch-preserve-term-settings.exp tests that cannot work on Windows.
Sandra Loosemore [Thu, 15 Aug 2019 17:17:54 +0000 (10:17 -0700)]
Skip batch-preserve-term-settings.exp tests that cannot work on Windows.

This group of tests assume that the gdb "shell" command launches a
POSIX-compliant shell supporting the PPID environment variable, which
is used to get gdb's pid for killing it from a remote_exec shell.  But
on Windows host "shell" launches cmd.exe, which doesn't have an
equivalent query.

2019-08-15  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/batch-preserve-term-settings.exp
(test_terminal_settings_preserved_after_sigterm): Skip on Windows.

5 years agoUse gdb::byte_vector in target_write_memory
Tom Tromey [Thu, 15 Aug 2019 17:23:13 +0000 (11:23 -0600)]
Use gdb::byte_vector in target_write_memory

Pedro pointed out that target_write_memory should use gdb::byte_vector
rather than std::vector<unsigned char>.

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

* target.c (target_write_memory): Use gdb::byte_vector.

5 years ago[testsuite] Make the testsuite work on mingw
Christian Biesinger [Wed, 14 Aug 2019 23:13:04 +0000 (18:13 -0500)]
[testsuite] Make the testsuite work on mingw

Dejagnu produces an objdir like /c/, but GDB expects something like c:/.
So fix it up in lib/gdb.exp.

gdb/testsuite/ChangeLog:

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

* lib/gdb.exp: When running on a mingw target, replace
/x/ with x:/.

5 years agoAdd a description of the 'n' symbol type displayed by nm.
Nick Clifton [Thu, 15 Aug 2019 14:23:18 +0000 (15:23 +0100)]
Add a description of the 'n' symbol type displayed by nm.

PR 24767
* doc/binutils.texi (nm): Document the 'n' symbol type.

5 years agoReplace write_inferior_memory with target_write_memory
Tom Tromey [Wed, 14 Aug 2019 15:18:21 +0000 (09:18 -0600)]
Replace write_inferior_memory with target_write_memory

target_write_memory is just a simple wrapper for
write_inferior_memory.  Because target_write_memory is needed for
gdbsupport, and because gdb uses the name "target_write_memory"
everywhere, this patch renames write_inferior_memory and removes the
wrapper.  I think this brings gdb and gdbserver slightly more in sync.

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

* tracepoint.c (write_inferior_data_pointer)
(write_inferior_integer, write_inferior_int8)
(write_inferior_uinteger, m_tracepoint_action_download)
(r_tracepoint_action_download, x_tracepoint_action_download)
(l_tracepoint_action_download, clear_inferior_trace_buffer)
(download_agent_expr, download_tracepoint_1)
(download_trace_state_variables, upload_fast_traceframes): Update.
* server.c (gdb_write_memory): Update.
* remote-utils.c (relocate_instruction): Update.
* proc-service.c (ps_pdwrite): Update.
* mem-break.c (remove_memory_breakpoint)
(delete_fast_tracepoint_jump, set_fast_tracepoint_jump)
(uninsert_fast_tracepoint_jumps_at)
(reinsert_fast_tracepoint_jumps_at): Update.
* linux-x86-low.c (append_insns)
(i386_install_fast_tracepoint_jump_pad)
(amd64_write_goto_address, i386_write_goto_address): Update.
* linux-s390-low.c (append_insns, s390_write_goto_address):
Update.
* linux-ppc-low.c (ppc_relocate_instruction)
(ppc_install_fast_tracepoint_jump_pad, emit_insns)
(ppc_write_goto_address): Update.
* linux-aarch64-low.c (append_insns): Update.
* target.h (struct target_ops): Update.
(write_inferior_memory): Don't declare.
* target.c (target_write_memory): Rename from
write_inferior_memory.  Remove old target_write_memory.

5 years agoSimplify write_inferior_memory
Tom Tromey [Wed, 14 Aug 2019 15:11:28 +0000 (09:11 -0600)]
Simplify write_inferior_memory

gdbserver's write_inferior_memory uses a static variable to avoid
memory leaks, and has a comment referring to the lack of cleanups.
This patch removes this comment and the code in favor of a
straightforward use of std::vector.

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

* target.c (write_inferior_memory): Use std::vector.

5 years agoCorrect a typo in the documentation for the disassembler.
Christophe Vidal [Thu, 15 Aug 2019 13:38:31 +0000 (14:38 +0100)]
Correct a typo in the documentation for the disassembler.

* docs/binutils.texi: Fixed notice message disassembler options
section of the man page.

5 years agoFix CU overrun in scan_unit_for_symbols
Tom Tromey [Wed, 14 Aug 2019 20:01:57 +0000 (14:01 -0600)]
Fix CU overrun in scan_unit_for_symbols

A customer program had a DWARF CU that consisted of just a CU DIE,
without any children.  In this situation, scan_unit_for_symbols will
try to read past the end of the current CU, and will take use the
first bytes of the next CU as an abbrev, printing an error message.

This patch fixes the bug by changing scan_unit_for_symbols to stop at
the end of the CU rather than the end of the .debug_info section.

bfd/ChangeLog
2019-08-15  Tom Tromey  <tromey@adacore.com>

* dwarf2.c (scan_unit_for_symbols): Check for end of CU, not end
of section.

5 years agoUpdatesd Swdish translation for the gas sub-directory.
Nick Clifton [Thu, 15 Aug 2019 11:41:24 +0000 (12:41 +0100)]
Updatesd Swdish translation for the gas sub-directory.

* po/sv.po: Updated Swedish translation.

5 years ago[gdb] Fix gdb build on mips64-linux
Tom de Vries [Thu, 15 Aug 2019 06:14:31 +0000 (08:14 +0200)]
[gdb] Fix gdb build on mips64-linux

When compiling for mips64-linux, we get:
...
src/gdb/linux-nat-trad.c:139:12: error: ‘gdbarch_num_regs’ was not declared \
  in this scope
  139 |   regnum < gdbarch_num_regs (regcache->arch ());
...

Fix this by including gdbarch.h in linux-nat-trad.c, similar to commit
b1c896b365 "Fix gdb build on macOS".

Build on mips64-linux.

gdb/ChangeLog:

2019-08-15  Tom de Vries  <tdevries@suse.de>

* linux-nat-trad.c: Include gdbarch.h.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 15 Aug 2019 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoAArch64: Allow additional sizes in prologue
Alan Hayward [Wed, 14 Aug 2019 14:47:05 +0000 (15:47 +0100)]
AArch64: Allow additional sizes in prologue

When saving registers to the stack at the start of a function, not all state
needs to be saved. For example, only the first 64bits of float registers need
saving.  However, a program may choose to store extra state if it wishes,
there is nothing preventing it doing so.

The aarch64_analyze_prologue will error if it detects extra state being
stored.  Relex this restriction.

Tested via aarch64-prologue test.

gdb/ChangeLog:

* aarch64-tdep.c (aarch64_analyze_prologue): Allow any valid
register sizes.

gdb/testsuite/ChangeLog:

* gdb.arch/aarch64-prologue.c: New test.
* gdb.arch/aarch64-prologue.exp: New file.

5 years agoFix gdb build on macOS
Tom Tromey [Wed, 14 Aug 2019 14:40:18 +0000 (08:40 -0600)]
Fix gdb build on macOS

Internal testing showed that the macOS port did not build.  The
breakage was caused by the patch to remove the gdbarch.h include from
defs.h.  This patch fixes the problem.

gdb/ChangeLog
2019-08-14  Tom Tromey  <tromey@adacore.com>

* darwin-nat.c: Include gdbarch.h.
* darwin-nat-info.c: Include gdbarch.h.

5 years agoPR24623, DWARF errors
Alan Modra [Wed, 14 Aug 2019 01:21:22 +0000 (10:51 +0930)]
PR24623, DWARF errors

PR 24623
* dwarf2.c (stash_comp_unit): New function, extracted from..
(_bfd_dwarf2_find_nearest_line): ..here.
(find_abstract_instance): Parse comp units and decode line info
as needed.

5 years agoUse comp_unit_maybe_decode_line_info in more places
Alan Modra [Wed, 14 Aug 2019 01:56:48 +0000 (11:26 +0930)]
Use comp_unit_maybe_decode_line_info in more places

* dwarf2.c (comp_unit_maybe_decode_line_info): Declare.
(comp_unit_find_nearest_line): Use it here..
(_bfd_dwarf2_find_symbol_bias): ..and here.

5 years agoRemove _bfd_dwarf2_find_nearest_line addr_size parameter
Alan Modra [Wed, 14 Aug 2019 01:10:20 +0000 (10:40 +0930)]
Remove _bfd_dwarf2_find_nearest_line addr_size parameter

This parameter might appear to be used to set up offset_size, but
since git commit 024b2372f5 offset_size is either set from the
debug_info data or is set to 4.

* dwarf2.c (_bfd_dwarf2_find_nearest_line): Remove addr_size parameter.
* libbfd-in.h  (_bfd_dwarf2_find_nearest_line): Update prototype.
* coffgen.c (coff_find_nearest_line_with_names): Adjust
_bfd_dwarf2_find_nearest_line calls.
* elf.c (_bfd_elf_find_nearest_line, _bfd_elf_find_line): Likewise.
* elf32-arm.c (elf32_arm_find_nearest_line): Likewise.
* elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_find_nearest_line): Likewise.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
* mach-o.c (bfd_mach_o_find_nearest_line): Likewise.
* libbfd.h: Regenerate.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 14 Aug 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoRemove tui_gen_win_info::last_visible_line
Tom Tromey [Sat, 6 Jul 2019 14:18:27 +0000 (08:18 -0600)]
Remove tui_gen_win_info::last_visible_line

The last_visible_line field of tui_gen_win_info is not used, so remove
it.

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

* tui/tui-data.h (struct tui_gen_win_info) <last_visible_line>:
Remove.
* tui/tui-data.c (tui_initialize_static_data): Update.

5 years agoDon't track the contents of the execution info window
Tom Tromey [Sat, 6 Jul 2019 14:10:50 +0000 (08:10 -0600)]
Don't track the contents of the execution info window

The curses library keeps track of the contents of each window, and can
redraw the screen as needed.  This means that in most cases is no need
for the TUI windows to also keep track of their contents.  This patch
removes content tracking from the execution window, leaving that to
curses.

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

* tui/tui-winsource.h (struct tui_exec_info_window)
<~tui_exec_info_window, maybe_allocate_content, get_content,
m_content>: Remove.
(struct tui_source_window_base) <set_exec_info_content,
show_exec_info_content>: Don't declare.
* tui/tui-winsource.c
(tui_exec_info_window::maybe_allocate_content): Remove.
(tui_source_window_base::update_exec_info): Rename from
set_exec_info_content.
(tui_source_window_base::show_exec_info_content)
(tui_source_window_base::update_exec_info): Remove.

5 years agoRemove tui_clear_exec_info_content
Tom Tromey [Sat, 6 Jul 2019 13:37:39 +0000 (07:37 -0600)]
Remove tui_clear_exec_info_content

After the previous patch, all calls to tui_clear_exec_info_content
come just after a call to tui_clear_source_content.  Because these two
windows are linked, I think it makes sense to have
tui_clear_source_content simply do the work.  So, this patch removes
tui_clear_exec_info_content.

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

* tui/tui-winsource.h (tui_clear_exec_info_content): Don't
declare.
* tui/tui-winsource.c (tui_update_source_window_as_is)
(tui_update_source_windows_with_addr, tui_erase_source_content):
Update.
(tui_clear_exec_info_content): Remove.

5 years agoRemove tui_erase_exec_info_content
Tom Tromey [Fri, 5 Jul 2019 23:36:16 +0000 (17:36 -0600)]
Remove tui_erase_exec_info_content

One call to tui_erase_exec_info_content can be removed.  This call is
not needed because the function in question then immediately sets the
execution info window contents.

Once this is done, tui_clear_exec_info_content is just a wrapper for
the only call to tui_erase_exec_info_content, so
tui_erase_exec_info_content can be renamed and the wrapper function
removed.

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

* tui/tui-winsource.h (tui_erase_exec_info_content): Don't
declare.
* tui/tui-winsource.c (tui_source_window_base::refresh_all): Don't
call tui_erase_exec_info_content.
(tui_clear_exec_info_content): Rename from
tui_erase_exec_info_content.
(tui_clear_exec_info_content): Delete.

5 years agoTurn tui_show_exec_info_content into a method
Tom Tromey [Fri, 5 Jul 2019 23:35:13 +0000 (17:35 -0600)]
Turn tui_show_exec_info_content into a method

This changes tui_show_exec_info_content to be a method on
tui_source_window_base.  As it is only called by other methods on this
class, it can be private.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<show_exec_info_content>: Declare.
(tui_show_exec_info_content): Don't declare.
* tui/tui-winsource.c
(tui_source_window_base::show_exec_info_content): Rename from
tui_show_exec_info_content.
(tui_source_window_base::update_exec_info): Update.

5 years agoMove code to tui-winsource.h
Tom Tromey [Fri, 5 Jul 2019 23:32:19 +0000 (17:32 -0600)]
Move code to tui-winsource.h

This moves code related to the execution info window from tui-data.h
to tui-winsource.h.  It fits better here because the execution info is
conceptually part of the source and disassembly windows, and
tui-winsource.h is where this common class lives.

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

* tui/tui-data.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element)
(TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS)
(TUI_EXECINFO_SIZE, tui_exec_info_content): Move ...
* tui/tui-winsource.h (enum tui_bp_flag, tui_bp_flags, struct
tui_source_element, TUI_BP_HIT_POS, TUI_BP_BREAK_POS)
(TUI_EXEC_POS, TUI_EXECINFO_SIZE, tui_exec_info_content):
... here.

5 years agoChange tui_update_exec_info to be a method
Tom Tromey [Fri, 5 Jul 2019 23:24:07 +0000 (17:24 -0600)]
Change tui_update_exec_info to be a method

This changes tui_update_exec_info to be a method on
tui_source_window_base.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<update_exec_info>: Declare.
(tui_update_exec_info): Don't declare.
* tui/tui-winsource.c (tui_update_source_window_as_is)
(tui_source_window_base::refresh_all)
(tui_update_all_breakpoint_info): Update.
(tui_source_window_base::update_exec_info): Rename from
tui_update_exec_info.
* tui/tui-stack.c (tui_show_frame_info): Update.

5 years agoChange tui_set_exec_info_content to be a method
Tom Tromey [Fri, 5 Jul 2019 23:22:05 +0000 (17:22 -0600)]
Change tui_set_exec_info_content to be a method

This changes tui_set_exec_info_content to bea method on
tui_source_window_base.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<set_exec_info_content>: Declare.
(tui_set_exec_info_content): Don't declare.
* tui/tui-winsource.c
(tui_source_window_base::set_exec_info_content): Rename from
tui_set_exec_info_content.
(tui_update_exec_info): Update.

5 years agoChange tui_show_source_content to be a method
Tom Tromey [Fri, 5 Jul 2019 23:18:18 +0000 (17:18 -0600)]
Change tui_show_source_content to be a method

This changes tui_show_source_content to be a method on
tui_source_window_base.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<show_source_content>: Declare.
(tui_show_source_content): Don't declare.
* tui/tui-winsource.c (tui_update_source_window_as_is): Update.
(tui_source_window_base::show_source_content): Rename from
tui_show_source_content.
(tui_source_window_base::refresh_all): Update.
* tui/tui-layout.c (show_source_disasm_command)
(show_source_or_disasm_and_command): Update.

5 years agoChange tui_check_and_display_highlight_if_needed to be a method
Tom Tromey [Fri, 5 Jul 2019 23:14:46 +0000 (17:14 -0600)]
Change tui_check_and_display_highlight_if_needed to be a method

This changes tui_check_and_display_highlight_if_needed to be a method
on tui_win_info.  This makes it clear that the NULL check in that
function is not needed, so it is removed here.

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

* tui/tui-winsource.c (tui_erase_source_content)
(tui_show_source_content, tui_source_window_base::refresh_all):
Update.
* tui/tui-wingeneral.h
(tui_check_and_display_highlight_if_needed): Don't declare.
* tui/tui-wingeneral.c
(tui_win_info::check_and_display_highlight_if_needed): Rename from
check_and_display_highlight_if_needed.
* tui/tui-win.c (tui_rehighlight_all)
(tui_win_info::make_visible_with_new_height): Update.
* tui/tui-regs.c (tui_data_window::display_registers_from_line)
(tui_data_window::erase_data_content)
(tui_data_window::display_all_data): Update.
* tui/tui-data.h (struct tui_win_info)
<check_and_display_highlight_if_needed>: Declare.

5 years agoDelete invisible TUI windows
Tom Tromey [Fri, 5 Jul 2019 18:46:23 +0000 (12:46 -0600)]
Delete invisible TUI windows

This changes the TUI so that when the layout changes, any windows that
are invisible are now deleted.  This makes it simpler to understand
window lifetimes.

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

* tui/tui-win.c (tui_resize_all): Call
tui_delete_invisible_windows.
* tui/tui-layout.c (show_layout): Call
tui_delete_invisible_windows.
* tui/tui-data.h (tui_delete_invisible_windows): Declare.
* tui/tui-data.c (tui_delete_invisible_windows): New function.

5 years agoSimplify tui_show_disassem
Tom Tromey [Fri, 5 Jul 2019 18:38:44 +0000 (12:38 -0600)]
Simplify tui_show_disassem

tui_show_disassem does not need to call tui_add_win_to_layout, because
the callers that could change the layout have already ensured that it
exists.

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

* tui/tui-disasm.c (tui_show_disassem): Add assertion.  Don't call
tui_add_win_to_layout.

5 years agoMake tui_default_win_height static
Tom Tromey [Fri, 5 Jul 2019 18:35:08 +0000 (12:35 -0600)]
Make tui_default_win_height static

tui_default_win_height is only used in tui-layout.c, so make it static.

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

* tui/tui-layout.h (tui_default_win_height): Don't declare.
* tui/tui-layout.c (tui_default_win_height): Now static.

5 years agoTwo simplifications in tui-layout.c
Tom Tromey [Fri, 5 Jul 2019 18:34:31 +0000 (12:34 -0600)]
Two simplifications in tui-layout.c

This patch simplifies some code in tui-layout.c.

In show_layout, all the layout settings can be handled by a single
switch statement.  In show_source_disasm_command and
show_source_or_disasm_and_command, there is no need to check the
current layout, as the caller has already done so.

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

* tui/tui-layout.c (show_layout): Unify all layout cases into a
single switch.
(show_source_disasm_command, show_source_or_disasm_and_command):
Don't check current layout.

5 years agoSimplify tui_make_all_invisible
Tom Tromey [Fri, 5 Jul 2019 18:29:18 +0000 (12:29 -0600)]
Simplify tui_make_all_invisible

This simplifies the implementation of tui_make_all_invisible.  Also,
because show_data is only called by show_layout, this hoists the call
to tui_make_all_invisible and removes the call from show_data.

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

* tui/tui-wingeneral.c (make_all_visible): Remove.
(tui_make_all_invisible): Simplify.
* tui/tui-layout.c (tui_make_all_invisible): Move from
tui-wingeneral.c; simplify.
(show_layout): Hoist call to tui_make_all_invisible.
(show_data): Don't call tui_make_all_invisible.

5 years agoRemove tui_make_all_visible
Tom Tromey [Fri, 5 Jul 2019 18:27:08 +0000 (12:27 -0600)]
Remove tui_make_all_visible

The function tui_make_all_visible is not used, so remove it.

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

* tui/tui-wingeneral.h (tui_make_all_visible): Don't declare.
* tui/tui-wingeneral.c (tui_make_all_visible): Remove.

5 years agoMove current_layout to tui-layout.c
Tom Tromey [Fri, 5 Jul 2019 18:13:40 +0000 (12:13 -0600)]
Move current_layout to tui-layout.c

This moves the current_layout global to tui-layout.c.  This allows for
the removal of an accessor function; but also it just seems clearer to
have it here.

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

* tui/tui-layout.c (current_layout, tui_current_layout): Move from
tui-data.c.
(show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Don't use
tui_set_current_layout_to.
* tui/tui-data.h (tui_set_current_layout_to): Don't declare.
* tui/tui-data.c (current_layout, tui_current_layout): Move to
tui-layout.c.
(tui_set_current_layout_to): Remove.

5 years agoRemove struct tui_layout_def
Tom Tromey [Fri, 5 Jul 2019 18:11:52 +0000 (12:11 -0600)]
Remove struct tui_layout_def

"layout_def" isn't actually used in the TUI, so remove it.

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

* tui/tui-layout.c (tui_set_layout): Update.
* tui/tui-data.h (struct tui_layout_def): Remove.
(tui_layout_def): Don't declare.
* tui/tui-data.c (layout_def): Remove.
(tui_layout_def): Remove.

5 years agoclear_detail can only be called on TUI source windows
Tom Tromey [Fri, 5 Jul 2019 18:00:06 +0000 (12:00 -0600)]
clear_detail can only be called on TUI source windows

The clear_detail method can only be called on source windows, so
remove definitions from the base of the class hierarchy, leaving only
a single non-virtual method.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<clear_detail>: No longer "override".
* tui/tui-regs.h (struct tui_data_window) <clear_detail>: Remove.
* tui/tui-regs.c (tui_data_window::clear_detail): Remove.
* tui/tui-data.h (struct tui_win_info) <clear_detail>: Remove.
* tui/tui-command.h (struct tui_cmd_window) <clear_detail>:
Remove.
* tui/tui-command.c (tui_cmd_window::clear_detail): Remove.

5 years ago[readline] Fix compilation on MinGW
Christian Biesinger [Tue, 13 Aug 2019 19:00:58 +0000 (14:00 -0500)]
[readline] Fix compilation on MinGW

S_ISLNK should not be called outside of an #ifdef.

However, this specific call is actually unnecessary, because
linkok can only be 0 if S_ISLNK is true, per the code above.

I have sent a bug report to bug-readline, though it does not show
up in the online archive yet.

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

* colors.c (_rl_print_color_indicator): Remove unnecessary
S_ISLNK check to fix compilation on MinGW.

5 years agoDon't include readline headers from tracepoint.c
Tom Tromey [Mon, 12 Aug 2019 18:06:20 +0000 (12:06 -0600)]
Don't include readline headers from tracepoint.c

I was curious why updating readline caused so much to be to rebuilt,
so I look at all the uses of the readline headers.  Most are included
for valid reasons (either readline directory or for tilde_expand); but
the includes in tracepoint.c didn't seem to be used.

This patch removes them.  Tested by rebuilding.

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

* tracepoint.c: Don't include readline.h or history.h.

5 years ago[gdb/testsuite] Fix gdb.gdb/selftest.exp regexp
Tom de Vries [Tue, 13 Aug 2019 16:57:50 +0000 (18:57 +0200)]
[gdb/testsuite] Fix gdb.gdb/selftest.exp regexp

With gdb.gdb/selftest.exp, we get:
...
(xgdb) PASS: gdb.gdb/selftest.exp: send SIGINT signal to child process
^M
Thread 1 "xgdb" received signal SIGINT, Interrupt.^M
0x00007ffff5bf01db in poll () from /lib64/libc.so.6^M
(gdb) FAIL: gdb.gdb/selftest.exp: send ^C to child process again
...

The failure is due to gdb printing 'Thread 1 "xgdb" received signal SIGINT',
but the regexp in the test-case expecting 'Program received signal SIGINT'.

Fix this by updating the regexp, similar to how that is done earlier in the
test-case.

gdb/testsuite/ChangeLog:

2019-08-13  Tom de Vries  <tdevries@suse.de>

* gdb.gdb/selftest.exp (send ^C to child process again): Accept also
Thread.

5 years agoFixes for gdb.python tests on remote Windows host.
Sandra Loosemore [Tue, 13 Aug 2019 16:09:30 +0000 (09:09 -0700)]
Fixes for gdb.python tests on remote Windows host.

This patch fixes several test ERRORs and FAILs seen from running
gdb.python tests on a remote Windows host.  The problems fixed
generally fall into these categories:
- Failure to copy the .py script to the host.
- Confusion between build and host pathnames.
- Assuming pathnames printed on the host include "/" as a directory
  separator.
- Tests that need to be conditionally disabled due to missing features
  on the host, etc.

2019-08-13  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.python/py-completion.exp: Download the .py file to the host
and use its host pathname.  Conditionalize tests that use
tab completion and manipulate files on the build machine.
* gdb.python/py-events.exp: Download the .py file to the host
and use its host pathname.
* gdb.python/py-evsignal.exp: Likewise.
* gdb.python/py-evthreads.exp: Likewise.
* gdb.python/py-framefilter-invalidarg.exp: Match Windows
pathname syntax.
* gdb.python/py-framefilter.exp: Download the .py file to the right
place on the host.  Match Windows pathname syntax.
* gdb.python/py-mi-var-info-path-expression.exp: Download the
.py file to the host and use its host pathname.
* gdb.python/py-objfile-script.exp: Match Windows pathname syntax.
* gdb.python/py-objfile.exp: Expect a host pathname, not a
build pathname.  Skip symlink test on Windows host.  Add missing
newline at end of file.
* gdb.python/py-pp-maint.exp: Download the .py file to the host
and use its host pathname.
* gdb.python/py-pp-registration.exp: Match Windows pathname syntax.
* gdb.python/py-section-script.exp: Use host location of binfile
on safe-path.  Use correct path separator on Windows host.
Reorder alternatives in gdb_test_multiple to prevent matching
the wrong alternative on success.
* gdb.python/py-symtab.exp: Match Windows pathname syntax.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 13 Aug 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoRequire readline 7 or newer
Tom Tromey [Sun, 21 Apr 2019 19:58:49 +0000 (13:58 -0600)]
Require readline 7 or newer

This changes gdb to require readline 7 or newer at build time.

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

* configure: Rebuild.
* configure.ac: Check for readline 7.
* NEWS: Mention readline 7 requirement.
* README: Update.

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

* gdb.texinfo (Configure Options): Document minimum version of
readline.

5 years agoRemove readline hack from gdb_select
Tom Tromey [Sun, 4 Aug 2019 23:39:27 +0000 (17:39 -0600)]
Remove readline hack from gdb_select

As discussed on gdb-patches, this removes the readline hack from the
mingw-hdep.c version of gdb_select.  It's believed that this is not
needed any more.  See:

    https://sourceware.org/ml/gdb-patches/2019-03/msg00465.html

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

* mingw-hdep.c (gdb_select): Remove readline hack.

5 years agoImport readline 8.0
Tom Tromey [Mon, 12 Aug 2019 16:24:03 +0000 (10:24 -0600)]
Import readline 8.0

This imports readline 8.0.

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

* Imported readline 8.0.

5 years agoFix gdb's selftest.exp after readline import
Patrick Palka [Sun, 17 Mar 2019 14:32:16 +0000 (08:32 -0600)]
Fix gdb's selftest.exp after readline import

After the sync there is one testsuite regression, the test
"signal SIGINT" in gdb.gdb/selftest.exp which now FAILs.  Previously,
the readline 6.2 SIGINT handler would temporarily reinstall the
underlying application's SIGINT handler and immediately re-raise SIGINT
so that the orginal handler gets invoked.  But now (since readline 6.3)
its SIGINT handler does not re-raise SIGINT or directly invoke the
original handler; it now sets a flag marking that SIGINT was raised, and
waits until readline explicitly has control to call the application's
SIGINT handler.  Anyway, because SIGINT is no longer re-raised from
within readline's SIGINT handler, doing "signal SIGINT" with a stopped
inferior gdb process will no longer resume and then immediately stop the
process (since there is no 2nd SIGINT to immediately catch).  Instead,
the inferior gdb process will now just print "Quit" and continue to run.
So with this commit, this particular test case is adjusted to reflect
this change in behavior (we now have to send a 2nd SIGINT manually to
stop it).

gdb/testsuite/ChangeLog
2019-08-12  Patrick Palka  <patrick@parcs.ath.cx>

* gdb.gdb/selftest.exp (test_with_self): Update test to now
expect the GDB inferior to no longer immediately stop after
being resumed with "signal SIGINT".

5 years agoRemove gdb workaround from readline/xfree.c
Tom Tromey [Sun, 7 Oct 2018 21:29:57 +0000 (15:29 -0600)]
Remove gdb workaround from readline/xfree.c

There is a gdb-local patch to deal with interrupts during completion.
The original thread adding this patch is here:

https://sourceware.org/ml/gdb-patches/2011-06/msg00147.html

I believe readline now implements the approach suggested by
Chet Ramey:

https://sourceware.org/ml/gdb-patches/2011-06/msg00493.html

So, I believe this patch can be removed.

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

* Makefile.in (xfree.o): Don't depend on readline.h.
* xfree.c (xfree): Remove gdb workaround.
* xmalloc.h (xfree): Remove #define.

5 years agoRemove gdb workaround from readline/emacs_keymap.c
Tom Tromey [Sun, 7 Oct 2018 21:25:44 +0000 (15:25 -0600)]
Remove gdb workaround from readline/emacs_keymap.c

There is a gdb-local patch in readline/emacs_keymap.c that says:

  /* Temporary - this is a bug in readline 5.1 that should be fixed in
     readline 5.2.  */

So, I think this can be removed now.  I have no way to test this, as
the patch was specific to mingw.

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

* emacs_keymap.c: Remove gdb workaround.

5 years agoRemove gdb workaround from readline/complete.c
Tom Tromey [Sun, 7 Oct 2018 21:24:12 +0000 (15:24 -0600)]
Remove gdb workaround from readline/complete.c

This removes a gdb-local patch from readline's get_y_or_n.  The code
references a gdb test that continues to work when I remove this patch.
So, I think it is not needed any more.

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

* complete.c (get_y_or_n): Remove gdb workaround.

5 years agoImport readline 7.0 (patch 5)
Tom Tromey [Sun, 7 Oct 2018 18:52:13 +0000 (12:52 -0600)]
Import readline 7.0 (patch 5)

This imports readline 7.0 (up to patch 5) while preserving all
gdb-local changes.

This was done by checking out the readline git repository, making a
branch based on the gdb baseline revision, applying the gdb changes to
that branch, and then merging from readline 7.

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

* Imported readline 7.0 patch 5.

5 years agoModify the ARM encoding and decoding of SQRSHRL and UQRSHLL MVE instructions.
Srinath Parvathaneni [Mon, 12 Aug 2019 16:17:18 +0000 (17:17 +0100)]
Modify the ARM encoding and decoding of SQRSHRL and UQRSHLL MVE instructions.

This is a change to the first published specifications [1][a] but since there is no hardware
out there that uses the old instructions we do not want to support the old variant.
This changes are done based on the latest published specifications [1][b].

[1] https://developer.arm.com/architectures/cpu-architecture/m-profile/docs/ddi0553/latest/armv81-m-architecture-reference-manual
    [a] version bf
    [b] version bh

gas * config/tc-arm.c (enum operand_parse_code): Add the entry OP_I48_I64.
(po_imm1_or_imm2_or_fail): Marco to check the immediate is either of
        48 or 64.
(parse_operands): Add case OP_I48_I64.
(do_mve_scalar_shift1): Add function to encode the MVE shift
        instructions with 4 arguments.
* testsuite/gas/arm/mve-shift-bad.l: Modify.
* testsuite/gas/arm/mve-shift-bad.s: Likewise.
* testsuite/gas/arm/mve-shift.d: Likewise.
* testsuite/gas/arm/mve-shift.s: Likewise.

opcodes * arm-dis.c (struct mopcode32 mve_opcodes): Modify the mask for
cases MVE_SQRSHRL and MVE_UQRSHLL.
(print_insn_mve): Add case for specifier 'k' to check
specific bit of the instruction.

5 years agoAdd generic and ARM specific support for half-precision IEEE 754 floating point numbe...
Barnaby Wilks [Mon, 12 Aug 2019 10:08:36 +0000 (11:08 +0100)]
Add generic and ARM specific support for half-precision IEEE 754 floating point numbers to the assembler.

Half precision floating point numbers will be encoded using the IEEE 754
half precision floating point format - 16 bits in total, 1 for sign, 5
for exponent and 10 bits of  mantissa.

This patch implements the float16 directive for both the IEEE 754 format
and the Arm alternative format for the Arm backend.

The syntax of the directive is:

  .float16 <0-n decimal numbers>
e.g.
  .float16 12.0
  .float16 0.23, 433.1, 0.06

The Arm alternative format is almost identical to the IEEE 754 format,
except that it doesn't encode for NaNs or Infinity (instead an exponent
of 0x1F represents a normalized number in the range 65536 to 131008).

The alternative format is documented in the reference manual:

  https://static.docs.arm.com/ddi0487/db/DDI0487D_b_armv8_arm.pdf?_ga=2.72318806.49764181.1561632697-999473562.1560847439

Which format is used is controlled by the .float16_format <format>
directive, where if <format> = ieee, then use the IEEE 754
half-precision format else if <format> = alternative, then use the
Arm alternative format

Or the format can be set on the command line via the -mfp16-format
option that has a similar syntax.  -mfp16-format=<ieee|alternative>.
This also fixes the format and it cannot be changed by any directives.

Once the format has been set (either by the command line option or a directive) it cannot be changed,
and any attempts to change it (i.e. with the float16_format directive) will result in a warning and the
line being ignored.

For ELF targets the appropriate EABI attribute will be written out at the end of assembling
if the format has been explicitly specified. If no format has been explicitly specified then no
EABI attributes will be written.

If the format is not explicitly specified then any float16 directives are encoding using the IEEE 754-2008
format by default until the format is fixed or changed with the float16_format directive.

gas * config/tc-arm.c (enum fp_16bit_format): Add enum to represent the 2 float16 encodings.
(md_atof): Set precision for float16 type.
(arm_is_largest_exponent_ok): Check for whether to encode with the IEEE or alternative
format.
(set_fp16_format): Parse a float16_format directive.
(arm_parse_fp16_opt): Parse the fp16-format command line option.
(aeabi_set_public_attributes): For ELF encode the FP16 format EABI attribute.
* config/tc-arm.h (TC_LARGEST_EXPONENT_IS_NORMAL): Macro that expands to
arm_is_largest_exponent_ok.
(arm_is_largest_exponent_ok): Add prototype for arm_is_largest_exponent_ok function.
* doc/c-arm.texi: Add documentation for .float16, .float16_format and -mfp16-format=
* testsuite/gas/arm/float16-bad.d: New test.
* testsuite/gas/arm/float16-bad.l: New test.
* testsuite/gas/arm/float16-bad.s: New test.
* testsuite/gas/arm/float16-be.d: New test.
* testsuite/gas/arm/float16-format-bad.d: New test.
* testsuite/gas/arm/float16-format-bad.l: New test.
* testsuite/gas/arm/float16-format-bad.s: New test.
* testsuite/gas/arm/float16-format-opt-bad.d: New test.
* testsuite/gas/arm/float16-format-opt-bad.l: New test.
* testsuite/gas/arm/float16-le.d: New test.
* testsuite/gas/arm/float16.s: New test.
* testsuite/gas/arm/float16-eabi-alternative-format.d: New test.
* testsuite/gas/arm/float16-eabi-ieee-format.d: New test.
* testsuite/gas/arm/float16-eabi-no-format.d: New test.
* testsuite/gas/arm/float16-eabi.s: New test.

* config/atof-ieee.c (H_PRECISION): Macro for precision of float16
type.
(atof_ieee): Set precision and exponent bits for encoding float16
types.
(gen_to_words): NaN and Infinity encoding for float16.
(ieee_md_atof): Set precision for encoding float16 type.

5 years agoPR24851, gas/testsuite/gas/epiphany/badrelax.s failure with MALLOC_PERTURB_=1
Alan Modra [Mon, 12 Aug 2019 01:45:19 +0000 (11:15 +0930)]
PR24851, gas/testsuite/gas/epiphany/badrelax.s failure with MALLOC_PERTURB_=1

PR 24851
* config/tc-epiphany.c (md_estimate_size_before_relax): Clear
extra opcode bytes when changing from a 2-byte to a 4-byte insn.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 12 Aug 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 11 Aug 2019 00:00:54 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoSort statement_enum and lang_statement_union
Alan Modra [Sat, 10 Aug 2019 03:32:49 +0000 (13:02 +0930)]
Sort statement_enum and lang_statement_union

To make comparing the two easier.

* ldlang.h (enum statement_enum): Sort.
(union lang_statement_union): Sort.

5 years agoDelete unused ldlang.h structs
Alan Modra [Sat, 10 Aug 2019 03:05:20 +0000 (12:35 +0930)]
Delete unused ldlang.h structs

* ldlang.h (lang_common_statement_type): Delete.
(lang_object_symbols_statement_type): Delete.
(union lang_statement_union): Remove common_statement and
object_symbols_statement.

5 years agostat_alloc casts
Alan Modra [Sat, 10 Aug 2019 02:58:31 +0000 (12:28 +0930)]
stat_alloc casts

Casts from a void* just clutter the source.

* ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop, exp_trinop),
(exp_unop, exp_nameop, exp_assop, exp_assert): Remove casts of
stat_alloc return value.
* ldlang.c (new_statement, new_afile, sort_def_symbol),
(lang_memory_region_lookup, lang_memory_region_alias),
(ldlang_add_undef, ldlang_add_require_defined, insert_pad),
(lang_add_gc_name, lang_new_phdr): Likewise.
* lexsup.c (set_segment_start): Likewise.

5 years agolang_input_statement_type next pointers
Alan Modra [Sat, 10 Aug 2019 01:00:19 +0000 (10:30 +0930)]
lang_input_statement_type next pointers

"next" and "next_real_file" in lang_input_statement_type always point
to another lang_input_statement_type, so it makes sense for these to
not be the generic lang_statement_union_type.  This patch also updates
a number of variables in ldlang.c for the same reason, and modifies
lang_statement_append to reduce the need for casts.

* ldlang.h (lang_input_statement_type): Make next
and next_real_file a lang_input_statement_type pointer.
(lang_statement_append): Delete prototype.
(LANG_FOR_EACH_INPUT_STATEMENT): Update for lang_input_statement_type
change.
* ldmain.c (add_archive_element): Likewise.
* ldlang.c: Likewise throughout.
(lang_statement_append): Make static.  Make element and field
void pointers.  Remove casts in calls.
(lang_check): Use a lang_input_statement_type pointer for "file".
(find_rescan_insertion): Similarly for "iter" and return value.
(lang_process): Similarly for "insert", "iter" and "temp".
* emultempl/spuelf.em (embedded_spu_file): Likewise.
* emultempl/aix.em (gld${EMULATION_NAME}_before_allocation): Expand
lang_statment_append call.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 10 Aug 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoMatch Windows pathnames in gdb.linespec/break-ask.exp.
Sandra Loosemore [Fri, 9 Aug 2019 20:45:44 +0000 (13:45 -0700)]
Match Windows pathnames in gdb.linespec/break-ask.exp.

2019-08-09  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.linespec/break-ask.exp: Generalize regexps to match
Windows pathnames too.

5 years agoFix access to uninitialized variable in fill_in_stop_func
Pedro Franco de Carvalho [Fri, 9 Aug 2019 19:49:46 +0000 (16:49 -0300)]
Fix access to uninitialized variable in fill_in_stop_func

This patch changes find_pc_partial_function so that *block is set to
nullptr when it fails, so that fill_in_stop_func won't access an
uninitialized variable.

gdb/ChangeLog:
2019-08-09  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

* blockframe.c (find_pc_partial_function): Set *block to nullptr
when the function fails.

5 years agos390: Implement 'type_align' gdbarch method
Andreas Arnez [Fri, 9 Aug 2019 18:27:03 +0000 (20:27 +0200)]
s390: Implement 'type_align' gdbarch method

The align.exp test case yields many FAILs on s390x, since GDB's _Alignoff
doesn't always agree with the compiler's.  On s390x, the maximum alignment
is 8, but GDB returns an alignment of 16 for 16-byte data types such as
"long double".

This is fixed by implementing the type_align gdbarch method.  The new
method returns an alignment of 8 for all integer, floating-point, and
vector types larger than 8 bytes.  With this change, all align.exp tests
pass.

gdb/ChangeLog:

* s390-tdep.c (s390_type_align): New function.
(s390_gdbarch_init): Set it as type_align gdbarch method.

5 years agoSynchronize libiberty sources with gcc mainline.
Nick Clifton [Fri, 9 Aug 2019 15:16:18 +0000 (16:16 +0100)]
Synchronize libiberty sources with gcc mainline.

* libiberty: Sync with gcc.  Bring in:
2019-08-08  Martin Liska  <mliska@suse.cz>

PR bootstrap/91352
* lrealpath.c (is_valid_fd): New function.

2019-07-24  Martin Liska  <mliska@suse.cz>

PR lto/91228
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Find first '\0' starting from gnu_lto + 1.

2019-07-12  Ren Kimura  <rkx1209dev@gmail.com>

* simple-object-elf.c (simple_object_elf_match): Check zero value shstrndx.
This fixes a Bug 90924.

2019-07-22  Martin Liska  <mliska@suse.cz>

* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Do not search for gnu_lto_v1, but search for first '\0'.

2019-07-18  Eduard-Mihai Burtescu  <eddyb@lyken.rs>

* cplus-dem.c: Include rust-demangle.h.
* rust-demangle.c: Include rust-demangle.h.
* rust-demangle.h: New file.

2019-05-31  Michael Forney  <mforney@mforney.org>

* cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__
is non-zero.

2019-04-30  Ben L  <bobsayshilol@live.co.uk>

* d-demangle.c (dlang_parse_assocarray): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.

* d-demangle.c (dlang_parse_tuple): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.

* d-demangle.c (dlang_parse_structlit): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.

* d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.

* d-demangle.c (dlang_parse_integer): Fix stack underflow.
* testsuite/d-demangle-expected: Add testcase.

* cp-demangle (d_print_comp_inner): Guard against a NULL 'typed_name'.
* testsuite/demangle-expected: Add testcase.

* cp-demangle.c (d_encoding): Guard against NULL return values from
d_right (dc).
* testsuite/demangle-expected: Add testcase.

2019-04-29  Ben L  <bobsayshilol@live.co.uk>

* cp-demangle.c (d_expression_1): Don't peek ahead unless the current
char is valid.
* testsuite/demangle-expected: Add testcase.

2019-04-10  Nick Clifton  <nickc@redhat.com>

PR 89394
* cp-demangle.c (cplus_demangle_fill_name): Reject negative
lengths.
(d_count_templates_scopes): Replace num_templates and num_scopes
parameters with a struct d_print_info pointer parameter.  Adjust
body of the function accordingly.  Add recursion counter and check
that the recursion limit is not reached.
(d_print_init): Pass dpi parameter to d_count_templates_scopes.
Reset recursion counter afterwards, unless the recursion limit was
reached.

5 years agoAdd support for a MIPS specific .MIPS.xhash section.
Mihailo Stojanovic [Fri, 9 Aug 2019 10:06:37 +0000 (11:06 +0100)]
Add support for a MIPS specific .MIPS.xhash section.

  This patch is a reimplementation of [1] which was submitted in 2015 by
Neil Schellenberger. Copyright issue was sorted out [2] last year.
It proposed a new section (.gnu.xhash) and related dynamic tag
(DT_GNU_XHASH). The new section would be virtually identical to the
existing .gnu.hash except for the translation table (xlat) which would
contain correct MIPS .dynsym indexes corresponding to the hashvals in
chains. This is because MIPS ABI imposes a different ordering on the
dynsyms than the one expected by the .gnu.hash section. Another addition
would be a leading word (ngnusyms) which would contain the number of
entries in the translation table.

  In this patch, the new section name and dynamic tag are changed to
reflect the fact that the section should be treated as MIPS-specific
(.MIPS.xhash and DT_MIPS_XHASH).

  This patch addresses the alignment issue as reported in [3], which is
caused by the leading word added to the .MIPS.xhash section. Leading word
is removed in this patch, and the number of entries in the translation
table is now calculated using DT_MIPS_SYMTABNO dynamic tag (this is
addressed by the corresponding glibc patch).

  Suggestions on coding style in [4] were taken into account. Existing
GNU hash testcase was covered, and another one was added in the MIPS
part of the testsuite.

  The other major change is reserving MIPS ABI version 5 for .MIPS.xhash,
marking the need of support for .MIPS.xhash in the dynamic linker (again,
addressed in the corresponding glibc patch). This is something which I
am not sure of, especially after reading [5]. I am confused on whether
this ABI version is reserved for IFUNC, or it can be used for this
purpose.

Already mentioned glibc patch is submitted at:
https://sourceware.org/ml/libc-alpha/2019-06/msg00456.html

[1] https://sourceware.org/ml/binutils/2015-10/msg00057.html
[2] https://sourceware.org/ml/binutils/2018-03/msg00025.html
[3] https://sourceware.org/ml/binutils/2016-01/msg00006.html
[4] https://sourceware.org/ml/binutils/2016-02/msg00097.html
[5] https://sourceware.org/ml/libc-alpha/2016-12/msg00853.html

ld      * emulparams/elf32bmip.sh: Add .MIPS.xhash section.
        * emulparams/elf32bmipn32-defs.sh: Add .MIPS.xhash section.
        * emulparams/elf64bmip-defs.sh: Add .MIPS.xhash section.
        * emultempl/mipself.em: Remove mips_after_parse function.
        * testsuite/ld-elf/hash.d: Update comment.
        * testsuite/ld-mips-elf/hash1.d: New test.
        * testsuite/ld-mips-elf/hash1.s: Ditto.
        * testsuite/ld-mips-elf/hash1a.d: Remove.
        * testsuite/ld-mips-elf/hash1b.d: Ditto.
        * testsuite/ld-mips-elf/hash1c.d: Ditto
        * testsuite/ld-mips-elf/hash2.d: New test.
        * testsuite/ld-mips-elf/mips-elf.exp: New tests.
        * testsuite/ld-mips-elf/start.s: New test.

bfd     * elf-bfd.h (struct elf_backend_data): New members.
        * elflink.c (_bfd_elf_link_create_dynamic_sections): Create
        .gnu.hash section if necessary.
        (struct collect_gnu_hash_codes): New member.
        (elf_gnu_hash_process_symidx): New function name.
        (elf_renumber_gnu_hash_syms): Ignore local and undefined
        symbols. Record xlat location for every symbol which should have
        a .MIPS.xhash entry.
        (bfd_elf_size_dynamic_sections): Add DT_GNU_HASH dynamic tag to
        dynamic section if necessary.
        (GNU_HASH_SECTION_NAME): New define.
        (bfd_elf_size_dynsym_hash_dynstr): Get .MIPS.xhash section.
        Update the section size info.
        * elfxx-mips.c (struct mips_elf_hash_sort_data): New members.
        (struct mips_elf_link_hash_entry): New member.
        (mips_elf_link_hash_newfunc): Initialize .MIPS.xhash translation
        table location.
        (mips_elf_sort_hash_table): Initialize the pointer to the
        .MIPS.xhash section.
        (mips_elf_sort_hash_table_f): Populate the .MIPS.xhash
        translation table entry with the symbol dynindx.
        (_bfd_mips_elf_section_from_shdr): Add SHT_MIPS_XHASH.
        (_bfd_mips_elf_fake_sections): Initialize .MIPS.xhash section
        info.
        (_bfd_mips_elf_create_dynamic_sections): Create .MIPS.xhash
        section.
        (_bfd_mips_elf_size_dynamic_sections): Add DT_MIPS_XHASH tag to
        dynamic section.
        (_bfd_mips_elf_finish_synamic_sections): Add DT_MIPS_XHASH.
        (_bfd_mips_elf_final_write_processing): Set .MIPS.xhash section
        sh_link info.
        (_bfd_mips_elf_get_target_dtag): Get DT_MIPS_XHASH tag.
        (MIPS_LIBC_ABI_XHASH): New ABI version enum value.
        (_bfd_mips_post_process_headers): Mark the ABI version as
        MIPS_LIBC_ABI_XHASH if there exists a .MIPS.xhash section,
        but not a .hash section.
        (_bfd_mips_elf_record_xhash_symbol): New function. Record a
        position in the translation table, associated with the hash
        entry.
        * elfxx-mips.h (literal_reloc_p): Define
        elf_backend_record_xhash_symbol backend hook.
        * elfxx-target.h: Initialize elf_backend_record_xhash_symbol
        backend hook.

include * elf/mips.h (SHT_GNU_XHASH): New define.
        (DT_GNU_XHASH): New define.

binutils * readelf.c (get_mips_dynamic_type): Return MIPS_XHASH dynamic type.
        (get_mips_section_type_name): Return MI{S_XHASH name string.
        (dynamic_section_mips_val): Initialize the .MIPS.xhash dynamic
        info.
        (process_symbol_table): Initialize the .MIPS.xhash section
        pointer. Adjust the readelf output to support the new section.
        (process_object): Set the .MIPS.xhash dynamic info to zero.

5 years agodoc: fix PAC typo
Alan Hayward [Thu, 8 Aug 2019 08:01:12 +0000 (09:01 +0100)]
doc: fix PAC typo

gdb/doc/ChangeLog:

* gdb.texinfo (AArch64 Pointer Authentication): Fix typo.

5 years agoArm: Skip tests on WINCE that require mapping symbols
Tamar Christina [Fri, 9 Aug 2019 08:06:50 +0000 (09:06 +0100)]
Arm: Skip tests on WINCE that require mapping symbols

The following tests fail on wince as they rely on mapping symbols to
give them a fixed order.

This skips them on platforms that don't have mapping symbols.

binutils/ChangeLog:

* testsuite/binutils-all/arm/in-order-all.d: Skip on pe, wince, coff.
* testsuite/binutils-all/arm/in-order.d: Likewise.
* testsuite/binutils-all/arm/out-of-order-all.d: Likewise.
* testsuite/binutils-all/arm/out-of-order.d: Likewise.

5 years agox86-64: generalize SIMD test expectations
Jan Beulich [Fri, 9 Aug 2019 07:57:57 +0000 (09:57 +0200)]
x86-64: generalize SIMD test expectations

In order to be able to add/remove insns to/from the middle of these
tests, generalize the patterns for the symbol reference comments of RIP-
relative operands.

5 years ago[gdb] Fix gdb.dwarf2/varval.exp with -fPIE/-pie
Tom de Vries [Fri, 9 Aug 2019 04:49:04 +0000 (06:49 +0200)]
[gdb] Fix gdb.dwarf2/varval.exp with -fPIE/-pie

With target board unix/-fPIE/-pie, we get:
...
FAIL: gdb.dwarf2/varval.exp: print varval2
...

This is due comparing a get_frame_pc result (which includes the for PIE
non-zero relocation offset) with pc_high and pc_low obtained using
get_scope_pc_bounds (which do not include the relocation offset).

Fix this by adjusting pc_high and pc_low with the relocation offset.

Tested on x86_64-linux with target board unix/-fPIE/-pie.

gdb/ChangeLog:

2019-08-09  Tom de Vries  <tdevries@suse.de>

PR gdb/24591
* dwarf2read.c (dwarf2_fetch_die_loc_sect_off): Adjust pc_high and
pc_low with relocation offset.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 9 Aug 2019 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years ago[gdb/testsuite] Fix gdb.tui/basic.exp with check-read1
Tom de Vries [Thu, 8 Aug 2019 20:26:28 +0000 (22:26 +0200)]
[gdb/testsuite] Fix gdb.tui/basic.exp with check-read1

With gdb.tui/basic.exp and check-read1, we run into (using -v for
verbose log):
...
^[[0+++ _csi_0 <<<>>>
ERROR: (DejaGnu) proc "_csi_0" does not exist.
...

In contrast, without check-read1, we have:
...
^[[0;10m<SNIP>+++ _csi_m <<<0;10>>>
...

The problem is that this regexp in _accept:
...
           -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" {
...
while matching the longer sequence '^[' '[' '0' ';' '1' '0' 'm', also matches
the shorter sequence '^[' '[' '0'.

The regexp attempts to match a CSI (Control Sequence Introducer) sequence, and
the final byte of such a sequence cannot be a digit.

Fix the regexp accordingly:
...
-           -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" {
+           -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" {
...

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-08-08  Tom de Vries  <tdevries@suse.de>

PR testsuite/24862
* lib/tuiterm.exp (_accept): Fix CSI regexp.

5 years agoChange the output of readelf's note display so that the "Data size" column header...
Nick Clifton [Thu, 8 Aug 2019 16:04:31 +0000 (17:04 +0100)]
Change the output of readelf's note display so that the "Data size" column header is left justified.

PR 24887
binutils* readelf.c (process_notes_at): Left justify the "Data size"
column heading.
* testsuite/binutils-all/i386/empty.d: Adjust for new output format.
* testsuite/binutils-all/i386/ibt.d: Likewise.
* testsuite/binutils-all/i386/pr21231a.d: Likewise.
* testsuite/binutils-all/i386/pr21231b.d: Likewise.
* testsuite/binutils-all/i386/shstk.d: Likewise.
* testsuite/binutils-all/note-2-32.d: Likewise.
* testsuite/binutils-all/note-2-64.d: Likewise.
* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
* testsuite/binutils-all/x86-64/empty.d: Likewise.
* testsuite/binutils-all/x86-64/ibt-x32.d: Likewise.
* testsuite/binutils-all/x86-64/ibt.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231a.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
* testsuite/binutils-all/x86-64/shstk-x32.d: Likewise.
* testsuite/binutils-all/x86-64/shstk.d: Likewise.

ld * testsuite/ld-aarch64/bti-plt-2.d: Adjust for new output format
from readelf.
* testsuite/ld-aarch64/bti-plt-4.d: Likewise.
* testsuite/ld-aarch64/bti-plt-6.d: Likewise.
* testsuite/ld-aarch64/bti-plt-7.d: Likewise.
* testsuite/ld-aarch64/bti-warn.d: Likewise.
* testsuite/ld-aarch64/property-bti-pac1.d: Likewise.
* testsuite/ld-aarch64/property-bti-pac2.d: Likewise.
* testsuite/ld-aarch64/property-bti-pac3.d: Likewise.
* testsuite/ld-elf/x86-feature-1a.rd: Likewise.
* testsuite/ld-elf/x86-feature-1b.rd: Likewise.
* testsuite/ld-elf/x86-feature-1c.rd: Likewise.
* testsuite/ld-elf/x86-feature-1d.rd: Likewise.
* testsuite/ld-elf/x86-feature-1e.rd: Likewise.
* testsuite/ld-i386/ibt-plt-2d.d: Likewise.
* testsuite/ld-i386/ibt-plt-3d.d: Likewise.
* testsuite/ld-i386/pr23372a.d: Likewise.
* testsuite/ld-i386/pr23372c.d: Likewise.
* testsuite/ld-i386/pr23486a.d: Likewise.
* testsuite/ld-i386/pr23486b.d: Likewise.
* testsuite/ld-i386/pr23486c.d: Likewise.
* testsuite/ld-i386/pr23486d.d: Likewise.
* testsuite/ld-i386/pr24322a.d: Likewise.
* testsuite/ld-i386/pr24322b.d: Likewise.
* testsuite/ld-i386/property-x86-3.d: Likewise.
* testsuite/ld-i386/property-x86-4a.d: Likewise.
* testsuite/ld-i386/property-x86-5.d: Likewise.
* testsuite/ld-i386/property-x86-cet1.d: Likewise.
* testsuite/ld-i386/property-x86-cet2a.d: Likewise.
* testsuite/ld-i386/property-x86-cet5a.d: Likewise.
* testsuite/ld-i386/property-x86-cet5b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt2.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt4.d: Likewise.
* testsuite/ld-i386/property-x86-ibt5.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk2.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk4.d: Likewise.
* testsuite/ld-i386/property-x86-shstk5.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2d.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372a.d: Likewise.
* testsuite/ld-x86-64/pr23372c-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372c.d: Likewise.
* testsuite/ld-x86-64/pr23486a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486a.d: Likewise.
* testsuite/ld-x86-64/pr23486b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486b.d: Likewise.
* testsuite/ld-x86-64/pr23486c-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486c.d: Likewise.
* testsuite/ld-x86-64/pr23486d-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486d.d: Likewise.
* testsuite/ld-x86-64/pr24322a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24322a.d: Likewise.
* testsuite/ld-x86-64/pr24322b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24322b.d: Likewise.
* testsuite/ld-x86-64/pr24458a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458a.d: Likewise.
* testsuite/ld-x86-64/pr24458b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458b.d: Likewise.
* testsuite/ld-x86-64/pr24458c-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458c.d: Likewise.
* testsuite/ld-x86-64/property-1.r: Likewise.
* testsuite/ld-x86-64/property-1a.r: Likewise.
* testsuite/ld-x86-64/property-2.r: Likewise.
* testsuite/ld-x86-64/property-2a.r: Likewise.
* testsuite/ld-x86-64/property-3.r: Likewise.
* testsuite/ld-x86-64/property-3a.r: Likewise.
* testsuite/ld-x86-64/property-4.r: Likewise.
* testsuite/ld-x86-64/property-4a.r: Likewise.
* testsuite/ld-x86-64/property-5.r: Likewise.
* testsuite/ld-x86-64/property-5a.r: Likewise.
* testsuite/ld-x86-64/property-6.r: Likewise.
* testsuite/ld-x86-64/property-7.r: Likewise.
* testsuite/ld-x86-64/property-7a.r: Likewise.
* testsuite/ld-x86-64/property-x86-3-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-3.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a.d: Likewise.
* testsuite/ld-x86-64/property-x86-5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-5.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet1-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet1.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5.d: Likewise.

gas * testsuite/gas/i386/property-1.d: Adjust for new output format
from readelf.
* testsuite/gas/i386/property-2.d: Likewise.
* testsuite/gas/i386/x86-64-property-1.d: Likewise.
* testsuite/gas/i386/x86-64-property-2.d: Likewise.

5 years agoUpdate the handling of shift rotate and load/store multiple instructions in the...
Yoshinori Sato [Thu, 8 Aug 2019 12:59:17 +0000 (13:59 +0100)]
Update the handling of shift rotate  and load/store multiple instructions in the H8300 assembler.

incldue * opcode/h8300.h (EXPAND_UNOP_EXTENDED_B): Add MODEL.
(EXPAND_UNOP_EXTENDED_W): Likewise.
(EXPAND_UNOP_EXTENDED_L): Likewise.
(struct h8_opcode h8_opcodes): Likewise.
(struct h8_opcode h8_opcodes): tas / ldm / stm supported H8S or
later.

5 years agoMove the h8300 assembler's MOVFPE and MOVTPE tests to the correct location.
Yoshinori Sato [Thu, 8 Aug 2019 12:43:13 +0000 (13:43 +0100)]
Move the h8300 assembler's MOVFPE and MOVTPE tests to the correct location.

* gas/testsuite/gas/h8300/h8300.exp: Fix movfpe and movtpe tests.
* gas/testsuite/gas/h8300/misc.s: Likewise.
* gas/testsuite/gas/h8300/misch.s: Likewise.
* gas/testsuite/gas/h8300/miscs.s: Likewise.

5 years agoFix problem building PE DLL test generator with compilers that do not support c99...
Nick Clifton [Thu, 8 Aug 2019 09:24:08 +0000 (10:24 +0100)]
Fix problem building PE DLL test generator with compilers that do not support c99/c11.

* testsuite/gentestdlls.c (main): Move declaration of loop
variable outside of the for() statement.

5 years agoreadelf: mask unknown description data bytes.
Jordan Rupprecht via binutils [Wed, 7 Aug 2019 20:48:14 +0000 (13:48 -0700)]
readelf: mask unknown description data bytes.

When printing unknown note types, readelf prints the raw description
section byte-by-byte. However, it does not mask appropriately, e.g. it
prints the byte 'ba' as 'ffffffba'.

* readelf.c (process_note): Mask unknown description data bytes.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 8 Aug 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in

5 years agoPrevent objdump from aborting when asked to disassemble an unknown type of ARC binary...
Phillipe Antoine [Wed, 7 Aug 2019 16:22:29 +0000 (17:22 +0100)]
Prevent objdump from aborting when asked to disassemble an unknown type of ARC binary file.

PR 24854
* arc-dis.c (arc_insn_length): Return 0 rather than aborting when
encountering an unknown machine type.
(print_insn_arc): Handle arc_insn_length returning 0.  In error
cases return -1 rather than calling abort.

5 years agoInteger overflows in readelf get_data
Alan Modra [Wed, 7 Aug 2019 14:07:49 +0000 (23:37 +0930)]
Integer overflows in readelf get_data

I noticed the test for overflow of amt = size * nmemb in get_data
wasn't effective.  An obvious example of nmemb = 3 and size = half max
value overflows but doesn't result in amt < nmemb.  This patch fixes
this problem and reports a size truncation or overflow rather than out
of memory in more cases.

* readelf.c (get_data): Improve overflow checks.

5 years agoImprove the formatting of the title strings of the binutils manual pages.
Nick Clifton [Wed, 7 Aug 2019 14:15:59 +0000 (15:15 +0100)]
Improve the formatting of the title strings of the binutils manual pages.

PR 24777
* doc/binutils.texi: Ensure consistent formating of title strings
for man pages.  Extend the title of the size man page to be more
informative.

5 years agoMake struct frame_arg self-managing
Tom Tromey [Tue, 6 Aug 2019 19:50:03 +0000 (13:50 -0600)]
Make struct frame_arg self-managing

This changes struct frame_arg to be self-managing and then fixes the
various users.

Tested by the buildbot.

gdb/ChangeLog
2019-08-07  Tom Tromey  <tromey@adacore.com>

* stack.c (print_frame_arg, read_frame_local, read_frame_arg)
(print_frame_args): Update.
* python/py-framefilter.c (py_print_single_arg, enumerate_args):
Update.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* frame.h (struct frame_arg): Add initializers.
<error>: Now a unique_xmalloc_ptr.

5 years agoAArch64 pauth: Indicate unmasked addresses in backtrace
Alan Hayward [Wed, 7 Aug 2019 08:47:57 +0000 (09:47 +0100)]
AArch64 pauth: Indicate unmasked addresses in backtrace

Armv8.3-a Pointer Authentication causes the function return address to be
obfuscated on entry to some functions. GDB must unmask the link register in
order to produce a backtrace.

The following patch adds markers of [PAC] to the bracktrace, to indicate
which addresses needed unmasking.  This includes the backtrace when using MI.

For example, consider the following backtrace:

(gdb) bt
0  0x0000000000400490 in puts@plt ()
1  0x00000000004005dc in foo ("hello") at cbreak-lib.c:6
2  0x0000000000400604 [PAC] in bar () at cbreak-lib.c:12
3  0x0000000000400620 [PAC] in main2 () at cbreak.c:17
4  0x00000000004005b4 in main () at cbreak-3.c:10

The functions in cbreak-lib use pointer auth, which masks the return address
to the previous function, causing the addresses of bar (in the library) and main2
(in the main binary) to require unmasking in order to unwind the backtrace.

An extra bool is added alongside the prev_pc in the frame structure.  At the
point at which the link register is unmasked, the AArch64 port calls into frame
to sets the bool.  This is the most efficient way of doing it.

The marker is also added to the python frame printer, which is always printed if
set.  The marker is not explicitly exposed to the python code.

I expect this will potentially cause issues with some tests in the testsuite
when Armv8.3 pointer authentication is used.  This should be fixed up in the
the future once real hardware is available for full testsuite testing.

gdb/ChangeLog:

        * NEWS: Expand the Pointer Authentication entry.
        * aarch64-tdep.c (aarch64_frame_unmask_address): Rename from this.
        (aarch64_frame_unmask_lr): ... to this.
        (aarch64_prologue_prev_register, aarch64_dwarf2_prev_register):
        Call aarch64_frame_unmask_lr.
        * frame.c (struct frame_info): Add "masked" variable.
        (frame_set_previous_pc_masked) (frame_get_pc_masked): New functions.
        (fprint_frame): Check for masked pc.
        * frame.h (frame_set_previous_pc_masked) (frame_get_pc_masked): New
        declarations.
* python/py-framefilter.c (py_print_frame): Check for masked pc.
        * stack.c (print_frame): Check for masked pc.

gdb/doc/ChangeLog:

        * gdb.texinfo (AArch64 Pointer Authentication): New subsection.

5 years agold: use a specific linker script in BPF targets
Jose E. Marchesi [Wed, 7 Aug 2019 09:40:55 +0000 (11:40 +0200)]
ld: use a specific linker script in BPF targets

This patch makes the elf64bpf emulation to use it's own linker script,
based on elf.sc.  At the moment, the only change is that the BPF
executable doesn't define an entry symbol (BPF programs feature
several entry points scattered in several sections.)

This is a step towards the goal of generating proper ELF executables
that would be loaded by the kernel's libbpf.  We are not there yet:
BPF "programs" should still be linked with -r.

This change removes a warning while linking executables, decreases the
number of unsupported tests in the target from 47 to 29, and increases
the number of expected passes from 104 to 145.

Regtested in x86_64 for all targets.
No regressions.

ld/ChangeLog:

2019-08-07  Jose E. Marchesi  <jose.marchesi@oracle.com>

* scripttempl/elf64bpf.sc: Adapted from elf.sc.
* emulparams/elf64bpf.sh (SCRIPT_NAME): Use elf64bpf.
(EMBEDDED): Define.
* testsuite/ld-bpf/call-1.d: Do not expect a warning regarding an
undefined entry symbol.
* testsuite/ld-bpf/jump-1.d: Likewise.
* testsuite/ld-undefined/undefined.exp: Do not pass '-e entry' to
ld in BPF targets, and do not expect line number information.
* testsuite/ld-srec/srec.exp (run_srec_test): xfail s-record tests
in BPF targets.

5 years agobfd: use the ELF linker to perform relocations in BPF targets
Jose E. Marchesi [Wed, 7 Aug 2019 09:33:13 +0000 (11:33 +0200)]
bfd: use the ELF linker to perform relocations in BPF targets

This patch changes the eBPF linker to provide a relocate_section
function instead of relying on using special functions in relocation
howtos.

Tested in x86_64 host.
No regressions.

bfd/ChangeLog:

2019-08-07  Jose E. Marchesi  <jose.marchesi@oracle.com>

* elf64-bpf.c (bpf_elf_relocate_section): New function.
(bpf_elf_insn_disp_reloc): Delete function.
(elf_backend_relocate_section): Define.

5 years agoPR24644, OOM-Bug in _bfd_archive_64_bit_slurp_armap
Alan Modra [Wed, 7 Aug 2019 09:23:09 +0000 (18:53 +0930)]
PR24644, OOM-Bug in _bfd_archive_64_bit_slurp_armap

PR 24644
* archive64.c (_bfd_archive_64_bit_slurp_armap): Properly check
for overflow in expressions involving nsymz.

5 years agoFix the binutils test for .NET assembly support so that it distinguishing between...
Omair Majid [Wed, 7 Aug 2019 09:20:56 +0000 (10:20 +0100)]
Fix the binutils test for .NET assembly support so that it distinguishing between targets which do not support the x86 PE format at all, and those that do support it, but which do not recognise the .NET assembly variants.

* testsuite/binutils-all/objdump.exp
(test_objdump_dotnet_assemblies): Fix test to distinguish errors
in parsing simple pei-i386 and pei-x86-64 vs parsing the newly
introduced machine types.
* testsuite/gentestdlls.c (write_simple_dll): New function.
(main): Generate simple and Linux-specific variants of pei-i386
and pei-x86-64 files so both can be used by tests.

5 years agox86: drop stray FloatMF
Jan Beulich [Wed, 7 Aug 2019 08:46:52 +0000 (10:46 +0200)]
x86: drop stray FloatMF

The flag is supposed to be used in templates which allow for both a
"short" and a "long" format memory operand. Drop it from templates not
matching this pattern. In the control/status word cases it was (ab)used
in place of the intended IgnoreSize.

5 years agoPR24876, readelf: heap-buffer-overflow in dump_ia64_unwind
Alan Modra [Wed, 7 Aug 2019 02:20:28 +0000 (11:50 +0930)]
PR24876, readelf: heap-buffer-overflow in dump_ia64_unwind

PR 24876
* readelf.c (dump_ia64_unwind): Check that buffer is large
enough for "stamp" before reading.

5 years agoIntroduce obstack_strndup
Tom Tromey [Sat, 13 Jul 2019 18:13:15 +0000 (12:13 -0600)]
Introduce obstack_strndup

This introduces obstack_strndup and changes gdb to use it.

Note that obstack_strndup works like savestring, and not exactly like
xstrndup.  The difference is that obstack_strndup uses the passed-in
length, while xstrndup uses strnlen to choose the length.

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

* stabsread.c (patch_block_stabs, read_one_struct_field)
(read_enum_type): Use obstack_strndup.
* rust-exp.y (rust_parser::copy_name): Use obstack_strndup.
* gdb_obstack.h (obstack_strndup): Use obstack_strndup.
* dwarf2read.c (guess_full_die_structure_name)
(anonymous_struct_prefix): Use obstack_strndup.
* dbxread.c (cp_set_block_scope): Use obstack_strndup.
* c-exp.y (yylex): Use obstack_strndup.
* ada-exp.y (write_object_renaming, write_ambiguous_var)
(write_var_or_type): Use obstack_strndup.

5 years agoAdd obstack_strdup overload taking a std::string
Tom Tromey [Sat, 13 Jul 2019 18:09:51 +0000 (12:09 -0600)]
Add obstack_strdup overload taking a std::string

This adds an obstack_strdup overload that takes a std::string, and
changes a few spots in gdb to use it.

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

* symfile.c (reread_symbols): Use obstack_strdup.
* stabsread.c (read_type): Use obstack_strdup.
* gdb_obstack.h (obstack_strdup): New overload.
* dwarf2read.c (dwarf2_compute_name, create_dwo_unit_in_dwp_v1)
(create_dwo_unit_in_dwp_v2, build_error_marker_type)
(dwarf2_canonicalize_name): Use obstack_strdup.
* dbxread.c (read_dbx_symtab): Use obstack_strdup.
* cp-support.c (inspect_type, replace_typedefs_qualified_name):
Use obstack_strdup.

5 years agoMake obstack_strdup inline
Tom Tromey [Sat, 13 Jul 2019 18:03:07 +0000 (12:03 -0600)]
Make obstack_strdup inline

This changes obstack_strdup to be an inline function.  This seems
better to me, considering how small it is; but also it follows what
the code did before the previous patch.

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

* gdb_obstack.h (obstack_strdup): Define.
* gdb_obstack.c (obstack_strdup): Don't define.

5 years agoUse obstack_strdup more
Tom Tromey [Sat, 18 May 2019 21:56:03 +0000 (15:56 -0600)]
Use obstack_strdup more

This changes gdb to use obstack_strdup when appropriate, rather than
the wordier obstack_copy0.

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

* xcoffread.c (SYMNAME_ALLOC, process_xcoff_symbol): Use
obstack_strdup.
* typeprint.c (typedef_hash_table::find_global_typedef): Use
obstack_strdup.
* symfile.c (allocate_compunit_symtab): Use obstack_strdup.
* stabsread.c (common_block_start): Use obstack_strdup.
* objfiles.c (set_objfile_main_name, objfile): Use
obstack_strdup.
* namespace.c (add_using_directive): Use obstack_strdup.
* mdebugread.c (parse_symbol, parse_type): Use obstack_strdup.
* jit.c (finalize_symtab): Use obstack_strdup.
* dwarf2read.c (fixup_go_packaging, dwarf2_physname)
(guess_partial_die_structure_name, partial_die_info::fixup)
(dwarf2_name): Use obstack_strdup.
* coffread.c (coff_read_struct_type, coff_read_enum_type): Use
obstack_strdup.
* c-exp.y (scan_macro_expansion): Use obstack_strdup.
* buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Use
obstack_strdup.
* ada-lang.c (ada_decode_symbol): Use obstack_strdup.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 7 Aug 2019 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in