external/binutils.git
5 years agoRemove useless assignment from tui_remove_hooks
Tom Tromey [Fri, 12 Jul 2019 05:24:03 +0000 (23:24 -0600)]
Remove useless assignment from tui_remove_hooks

tui_remove_hooks clears deprecated_query_hook, but nothing in the TUI
ever sets it; so remove the assignment.

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

* tui/tui-hooks.c (tui_remove_hooks): Don't set
deprecated_query_hook.

5 years agoChange tui_show_symtab_source to be a method
Tom Tromey [Fri, 12 Jul 2019 02:00:07 +0000 (20:00 -0600)]
Change tui_show_symtab_source to be a method

This changes tui_show_symtab_source to be a method on
tui_source_window.

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

* tui/tui-winsource.c (tui_update_source_windows_with_addr)
(tui_update_source_windows_with_line): Update.
* tui/tui-source.h (struct tui_source_window)
<show_symtab_source>: Declare.
(tui_show_symtab_source): Don't declare.
* tui/tui-source.c (tui_show_symtab_source): Rename from
tui_show_symtab_source.

5 years agoIntroduce tui_source_window_base::set_contents method
Tom Tromey [Fri, 12 Jul 2019 00:42:20 +0000 (18:42 -0600)]
Introduce tui_source_window_base::set_contents method

This introduces the tui_source_window_base::set_contents method and
implements it in the subclasses.  This removes a check of the window
type.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<set_contents>: Declare.
* tui/tui-winsource.c
(tui_source_window_base::update_source_window_as_is): Update.
* tui/tui-source.h (struct tui_source_window) <set_contents>:
Declare.
(tui_set_source_content): Don't declare.
* tui/tui-source.c (tui_source_window::set_contents): Rename from
tui_set_source_content.
* tui/tui-disasm.h (struct tui_disasm_window) <set_contents>:
Declare.
(tui_set_disassem_content): Don't declare.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Rename from
tui_set_disassem_content.

5 years agoChange tui_update_breakpoint_info to be a method
Tom Tromey [Fri, 12 Jul 2019 00:27:02 +0000 (18:27 -0600)]
Change tui_update_breakpoint_info to be a method

This changes tui_update_breakpoint_info to be a method on
tui_source_window_base.

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

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

5 years agoChange tui_update_source_window to be a method
Tom Tromey [Fri, 12 Jul 2019 00:24:07 +0000 (18:24 -0600)]
Change tui_update_source_window to be a method

This changes tui_update_source_window to be a method on
tui_source_window_base.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<update_source_window>: Declare.
(tui_update_source_window): Don't declare.
* tui/tui-winsource.c
(tui_source_window_base::update_source_window): Rename from
tui_update_source_window.
(tui_source_window_base::rerender): Update.
* tui/tui-source.c (tui_source_window::maybe_update): Update.
* tui/tui-disasm.c (tui_show_disassem)
(tui_show_disassem_and_update_source)
(tui_disasm_window::maybe_update): Update.

5 years agoChange tui_update_source_window_as_is to be a method
Tom Tromey [Fri, 12 Jul 2019 00:22:06 +0000 (18:22 -0600)]
Change tui_update_source_window_as_is to be a method

This changes tui_update_source_window_as_is to be a method on
tui_source_window_base.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<update_source_window_as_is>: Declare.
(tui_update_source_window_as_is): Don't declare.
* tui/tui-winsource.c (tui_update_source_window): Update
(tui_source_window_base::update_source_window_as_is): Rename from
tui_update_source_window_as_is.
(tui_source_window_base::refill): Update.
* tui/tui-source.c (tui_show_symtab_source): Update.
* tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical):
Update.

5 years agoRemove "noerror" parameter from some TUI functions
Tom Tromey [Fri, 12 Jul 2019 00:19:28 +0000 (18:19 -0600)]
Remove "noerror" parameter from some TUI functions

A few TUI functions take a "noerror" parameter.  This is only checked
in one spot: in tui_set_source_content, if noerror is false, and if an
error occurs, then the function will call print_sys_errmsg.

This seems misguided to me, so this patch removes that code and this
parameter.

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

* tui/tui-winsource.h (tui_update_source_window)
(tui_update_source_window_as_is): Remove "noerror" parameter.
* tui/tui-winsource.c (tui_update_source_window)
(tui_update_source_window_as_is): Remove "noerror" parameter.
(tui_update_source_windows_with_addr)
(tui_update_source_windows_with_line)
(tui_source_window_base::rerender)
(tui_source_window_base::refill): Update.
* tui/tui-source.h (tui_set_source_content)
(tui_show_symtab_source): Remove "noerror" parameter.
* tui/tui-source.c (tui_set_source_content): Remove "noerror"
parameter.
(tui_show_symtab_source): Likewise.
(tui_source_window::maybe_update): Update.
* tui/tui-disasm.c (tui_show_disassem)
(tui_show_disassem_and_update_source)
(tui_disasm_window::do_scroll_vertical)
(tui_disasm_window::maybe_update): Update.

5 years agoRemove separate visibility flag
Tom Tromey [Fri, 12 Jul 2019 00:03:45 +0000 (18:03 -0600)]
Remove separate visibility flag

TUI windows keep track of their visibility in a boolean field.
However, this is not needed, because a window is visible if and only
if it has an underlying curses handle.  So, we can remove this
separate field.

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

* tui/tui.c (tui_is_window_visible): Update.
* tui/tui-wingeneral.c (tui_make_window)
(tui_gen_win_info::make_visible, tui_refresh_all): Update.
* tui/tui-win.c (window_name_completer, tui_refresh_all_win)
(tui_set_focus_command, tui_all_windows_info, update_tab_width)
(tui_set_win_height_command, parse_scrolling_args): Update.
* tui/tui-source.c (tui_source_window::style_changed): Update.
* tui/tui-regs.c (tui_show_registers)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_check_register_values, tui_reg_command): Update.
* tui/tui-disasm.c (tui_show_disassem): Update.
* tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New
method.
<is_visible>: Remove field.
* tui/tui-data.c (tui_next_win, tui_prev_win)
(tui_delete_invisible_windows): Update.

5 years agoRemove m_has_locator
Tom Tromey [Wed, 10 Jul 2019 03:22:38 +0000 (21:22 -0600)]
Remove m_has_locator

The previous patch removed the only use of m_has_locator, so this
member can now be removed.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<m_has_locator>: Remove.
* tui/tui-layout.c (show_source_disasm_command, show_data)
(show_source_or_disasm_and_command): Update.

5 years agoFix detection of missing plugin for LTO objects.
Martin Liska [Fri, 16 Aug 2019 11:14:36 +0000 (13:14 +0200)]
Fix detection of missing plugin for LTO objects.

2019-08-16  Martin Liska  <mliska@suse.cz>

PR ld/24912
* elflink.c: Report error only for not relocatable.
* linker.c (_bfd_generic_link_add_one_symbol): Do not handle
here lto_slim_object as it's handled in caller.
2019-08-16  Martin Liska  <mliska@suse.cz>

PR ld/24912
* object.cc (big_endian>::do_layout): Do not report error,
but only set a flag.
(big_endian>::do_add_symbols): Report error only for when
relocatable.

5 years agoMove [PAC] into a new MI field addr_flags
Alan Hayward [Fri, 16 Aug 2019 09:19:18 +0000 (10:19 +0100)]
Move [PAC] into a new MI field addr_flags

Add a new print_pc which prints both the PC and a new field addr_flags.
Call this wherever the PC is printed in stack.c.

Add a new gdbarch method get_pc_address_flags to obtain the addr_flag
contents. By default returns an empty string, on AArch64 this returns
PAC if the address has been masked in the frame.

Document this in the manual and NEWS file.

gdb/ChangeLog:

* NEWS (Other MI changes): New subsection.
* aarch64-tdep.c (aarch64_get_pc_address_flags): New function.
(aarch64_gdbarch_init): Add aarch64_get_pc_address_flags.
* arch-utils.c (default_get_pc_address_flags): New function.
* arch-utils.h (default_get_pc_address_flags): New declaration.
* gdbarch.sh: Add get_pc_address_flags.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* stack.c (print_pc): New function.
(print_frame_info) (print_frame): Call print_pc.

gdb/doc/ChangeLog:

* gdb.texinfo (AArch64 Pointer Authentication)
(GDB/MI Breakpoint Information) (Frame Information): Document
addr_field.

5 years ago[ld] [arm] Add support for noinit section
Christophe Lyon [Fri, 16 Aug 2019 08:26:45 +0000 (08:26 +0000)]
[ld] [arm] Add support for noinit section

2019-08-16  Christophe Lyon  <christophe.lyon@linaro.org>

* emulparams/armelf.sh (OTHER_SECTIONS): Add support for noinit
section.

Change-Id: Ib293f28cc5f21e9e9a13abf4d4e37f0a0eec41c0

5 years agoPR24909, Uninitialized use on stack in readelf
Alan Modra [Fri, 16 Aug 2019 05:47:23 +0000 (15:17 +0930)]
PR24909, Uninitialized use on stack in readelf

PR 24909
PR 23499
* readelf.c (get_symbol_version_string): Set sym_info earlier.

5 years agoPowerPC gcc bootstrap fail with bss-plt
Alan Modra [Fri, 16 Aug 2019 03:50:28 +0000 (13:20 +0930)]
PowerPC gcc bootstrap fail with bss-plt

git commit 3e04d7655b introduced a bug by sizing output sections
earlier in ppc_before_allocation.  That meant PLT (and GOT) sizes were
not included when calculating total executable section sizes.

* emultempl/ppc32elf.em (ppc_before_allocation): Force running
prelim_size_sections before deciding whether branch trampolines
might be needed.

5 years agoAligned vs. unaligned ppc32 relocs
Alan Modra [Wed, 14 Aug 2019 07:01:05 +0000 (16:31 +0930)]
Aligned vs. unaligned ppc32 relocs

Given R_PPC_ADDR32 or R_PPC_UADDR32 relocs, this patch generates
R_PPC_ADDR32 or R_PPC_UADDR32 dynamic relocs from either type
depending on whether r_offset is 4-byte aligned, and similarly for
R_PPC_ADDR16/R_PPC_UADDR16.

* elf32-ppc.c (ppc_elf_relocate_section): Optimize unaligned relocs.

5 years agoFix paste-o in examine-backward.exp.
Sandra Loosemore [Fri, 16 Aug 2019 01:15:16 +0000 (18:15 -0700)]
Fix paste-o in examine-backward.exp.

This patch fixes a paste-o that was introduced in commit
c8ad9b9a31aa3e6039567fc1f152dd454c946d5f.  Previously the regexp for
the "examine 3 bytes backward from ${address_zero}" test correctly
matched 3 "${byte}" patterns, but in that commit the 6-byte regexp
from the previous test was mistakenly repeated here instead.

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

gdb/testsuite/
* gdb.base/examine-backward.exp: Correct regexp for
"examine 3 bytes backward from ${address_zero}".

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

5 years ago[gdb] Make maint info sections print relocated addresses
Tom de Vries [Thu, 15 Aug 2019 22:25:14 +0000 (00:25 +0200)]
[gdb] Make maint info sections print relocated addresses

When running gdb.base/compare-sections.exp with -fPIE/-pie, we get:
...
print /u *(unsigned char *) 0x00000238^M
Cannot access memory at address 0x238^M
(gdb) FAIL: gdb.base/compare-sections.exp: read-only: get value of read-only section
...

The problem is that that "maint info sections" prints an unrelocated address:
...
 [0]     0x00000238->0x00000254 at 0x00000238: .interp ALLOC LOAD READONLY \
                                                       DATA HAS_CONTENTS
...
while the test expects a relocated address.

Given that the documentation states that the command displays "the section
information displayed by info files", and that info files shows relocated
addresses:
...
        0x0000555555554238 - 0x0000555555554254 is .interp
...
fix this by showing relocated addresses for maint info sections as
well.

Build and tested on x86_64-linux.

gdb/ChangeLog:

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

* maint.c (maintenance_info_sections): Also handle !ALLOBJ case using
print_objfile_section_info.

5 years agoTUI resize unification
Tom Tromey [Tue, 9 Jul 2019 23:29:13 +0000 (17:29 -0600)]
TUI resize unification

The TUI currently has two different ways to resize a window: the
resize method, and the methods make_invisible_and_set_new_height and
make_visible_with_new_height.

There's no deep reason to have two different ways to resize a window,
so this patch unifies them, leaving just the "resize" method.

This also changes the locator to be handled more like an ordinary
window and less like an adjunct of the associated source window.

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

* tui/tui-io.c (tui_puts_internal): Check TUI_CMD_WIN before
calling update_cmdwin_start_line.
* tui/tui-winsource.h (struct tui_source_window_base)
<do_make_visible_with_new_height, set_new_height>: Don't declare.
<rerender>: Declare.
* tui/tui-winsource.c (tui_source_window_base::update_tab_width):
Call rerender.
(tui_source_window_base::set_new_height): Remove.
(tui_source_window_base::rerender): Rename from
do_make_visible_with_new_height.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use
resize method.
(tui_win_info::make_invisible_and_set_new_height)
(tui_win_info::make_visible_with_new_height): Remove.
* tui/tui-stack.h (struct tui_locator_window) <rerender>:
Declare.
* tui/tui-stack.c (tui_locator_window::rerender): New method.
* tui/tui-regs.h (struct tui_data_window) <set_new_height,
do_make_visible_with_new_height>: Don't declare.
<rerender>: Declare.
* tui/tui-regs.c (tui_data_window::rerender): Rename from
set_new_height.
(tui_data_window::do_make_visible_with_new_height): Remove.
* tui/tui-layout.c (show_source_disasm_command, show_data): Don't
call tui_show_locator_content.
(tui_gen_win_info::resize): Call rerender.
(show_source_or_disasm_and_command): Don't call
tui_show_locator_content.
* tui/tui-data.h (struct tui_gen_win_info) <rerender>: New
method.
(struct tui_win_info) <rerender>: Declare.
<set_new_height, make_invisible_and_set_new_height,
make_visible_with_new_height>: Don't declare.
* tui/tui-data.c (tui_win_list::rerender): New method.
* tui/tui-command.h (struct tui_cmd_window)
<do_make_visible_with_new_height>: Don't declare.
* tui/tui-command.c
(tui_cmd_window::do_make_visible_with_new_height): Remove.

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

* gdb.tui/empty.exp: Enable resizing tests.

5 years agoFix bug with character enumeration literal
Tom Tromey [Thu, 1 Aug 2019 17:41:32 +0000 (11:41 -0600)]
Fix bug with character enumeration literal

gnat encodes character enumeration literals using a few different
schemes.  The gnat compiler documented the "QU" and "QW" encodings,
but failed to document that a simpler encoding was used for certain
characters.

This patch updates gdb to handle this simple Q encoding.  Note that
wide character literals are still not handled.

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

* ada-exp.y (convert_char_literal): Handle "Q%c" encoding.
* ada-lang.c (ada_enum_name): Likewise.

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

* gdb.ada/char_enum.exp: Add regression tests.
* gdb.ada/char_enum/foo.adb (Char_Enum_Type): Use '_'
and '0'.
(Char, Gchar): Update.
* gdb.ada/char_enum/pck.ads (Global_Enum_Type): Use '+'.

5 years agoRename internal Python functions to start with an underscore
Christian Biesinger [Thu, 15 Aug 2019 16:29:04 +0000 (11:29 -0500)]
Rename internal Python functions to start with an underscore

I could not tell if GdbSetPythonDirectory is internal or not because
I could not find any references to it, so I left it as-is.

Tested by running the testsuite on gdb.python/*.exp; everything still
passes.

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

* python/lib/gdb/__init__.py (GdbOutputFile): Rename to have a
leading underscore.
(GdbOutputErrorFile): Likewise.
(global scope): Adjust constructor calls to GdbOutput{,Error}File
accordingly.
(execute_unwinders): Rename to have a leading underscore.
(auto_load_packages): Likewise.
(global scope): Adjust call to auto_load_packages accordingly.
(GdbSetPythonDirectory): Likewise.
* python/py-unwind.c (pyuw_sniffer): Call _execute_unwinders
instead of execute_unwinders.

gdb/testsuite/ChangeLog:

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

* gdb.python/python.exp: Expect a leading underscore on
GdbOutput{,Error}File.

5 years agoRISC-V: Fix lui relaxation issue with code at address 0.
Jim Wilson [Thu, 15 Aug 2019 19:01:13 +0000 (12:01 -0700)]
RISC-V: Fix lui relaxation issue with code at address 0.

This fixes a problem originally reported at
    https://github.com/riscv/riscv-binutils-gdb/issues/173

If you have code linked at address zero, you can have a lui instruction
loading a value 0x800 which gets relaxed to a c.lui which is valid (c.lui 0x1
followed by addi -0x800).  Relaxation can reduce the value below 0x800 at which
point the c.lui 0x0 is no longer valid.  We can fix this by converting the
c.lui to a c.li which can load 0.

bfd/
* elfnn-riscv.c (perform_relocation) <R_RISCV_RVC_LUI>: If
RISCV_CONST_HIGH_PART (value) is zero, then convert c.lui instruction
to c.li instruction, and use ENCODE_RVC_IMM to set value.

ld/
* testsuite/ld-riscv-elf/c-lui-2.d: New.
* testsuite/ld-riscv-elf/c-lui-2.ld: New.
* testsuite/ld-riscv-elf/c-lui-2.s: New.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run the c-lui-2 test.

5 years agoTUI window resize should not need invisibility
Tom Tromey [Tue, 9 Jul 2019 21:35:17 +0000 (15:35 -0600)]
TUI window resize should not need invisibility

When resizing a window, the TUI currently first makes it invisible,
then changes the size, and then restores its visibility.

I think this is done because curses doesn't truly support resizing a
window -- there is a "wresize" extension, but the man page says it
isn't available in all versions of curses.

First, this is probably not a major problem any more.  I imagine most
of those old systems are gone now.

Second, I think it's a better API to have this detail hidden inside of
the resize method.

This patch changes the code to follow this idea, and changes the
ordinary resize method to use wresize when it is available.  The
special case for the command window is also moved to methods on the
command window.

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

* tui/tui-layout.c (show_layout, show_source_disasm_command)
(show_data): Don't change window visibility.
(tui_gen_win_info::resize): Remove special case for command
window.  Use wresize, when available.
(show_source_or_disasm_and_command): Don't change window
visibility.
* tui/tui-command.h (struct tui_cmd_window) <resize>: Declare.
<make_visible>: New method.
* tui/tui-command.c (tui_cmd_window::resize): New method.

5 years agoChange TUI source window iteration
Tom Tromey [Sun, 7 Jul 2019 03:19:45 +0000 (21:19 -0600)]
Change TUI source window iteration

Currently the TUI does separate bookkeeping to track which source
windows exist.  It seems better to me to just refer to the list of
windows for this, so this patch removes the special handling and
instead adds a new iterator.

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

* tui/tui-winsource.h (struct tui_source_window_iterator): New.
(struct tui_source_windows): New.
* tui/tui-winsource.c (tui_display_main): Update.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
(new_height_ok, parse_scrolling_args): Update.
* tui/tui-layout.c (show_layout, show_data): Update.
* tui/tui-data.h (tui_source_windows, tui_clear_source_windows)
(tui_add_to_source_windows): Don't declare.
* tui/tui-data.c (source_windows, tui_source_windows)
(tui_clear_source_windows, tui_add_to_source_windows): Remove.

5 years agoRename the "reset" method to "resize"
Tom Tromey [Sat, 6 Jul 2019 23:32:45 +0000 (17:32 -0600)]
Rename the "reset" method to "resize"

tui_gen_win_info::reset really just resizes the window.  This patch
renames it to reflect this.

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

* tui/tui-winsource.h (struct tui_source_window_base) <resize>:
Rename from reset.
* tui/tui-winsource.c (tui_source_window_base::resize): Rename.
* tui/tui-layout.c (show_source_disasm_command, show_data):
Update.
(tui_gen_win_info::resize): Rename.
(show_source_or_disasm_and_command): Update.
* tui/tui-data.h (struct tui_gen_win_info) <resize>: Rename from
reset.

5 years agoRemove tui_initialize_static_data
Tom Tromey [Sat, 6 Jul 2019 23:30:02 +0000 (17:30 -0600)]
Remove tui_initialize_static_data

tui_initialize_static_data is not needed, because locator moving and
resizing is already handled in the layout code.

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

* tui/tui-stack.c (tui_initialize_static_data): Remove.
* tui/tui-interp.c (tui_interp::init): Don't call
tui_initialize_static_data.
* tui/tui-data.h (tui_initialize_static_data): Don't declare.

5 years agoMinor simplification in tui_default_win_viewport_height
Tom Tromey [Sat, 6 Jul 2019 22:28:46 +0000 (16:28 -0600)]
Minor simplification in tui_default_win_viewport_height

tui_default_win_viewport_height doesn't need to look at tui_win_list;
it can simply check the type directly.

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

* tui/tui-layout.c (tui_default_win_viewport_height): Don't
examine tui_win_list.

5 years agoRemove tui_clear_source_content
Tom Tromey [Sat, 6 Jul 2019 22:17:46 +0000 (16:17 -0600)]
Remove tui_clear_source_content

tui_clear_source_content is not needed.  Instead, the callers can call
erase_source_content, which is also changed to clear the content
vector.

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

* tui/tui-winsource.h (tui_clear_source_content): Don't declare.
* tui/tui-winsource.c (tui_update_source_window_as_is): Don't call
tui_clear_source_content.
(tui_clear_source_content): Remove.
(tui_source_window_base::do_erase_source_content): Hoist call to
content.clear().
* tui/tui-stack.c (tui_show_frame_info): Don't call
tui_clear_source_content.

5 years agoTurn tui_erase_source_content into a method
Tom Tromey [Sat, 6 Jul 2019 21:57:53 +0000 (15:57 -0600)]
Turn tui_erase_source_content into a method

This changes tui_erase_source_content into a method on
tui_source_window_base.  The bulk of the work is moved into a helper
method, so that the callers can each pass the string appropriate to
the particular window class.

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

* tui/tui-winsource.h (struct tui_source_window_base)
<do_erase_source_content>: New method.
<erase_source_content>: New method.
(tui_erase_source_content): Don't declare.
* tui/tui-winsource.c (tui_clear_source_content): Update.
(tui_source_window_base::do_erase_source_content): Rename from
tui_erase_source_content.
(tui_source_window_base::show_source_content): Update.
* tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update.
* tui/tui-source.h (struct tui_source_window)
<erase_source_content>: New method.
* tui/tui-disasm.h (struct tui_disasm_window)
<erase_source_content>: New method.

5 years agoRemove tui_alloc_source_buffer
Tom Tromey [Sat, 6 Jul 2019 21:52:13 +0000 (15:52 -0600)]
Remove tui_alloc_source_buffer

There is no longer any need for tui_alloc_source_buffer.  The two
callers of this function immediately change the contents of the
window, undoing the work done by this function.

This required adding a move constructor to tui_source_element -- a
mildly surprising find, but without this, resizing the vector will
cause crashes.  This issue was masked earlier because
tui_alloc_source_buffer handled this.

Note that a patch for this bug was submitted here:

    https://sourceware.org/ml/gdb-patches/2019-08/msg00094.html

That patch is better, IMO, but the author as yet hasn't responded to a
request for a ChangeLog entry.

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

* tui/tui-winsource.h (tui_alloc_source_buffer): Don't declare.
(struct tui_source_element): Add DISABLE_COPY_AND_ASSIGN, and move
constructor.
* tui/tui-winsource.c (tui_alloc_source_buffer): Remove.
* tui/tui-source.c (tui_set_source_content): Update.
* tui/tui-disasm.c (tui_set_disassem_content): Update.

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.