deliverable/binutils-gdb.git
5 years agox86: Optimize EVEX vector load/store instructions
H.J. Lu [Mon, 18 Mar 2019 00:56:10 +0000 (08:56 +0800)] 
x86: Optimize EVEX vector load/store instructions

When there is no write mask, we can encode lower 16 128-bit/256-bit
EVEX vector register load and store instructions as VEX vector register
load and store instructions with -O1.

gas/

PR gas/24348
* config/tc-i386.c (optimize_encoding): Encode 128-bit and
256-bit EVEX vector register load/store instructions as VEX
vector register load/store instructions for -O1.
* doc/c-i386.texi: Update -O1 documentation.
* testsuite/gas/i386/i386.exp: Run PR gas/24348 tests.
* testsuite/gas/i386/optimize-1.s: Add tests for EVEX vector
load/store instructions.
* testsuite/gas/i386/optimize-2.s: Likewise.
* testsuite/gas/i386/optimize-3.s: Likewise.
* testsuite/gas/i386/optimize-5.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-3.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-4.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-5.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-6.s: Likewise.
* testsuite/gas/i386/optimize-1.d: Updated.
* testsuite/gas/i386/optimize-2.d: Likewise.
* testsuite/gas/i386/optimize-3.d: Likewise.
* testsuite/gas/i386/optimize-4.d: Likewise.
* testsuite/gas/i386/optimize-5.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-3.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-4.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-5.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-6.d: Likewise.
* testsuite/gas/i386/optimize-7.d: New file.
* testsuite/gas/i386/optimize-7.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-8.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-8.s: Likewise.

opcodes/

PR gas/24348
* i386-opc.tbl: Add Optimize to vmovdqa32, vmovdqa64, vmovdqu8,
vmovdqu16, vmovdqu32 and vmovdqu64.
* i386-tbl.h: Regenerated.

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 18 Mar 2019 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agox86: Encode 256-bit/512-bit VEX/EVEX insns with 128-bit VEX
H.J. Lu [Sun, 17 Mar 2019 19:50:45 +0000 (03:50 +0800)] 
x86: Encode 256-bit/512-bit VEX/EVEX insns with 128-bit VEX

Since all AVX512 processors support AVX, we can encode 256-bit/512-bit
VEX/EVEX vector register clearing instructions with 128-bit VEX vector
register clearing instructions at -O1.

* config/tc-i386.c (optimize_encoding): Encode 256-bit/512-bit
VEX/EVEX vector register clearing instructions with 128-bit VEX
vector register clearing instructions at -O1.
* doc/c-i386.texi: Update -O1 and -O2 documentation.
* testsuite/gas/i386/i386.exp: Run optimize-1a and
x86-64-optimize-2a.
* testsuite/gas/i386/optimize-1a.d: New file.
* testsuite/gas/i386/x86-64-optimize-2a.d: Likewise.

5 years agoRemove unused variable from windows_make_so
Владимир Мартьянов [Sun, 17 Mar 2019 09:51:01 +0000 (12:51 +0300)] 
Remove unused variable from windows_make_so

There is unused variable text_vma in function windows_make_so. This
leads to build error on Windows using Cygwin.

gdb/ChangeLog:
2019-03-17  Vladimir Martyanov  <vilgeforce@gmail.com>

    PR gdb/24350
    * windows-nat.c (windows_make_so): Remove unused text_vma variable.

5 years agoFix wrong format specification in display_selector()
Владимир Мартьянов [Sun, 17 Mar 2019 09:48:24 +0000 (12:48 +0300)] 
Fix wrong format specification in display_selector()

There are a wrong format strings in function display_selector() in
file windows-nat.c. This leads to build error using Cygwin on Windows.
LDT_ENTRY.HighWord is a DWORD, which is unsigned long int, so the
format specification should be for long int, not simply int.

gdb/ChangeLog:
2019-03-17  Vladimir Martyanov  <vilgeforce@gmail.com>

    PR gdb/24351
    * windows-nat.c (display_selector): Format specifications fixed

5 years agoFix redisplay of the current line in GDB TUI mode
Eli Zaretskii [Sun, 17 Mar 2019 16:00:34 +0000 (18:00 +0200)] 
Fix redisplay of the current line in GDB TUI mode

Without this change, when the current line is longer than the source
window width, redisplaying that line overwrites the window frame and
also portions of the next line.

gdb/ChangeLog:
2019-03-17  Eli Zaretskii  <eliz@gnu.org>

* tui/tui-winsource.c (tui_set_is_exec_point_at): Call
tui_refill_source_window instead of tui_refresh_win, to update the
current execution line.  This fixes redisplay of the current line
when stepping through very long lines with "next" or "step".

5 years agoAutomatic date update in version.in
GDB Administrator [Sun, 17 Mar 2019 00:01:10 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agox86: Set optimize to INT_MAX for -Os
H.J. Lu [Sat, 16 Mar 2019 23:39:18 +0000 (07:39 +0800)] 
x86: Set optimize to INT_MAX for -Os

Set optimize to INT_MAX, instead of -1, for -Os so that -Os will include
-O2 optimization.

PR gas/24353
* config/tc-i386.c (md_parse_option): Set optimize to INT_MAX
for -Os.
* testsuite/gas/i386/optimize-2.s: Add a test.
* testsuite/gas/i386/x86-64-optimize-3.s: Likewise.
* testsuite/gas/i386/optimize-2.d: Updated.
* testsuite/gas/i386/x86-64-optimize-3.d: Likewise.

5 years agox86: Correctly optimize EVEX to 128-bit VEX/EVEX
H.J. Lu [Sat, 16 Mar 2019 23:25:08 +0000 (07:25 +0800)] 
x86: Correctly optimize EVEX to 128-bit VEX/EVEX

We can optimize 512-bit EVEX to 128-bit EVEX encoding for upper 16
vector registers only when AVX512VL is enabled.  We can't optimize
EVEX to 128-bit VEX encoding when AVX isn't enabled.

PR gas/24352
* config/tc-i386.c (optimize_encoding): Encode 512-bit EVEX
with 128-bit VEX encoding only when AVX is enabled and with
128-bit EVEX encoding only when AVX512VL is enabled.
* testsuite/gas/i386/i386.exp: Run PR gas/24352 tests.
* testsuite/gas/i386/optimize-6.s: New file.
* testsuite/gas/i386/optimize-6a.d: Likewise.
* testsuite/gas/i386/optimize-6b.d: Likewise.
* testsuite/gas/i386/optimize-6c.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-7.s: Likewise.
* testsuite/gas/i386/x86-64-optimize-7a.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-7b.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-7c.d: Likewise.
* testsuite/gas/i386/x86-64-optimize-2.d: Updated.

5 years agoFix vertical scrolling of TUI source window
Eli Zaretskii [Sat, 16 Mar 2019 17:53:46 +0000 (19:53 +0200)] 
Fix vertical scrolling of TUI source window

gdb/ChangeLog:
2019-03-16  Eli Zaretskii  <eliz@gnu.org>

* source-cache.c (source_cache::get_source_lines): Call
find_source_lines to initialize s->nlines.  This fixes vertical
scrolling of TUI source window when the DOWN arrow is pressed.

5 years agoOBVIOUS: fix several occurrences of 'This options has' to 'This option has'
Philippe Waroquiers [Sat, 16 Mar 2019 15:56:44 +0000 (16:56 +0100)] 
OBVIOUS: fix several occurrences of 'This options has' to 'This option has'

5 years agoRevert "Use wclrtoeol in tui_show_source_line"
Eli Zaretskii [Sat, 16 Mar 2019 12:13:43 +0000 (14:13 +0200)] 
Revert "Use wclrtoeol in tui_show_source_line"

gdb/ChangeLog:
2019-03-16  Eli Zaretskii  <eliz@gnu.org>

* tui/tui-winsource.c (tui_show_source_line): Revert "Use
wclrtoeol in tui_show_source_line".  This reverts changes made in
commit 4a3045920bbe4e50a0f4920b0fdc4e88ef23015c.

5 years agoPR24337, segfault in _bfd_elf_rela_local_sym, again
Alan Modra [Fri, 15 Mar 2019 23:04:47 +0000 (09:34 +1030)] 
PR24337, segfault in _bfd_elf_rela_local_sym, again

Reverts commit 1ff31e135f, fixing the problem more generally.  There
are likely other place that will segfault on a NULL section.

PR 24337
* elf.c (_bfd_elf_rela_local_sym): Revert last change.
(_bfd_elf_rel_local_sym): Likewise.
* elflink.c (elf_link_input_bfd): Use bfd_und_section for
section of symbols with unrecognized shndx.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 16 Mar 2019 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoChange minimal_symbol inheritance
Tom Tromey [Sat, 2 Mar 2019 20:07:47 +0000 (13:07 -0700)] 
Change minimal_symbol inheritance

This changes struct minimal_symbol to inherit from general_symbol_info
and updates various macros to cope.

Because MSYMBOL_SET_LANGUAGE and MSYMBOL_SET_NAMES were only used from
a single spot, this patch removes them in favor of simply inlining
their definitions.  I consider this to be somewhat cleaner, not least
because the "phony polymorphism" provided by such macros is not useful
in practice.

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

* symtab.h (struct minimal_symbol): Derive from
general_symbol_info.
(MSYMBOL_VALUE, MSYMBOL_VALUE_RAW_ADDRESS)
(MSYMBOL_VALUE_ADDRESS, MSYMBOL_VALUE_BYTES)
(MSYMBOL_BLOCK_VALUE, MSYMBOL_VALUE_CHAIN, MSYMBOL_LANGUAGE)
(MSYMBOL_SECTION, MSYMBOL_OBJ_SECTION, MSYMBOL_NATURAL_NAME)
(MSYMBOL_LINKAGE_NAME, MSYMBOL_DEMANGLED_NAME)
(MSYMBOL_SEARCH_NAME): Update.
(MSYMBOL_SET_LANGUAGE, MSYMBOL_SET_NAMES): Remove.
* solib.c (gdb_bfd_lookup_symbol_from_symtab): Don't use memset.
* minsyms.c (minimal_symbol_reader::record_full): Update.

5 years agoUse memcpy in minimal_symbol_reader::install
Tom Tromey [Sat, 2 Mar 2019 19:31:04 +0000 (12:31 -0700)] 
Use memcpy in minimal_symbol_reader::install

minimal_symbol_reader::install copies minsyms from the msym_bunch
objects into the allocated memory.  It seemed better to me to do this
via memcpy, as that is frequently optimized in libc.

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

* minsyms.c (minimal_symbol_reader::install): Use memcpy.

5 years agoAllocate minimal symbols with malloc
Tom Tromey [Sat, 2 Mar 2019 19:29:48 +0000 (12:29 -0700)] 
Allocate minimal symbols with malloc

Currently, minimal symbols are allocated on the per-BFD obstack.
However, it is also possible for multiple symbol readers to create
minimal symbols for a given objfile.  In this case, the minimal
symbols will be reallocated on the obstack, leading to some waste of
storage.

This is a memory leak, but I think it won't be caught by tools like
valgrind, because valgrind doesn't know about obstacks.

This patch fixes the problem by using malloc to allocate the storage
for minimal symbols.

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

* objfiles.h (struct objfile_per_bfd_storage) <msymbols>: Now a
unique_xmalloc_ptr.
(objfile::msymbols_range::begin, objfile::msymbols_range::end):
Update.
* minsyms.c (lookup_minimal_symbol_by_pc_section)
(build_minimal_symbol_hash_tables)
(minimal_symbol_reader::install): Update.

5 years agoUse htab_up for demangled hash
Tom Tromey [Sat, 2 Mar 2019 19:18:05 +0000 (12:18 -0700)] 
Use htab_up for demangled hash

This changes objfile_per_bfd_storage::demangled_names_hash to be an
htab_up.  This lets us remove some manual management code from the
objfile_per_bfd_storage destructor.

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

* symtab.c (create_demangled_names_hash): Update.
(symbol_set_names): Update.
* objfiles.h (struct objfile_per_bfd_storage)
<demangled_names_hash>: Now an htab_up.
* objfiles.c (objfile_per_bfd_storage): Simplify.

5 years agoSimplify per-BFD storage management
Tom Tromey [Sat, 2 Mar 2019 19:11:26 +0000 (12:11 -0700)] 
Simplify per-BFD storage management

There's no reason that the objfile_per_bfd_storage must be allocated
via bfd_alloc.  This patch changes objfile_per_bfd_storage to be
managed more simply, via ordinary new and delete; and moves some code
into its (new) destructor.

While doing this I also noticed an extra initialization of
language_of_main, and removed it.

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

* objfiles.h (struct objfile_per_bfd_storage): Declare
destructor.
* objfiles.c (objfile_per_bfd_storage::~objfile_per_bfd_storage):
New.
(get_objfile_bfd_data): Use new.  Don't initialize
language_of_main.
(free_objfile_per_bfd_storage): Remove.
(objfile_bfd_data_free, objfile::~objfile): Use delete.

5 years agoRemove minsym termination
Tom Tromey [Sat, 2 Mar 2019 19:05:57 +0000 (12:05 -0700)] 
Remove minsym termination

I was curious what used the terminating "null" minimal symbol; and
after looking I could not find anything.  This patch removes
terminate_minimal_symbol_table and the extra minimal symbol that is
allocated for it.

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

* symfile.c (reread_symbols): Update.
* objfiles.c (objfile::objfile): Update.
* minsyms.h (terminate_minimal_symbol_table): Don't declare.
* minsyms.c (lookup_minimal_symbol_by_pc_section): Update
comment.
(minimal_symbol_reader::install): Update.
(terminate_minimal_symbol_table): Remove.
* jit.c (jit_object_close_impl): Update.

5 years agoRemove some unneeded initializations in minimal_symbol_reader
Tom Tromey [Sat, 2 Mar 2019 02:56:45 +0000 (19:56 -0700)] 
Remove some unneeded initializations in minimal_symbol_reader

minimal_symbol_reader::record_full does not need to initialize any
minsym fields to 0, because that was already done implicitly via the
use of XCNEW when allocating the msym_bunch.

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

* minsyms.c (minimal_symbol_reader::record_full): Remove some
initializations.

5 years agoUse bitset for demangled_hash_languages
Tom Tromey [Sat, 2 Mar 2019 02:55:46 +0000 (19:55 -0700)] 
Use bitset for demangled_hash_languages

I noticed that objfile_per_bfd_storage::demangled_hash_languages is a
std::vector, which seemed quite large for something that,
fundamentally, can be represented as a bitset.  This patch
reimplements it as a std::bitset.

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

* objfiles.h (struct objfile_per_bfd_storage)
<demangled_hash_languages>: Now a bitset.
* minsyms.c (add_minsym_to_demangled_hash_table): Update.
(lookup_minimal_symbol): Update.

5 years agoSlightly simplify minsym creation
Tom Tromey [Sat, 2 Mar 2019 00:37:30 +0000 (17:37 -0700)] 
Slightly simplify minsym creation

Only one caller of minimal_symbol_reader::record_with_info was using
the return value, so this patch simplifies this code by having it
return void and changing that caller to use record_full instead.

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

* minsyms.h (class minimal_symbol_reader) <record_with_info>:
Don't return the symbol.
* coffread.c (record_minimal_symbol): Use record_full.

5 years agoCOFF: Check for symbols defined in discarded section
H.J. Lu [Fri, 15 Mar 2019 14:19:01 +0000 (22:19 +0800)] 
COFF: Check for symbols defined in discarded section

For LTO, a symbol may defined in discarded section.  We should mark it
as undefined so that LTO plugin will make IR definition available.

PR ld/24267
* coffgen.c (_bfd_coff_section_already_linked): Skip discarded
section.
* cofflink.c (coff_link_add_symbols): Check for symbols defined
in discarded section.

5 years agoUpdate the documentation describing where the linker will attempt to locate plugins.
Nick Clifton [Fri, 15 Mar 2019 12:08:56 +0000 (12:08 +0000)] 
Update the documentation describing where the linker will attempt to locate plugins.

PR 24262
* ld.texi (-plugin): Correct the path used to locate linker
plugins.

5 years agoFix a potential illegal memory access whilt parsing an x86 insn.
Li Hao [Fri, 15 Mar 2019 11:58:05 +0000 (11:58 +0000)] 
Fix a potential illegal memory access whilt parsing an x86 insn.

PR 24308
* config/tc-i386.c (parse_insn): Check mnemp before using it to
determine if a suffix can be trimmed.

5 years agoPR24339, segfault on NULL symbol section
Alan Modra [Fri, 15 Mar 2019 06:19:59 +0000 (16:49 +1030)] 
PR24339, segfault on NULL symbol section

PR 24339
* elflink.c (elf_link_add_object_symbols): Bail out on a local
symbol after globals if elf_bad_symtab is not set.

5 years agoPR24337, segfault in _bfd_elf_rela_local_sym
Alan Modra [Fri, 15 Mar 2019 06:19:42 +0000 (16:49 +1030)] 
PR24337, segfault in _bfd_elf_rela_local_sym

PR 24337
* elf.c (_bfd_elf_rela_local_sym): Don't segfault on NULL sec.
(_bfd_elf_rel_local_sym): Likewise.

5 years agoPR24336, buffer overflow in swap_reloca_in
Alan Modra [Fri, 15 Mar 2019 05:19:27 +0000 (15:49 +1030)] 
PR24336, buffer overflow in swap_reloca_in

PR 24336
* elflink.c (elf_link_read_relocs_from_section): Handle fuzzed
object files with sh_size not a multiple of sh_entsize.

5 years agox86-64: Check for corrupt input with bad relocation
H.J. Lu [Fri, 15 Mar 2019 07:46:12 +0000 (15:46 +0800)] 
x86-64: Check for corrupt input with bad relocation

PR ld/24338
* elf64-x86-64.c (elf_x86_64_relocate_section): Check for corrupt
input with bad relocation.

5 years agoRe-indent elf_x86_64_relocate_section
H.J. Lu [Fri, 15 Mar 2019 06:43:36 +0000 (14:43 +0800)] 
Re-indent elf_x86_64_relocate_section

* elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.

5 years agoAutomatic date update in version.in
GDB Administrator [Fri, 15 Mar 2019 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoFix gdb.texinfo build
Simon Marchi [Thu, 14 Mar 2019 19:04:10 +0000 (15:04 -0400)] 
Fix gdb.texinfo build

Commit b4be1b064860 ("Fix MI output for multi-location breakpoints")
broke the build of gdb.texinfo.  The problem is simply the use of "@end
@table", which should be "@end table".

The error was:

    /home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27870: warning: @table should not appear in @end
    /home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27870: table requires an argument: the formatter for @item
    /home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27870: no matching `@end table'
    /home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27870: bad argument to @end: @table
    /home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27867: warning: @table has text but no @item
    /home/smarchi/src/binutils-gdb/gdb/doc/gdb.texinfo:27879: @node seen before @end table

gdb/doc/ChangeLog:

* gdb.texinfo (GDB/MI Development and Front Ends): Fix closing
of table, "@end @table" -> "@end table".

5 years agoFix a buffer overrun error when attempting to parse corrupt DWARF information.
Nick Clifton [Thu, 14 Mar 2019 17:21:41 +0000 (17:21 +0000)] 
Fix a buffer overrun error when attempting to parse corrupt DWARF information.

PR 24334
* dwarf2.c (struct dwarf2_debug): Add sec_vma_count field.
(save_section_vma): Initialise field to the number of entries in
the sec_vma table.
(section_vma_same): Check that the number of entries in the
sec_vma table matches the number of sections in the bfd.

5 years agoFix an illegal memory access when parsing a corrupt ELF file.
Nick Clifton [Thu, 14 Mar 2019 16:03:07 +0000 (16:03 +0000)] 
Fix an illegal memory access when parsing a corrupt ELF file.

PR 24333
* elflink.c (_bfd_elf_add_default_symbol): Add a check for a NULL
section owner pointer when adding the default symbol.

5 years agoFix colors in TUI mode in MS-Windows build with ncurses
Eli Zaretskii [Thu, 14 Mar 2019 15:31:38 +0000 (17:31 +0200)] 
Fix colors in TUI mode in MS-Windows build with ncurses

The MS-Windows port of ncurses fails to switch to a color pair if
one or both of the colors are the implicit default colors.  This
change records the default colors when TUI is initialized, and
then specifies them explicitly when a color pair uses the default
colors.  This allows color styling in TUI mode on MS-Windows.

gdb/ChangeLog:
2019-03-14  Eli Zaretskii  <eliz@gnu.org>

* tui/tui-io.c [__MINGW32__]: Include windows.h.  Declare
ncurses_norm_attr.
(tui_initialize_io) [__MINGW32__]: Record the default terminal
colors in ncurses_norm_attr.
(apply_ansi_escape) [__MINGW32__]: If a color in a color pair is
"none", replace it with the default color recorded in
ncurses_norm_attr.

5 years agoFix illegal memory access parsing a corrupt ELF file.
Nick Clifton [Thu, 14 Mar 2019 14:45:32 +0000 (14:45 +0000)] 
Fix illegal memory access parsing a corrupt ELF file.

PR 24332
* elflink.c (elf_link_add_object_symbols): Add new local variable
extversym_end.  Initialise it to point to the end of the version
symbol table, if present.  Check it when initialising and updating
the ever pointer.

5 years agoAvoid a crash in source_cache::extract_lines
Tom Tromey [Fri, 8 Mar 2019 20:59:27 +0000 (13:59 -0700)] 
Avoid a crash in source_cache::extract_lines

If the first requested line is larger than the number of lines in the
source buffer, source_cache::extract_lines could crash, because it
would try to pass string::npos" to string::substr.

This patch avoids the crash by checking for this case.

This version of the patch changes get_source_lines to return
std::string.

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

* source-cache.h (class source_cache) <get_source_lines>: Return
std::string.
* source-cache.c (source_cache::extract_lines): Handle case where
first_pos==npos.  Return std::string.
(source_cache::get_source_lines): Update.

5 years agoAdd the "set style source" command
Tom Tromey [Fri, 8 Mar 2019 20:54:07 +0000 (13:54 -0700)] 
Add the "set style source" command

This adds "set style source" (and "show style source") commands.  This
gives the user control over whether source code is highlighted.

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

* NEWS: Add item for "style sources" commands.
* source-cache.c (source_cache::get_source_lines): Check
source_styling.
* cli/cli-style.c (source_styling): New global.
(_initialize_cli_style): Add "style sources" commands.
(show_style_sources): New function.
* cli/cli-style.h (source_styling): Declare.

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

* gdb.texinfo (Output Styling): Document "set style source" and
"show style source".

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

* gdb.base/style.exp: Add "set style sources" test.

5 years agoMake TUI react to "set style enabled"
Tom Tromey [Fri, 8 Mar 2019 20:41:55 +0000 (13:41 -0700)] 
Make TUI react to "set style enabled"

When the user toggles "set style enabled", the TUI should react by
redrawing the source window, if necessary.  This patch implements this
behavior.

No test because the TUI is generally not tested.

This version of the patch incorporates Pedro's patch to provide a
clean way to force the TUI to update the source window's contents.

gdb/ChangeLog
2019-03-14  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tromey@adacore.com>

* tui/tui-winsource.h (tui_refill_source_window): Declare.
* tui/tui-winsource.c (tui_refill_source_window): New function,
from...
(tui_horizontal_source_scroll): ... here.  Move some logic.
* cli/cli-style.c (set_style_enabled): Notify new observable.
* tui/tui-hooks.c (tui_redisplay_source): New function.
(tui_attach_detach_observers): Attach or detach
tui_redisplay_source.
* observable.h (source_styling_changed): New observable.
* observable.c: Define source_styling_changed observable.

5 years agoAutomatic date update in version.in
GDB Administrator [Thu, 14 Mar 2019 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoChange pid_to_str to return std::string
Tom Tromey [Thu, 28 Feb 2019 16:09:55 +0000 (09:09 -0700)] 
Change pid_to_str to return std::string

Currently the target pid_to_str method returns a const char *, so many
implementations have a static buffer that they update.  This patch
changes these methods to return a std::string instead.  I think this
is cleaner and avoids possible gotchas when calling pid_to_str on
different ptids in a single statement.  (Though no such calls exist
currently.)

This also updates various helper functions, and the gdbarch pid_to_str
methods.

I also made a best effort to fix all the callers, but I can't build
some of the *-nat.c files.

Tested by the buildbot.

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

* i386-gnu-nat.c (i386_gnu_nat_target::fetch_registers)
(i386_gnu_nat_target::store_registers): Update.
* target-debug.h (target_debug_print_std_string): New macro.
* x86-linux-nat.c (x86_linux_nat_target::enable_btrace): Update.
* windows-tdep.c (display_one_tib): Update.
* tui/tui-stack.c (tui_make_status_line): Update.
* top.c (print_inferior_quit_action): Update.
* thread.c (thr_try_catch_cmd): Update.
(add_thread_with_info): Update.
(thread_target_id_str): Update.
(thr_try_catch_cmd): Update.
(thread_command): Update.
(thread_find_command): Update.
* record-btrace.c (record_btrace_target::info_record)
(record_btrace_resume_thread, record_btrace_target::resume)
(record_btrace_cancel_resume, record_btrace_step_thread)
(record_btrace_target::wait, record_btrace_target::wait)
(record_btrace_target::wait, record_btrace_target::stop): Update.
* progspace.c (print_program_space): Update.
* process-stratum-target.c
(process_stratum_target::thread_address_space): Update.
* linux-fork.c (linux_fork_mourn_inferior)
(detach_checkpoint_command, info_checkpoints_command)
(linux_fork_context): Update.
(linux_fork_detach): Update.
(class scoped_switch_fork_info): Update.
(delete_checkpoint_command): Update.
* infrun.c (follow_fork_inferior): Update.
(follow_fork_inferior): Update.
(proceed_after_vfork_done): Update.
(handle_vfork_child_exec_or_exit): Update.
(follow_exec): Update.
(displaced_step_prepare_throw): Update.
(displaced_step_restore): Update.
(start_step_over): Update.
(resume_1): Update.
(clear_proceed_status_thread): Update.
(proceed): Update.
(print_target_wait_results): Update.
(do_target_wait): Update.
(context_switch): Update.
(stop_all_threads): Update.
(restart_threads): Update.
(finish_step_over): Update.
(handle_signal_stop): Update.
(switch_back_to_stepped_thread): Update.
(keep_going_pass_signal): Update.
(print_exited_reason): Update.
(normal_stop): Update.
* inferior.c (inferior_pid_to_str): Change return type.
(print_selected_inferior): Update.
(add_inferior): Update.
(detach_inferior): Update.
* dummy-frame.c (fprint_dummy_frames): Update.
* dcache.c (dcache_info_1): Update.
* btrace.c (btrace_enable, btrace_disable, btrace_teardown)
(btrace_fetch, btrace_clear): Update.
* linux-tdep.c (linux_core_pid_to_str): Change return type.
* i386-cygwin-tdep.c (i386_windows_core_pid_to_str): Change return
type.
* fbsd-tdep.c (fbsd_core_pid_to_str): Change return type.
* sol2-tdep.h (sol2_core_pid_to_str): Change return type.
* sol2-tdep.c (sol2_core_pid_to_str): Change return type.
* gdbarch.c, gdbarch.h: Rebuild.
* gdbarch.sh (core_pid_to_str): Change return type.
* windows-nat.c (struct windows_nat_target) <pid_to_str>: Change
return type.
(windows_nat_target::pid_to_str): Change return type.
(windows_delete_thread): Update.
(windows_nat_target::attach): Update.
(windows_nat_target::files_info): Update.
* target-delegates.c: Rebuild.
* sol-thread.c (class sol_thread_target) <pid_to_str>: Change
return type.
(sol_thread_target::pid_to_str): Change return type.
* remote.c (class remote_target) <pid_to_str>: Change return
type.
(remote_target::pid_to_str): Change return type.
(extended_remote_target::attach, remote_target::remote_stop_ns)
(remote_target::remote_notif_remove_queued_reply)
(remote_target::push_stop_reply, remote_target::disable_btrace):
Update.
(extended_remote_target::attach): Update.
* remote-sim.c (struct gdbsim_target) <pid_to_str>: Change return
type.
(gdbsim_target::pid_to_str): Change return type.
* ravenscar-thread.c (struct ravenscar_thread_target)
<pid_to_str>: Change return type.
(ravenscar_thread_target::pid_to_str): Change return type.
* procfs.c (class procfs_target) <pid_to_str>: Change return
type.
(procfs_target::pid_to_str): Change return type.
(procfs_target::attach): Update.
(procfs_target::detach): Update.
(procfs_target::fetch_registers): Update.
(procfs_target::store_registers): Update.
(procfs_target::wait): Update.
(procfs_target::files_info): Update.
* obsd-nat.c (obsd_nat_target::pid_to_str): Change return type.
* nto-procfs.c (struct nto_procfs_target) <pid_to_str>: Change
return type.
(nto_procfs_target::pid_to_str): Change return type.
(nto_procfs_target::files_info, nto_procfs_target::attach): Update.
* linux-thread-db.c (class thread_db_target) <pid_to_str>: Change
return type.
* linux-nat.c (linux_nat_target::pid_to_str): Change return type.
(exit_lwp): Update.
(attach_proc_task_lwp_callback, get_detach_signal)
(detach_one_lwp, resume_lwp, linux_nat_target::resume)
(linux_nat_target::resume, wait_lwp, stop_callback)
(maybe_clear_ignore_sigint, stop_wait_callback, status_callback)
(save_stop_reason, select_event_lwp, linux_nat_filter_event)
(linux_nat_wait_1, resume_stopped_resumed_lwps)
(linux_nat_target::wait, linux_nat_stop_lwp): Update.
* inf-ptrace.c (inf_ptrace_target::pid_to_str): Change return
type.
(inf_ptrace_target::attach): Update.
(inf_ptrace_target::files_info): Update.
* go32-nat.c (struct go32_nat_target) <pid_to_str>: Change return
type.
(go32_nat_target::pid_to_str): Change return type.
* gnu-nat.c (gnu_nat_target::pid_to_str): Change return type.
(gnu_nat_target::wait): Update.
(gnu_nat_target::wait): Update.
(gnu_nat_target::resume): Update.
* fbsd-nat.c (fbsd_nat_target::pid_to_str): Change return type.
(fbsd_nat_target::wait): Update.
* darwin-nat.c (darwin_nat_target::pid_to_str): Change return
type.
(darwin_nat_target::attach): Update.
* corelow.c (class core_target) <pid_to_str>: Change return type.
(core_target::pid_to_str): Change return type.
* target.c (normal_pid_to_str): Change return type.
(default_pid_to_str): Likewise.
(target_pid_to_str): Change return type.
(target_translate_tls_address): Update.
(target_announce_detach): Update.
* bsd-uthread.c (struct bsd_uthread_target) <pid_to_str>: Change
return type.
(bsd_uthread_target::pid_to_str): Change return type.
* bsd-kvm.c (class bsd_kvm_target) <pid_to_str>: Change return
type.
(bsd_kvm_target::pid_to_str): Change return type.
* aix-thread.c (class aix_thread_target) <pid_to_str>: Change
return type.
(aix_thread_target::pid_to_str): Change return type.
* target.h (struct target_ops) <pid_to_str>: Change return type.
(target_pid_to_str, normal_pid_to_str): Likewise.
* obsd-nat.h (class obsd_nat_target) <pid_to_str>: Change return
type.
* linux-nat.h (class linux_nat_target) <pid_to_str>: Change return
type.
* inf-ptrace.h (struct inf_ptrace_target) <pid_to_str>: Change
return type.
* gnu-nat.h (struct gnu_nat_target) <pid_to_str>: Change return
type.
* fbsd-nat.h (class fbsd_nat_target) <pid_to_str>: Change return
type.
* darwin-nat.h (class darwin_nat_target) <pid_to_str>: Change
return type.

5 years agoFix MI output for multi-location breakpoints
Simon Marchi [Wed, 13 Mar 2019 19:13:03 +0000 (15:13 -0400)] 
Fix MI output for multi-location breakpoints

New in v2:

- Addressed comments about doc, updated the MI version table
- New doc for the Breakpoint information format
- New -fix-multi-location-breakpoint-output command, with associated
  doc, test and NEWS updated accordingly
- Fixed the output, the locations list is now actually in the tuple
  representing the breakpoint.

Various MI commands or events related to breakpoints output invalid MI
records when printing information about a multi-location breakpoint.
For example:

    -break-insert allo
    ^done,bkpt={...,addr="<MULTIPLE>",...},{number="1.1",...},{number="1.2",...}

The problem is that according to the syntax [1], the top-level elements
are of type "result" and should be of the form "variable=value".

This patch changes the output to wrap the locations in a list:

    ^done,bkpt={...,addr="<MULTIPLE>",locations=[{number="1.1",...},{number="1.2",...}]}

The events =breakpoint-created, =breakpoint-modified, as well as the
-break-info command also suffer from this (and maybe others I didn't
find).

Since this is a breaking change for MI, we have to deal somehow with
backwards compatibility.  The approach taken by this patch is to bump
the MI version, use the new syntax in MI3 while retaining the old syntax
in MI2.  Frontends are expected to use a precise MI version (-i=mi2), so
if they do that they should be unaffected.

The patch also adds the command -fix-multi-location-breakpoint-output,
which front ends can use to enable this behavior with MI <= 2.

[1] https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax

gdb/ChangeLog:

* NEWS: Mention that the new default MI version is 3.  Mention
changes to the output of commands and events that deal with
multi-location breakpoints.
* breakpoint.c: Include "mi/mi-out.h".
(print_one_breakpoint): Change output syntax if using MI version
>= 3.
* mi/mi-main.h (mi_cmd_fix_multi_location_breakpoint_output):
New.
(mi_multi_location_breakpoint_output_fixed): New.
* mi/mi-main.c (fix_multi_location_breakpoint_output): New.
(mi_cmd_fix_multi_location_breakpoint_output): New.
(mi_multi_location_breakpoint_output_fixed): New.
* mi/mi-cmds.c (mi_cmds): Register command
-fix-multi-location-breakpoint-output.
* mi/mi-out.c (mi_out_new): Instantiate version 3 when using
interpreter "mi".

gdb/testsuite/ChangeLog:

* mi-breakpoint-location-ena-dis.exp: Rename to ...
* mi-breakpoint-multiple-locations.exp: ... this.
(make_breakpoints_pattern): New proc.
(do_test): Add mi_version parameter, test -break-insert,
-break-info and =breakpoint-created.

gdb/doc/ChangeLog:

* gdb.texinfo (Mode Options): Mention mi3.
(Interpreters): Likewise.
(GDB/MI Development and Front Ends): Add entry for MI 3 in
version table.  Document -fix-multi-location-breakpoint-output.
(GDB/MI Breakpoint Information): Document format of breakpoint
location output.

5 years agoFactor out mi_ui_out instantiation logic
Simon Marchi [Wed, 13 Mar 2019 17:25:43 +0000 (13:25 -0400)] 
Factor out mi_ui_out instantiation logic

When re-reviewing this [1] I noticed that there were two spots encoding
the logic of instantiating an mi_ui_out object based on the interpreter
name ("mi", "mi1", "mi2" or "mi3"):

 - mi_interp::init
 - mi_load_progress

Both encode the logic to choose what the default version is when the
interpreter name is "mi".  I had forgotten the one in mi_load_progress.

Therefore, I propose extracting that logic to a single function.  I
started to add a new overload of mi_out_new, then realized the current
mi_out_new wasn't very useful, being just a thing wrapper around "new
mi_ui_out".  So I ended up with just an mi_out_new function taking the
interp name as parameter.

I ran the gdb.mi tests, and verified manually the behavior (including
the load command).

[1] https://sourceware.org/ml/gdb-patches/2019-01/msg00427.html

gdb/ChangeLog:

* mi/mi-out.h (mi_out_new): Change parameter to const char *.
* mi/mi-out.c (mi_out_new): Change parameter to const char *,
instantiate mi_ui_out based on interpreter name.
* mi/mi-interp.c (mi_interp::init): Use the new mi_out_new.
* mi/mi-main.c (mi_load_progress): Likewise.

5 years ago[BFD, LD, AArch64, 3/3] Add --pac-plt to enable PLTs protected with PAC.
Sudakshina Das [Wed, 13 Mar 2019 11:09:10 +0000 (11:09 +0000)] 
[BFD, LD, AArch64, 3/3] Add --pac-plt to enable PLTs protected with PAC.

This is part of the patch series to add support for BTI and
PAC in AArch64 linker.

1) This patch adds new definitions of PAC enabled PLTs
and both BTI and PAC enabled PLTs.
2) It also defines the new dynamic tag DT_AARCH64_PAC_PLT
for the PAC enabled PLTs.
3) This patch adds a new ld command line option: --pac-plt.
In the presence of this option, the linker uses the PAC
enabled PLTs and marks with DT_AARCH64_PAC_PLT.
4) In case both BTI and PAC are enabled the linker should
pick PLTs enabled with both and also use dynamic tags for both.
All these are made according to the new AArch64 ELF ABI
https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4

*** bfd/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>

* elfnn-aarch64.c (PLT_PAC_ENTRY_SIZE, PLT_PAC_SMALL_ENTRY_SIZE): New.
(PLT_BTI_PAC_ENTRY_SIZE, PLT_BTI_PAC_SMALL_ENTRY_SIZE): New.
(setup_plt_values): Account for PAC or PAC and BTI enabled PLTs.
(elfNN_aarch64_size_dynamic_sections): Add checks for PLT_BTI_PAC
and PLT_PAC_PLT.
(elfNN_aarch64_finish_dynamic_sections): Account for PLT_BTI_PAC.
(get_plt_type): Add case for DT_AARCH64_PAC_PLT.
(elfNN_aarch64_plt_sym_val): Add cases for PLT_BTI_PAC and PLT_PAC.

*** binutils/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>

* readelf.c (get_aarch64_dynamic_type): Add case for
DT_AARCH64_PAC_PLT.
(dynamic_section_aarch64_val): Likewise.

*** include/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>

* elf/aarch64.h (DT_AARCH64_PAC_PLT): New.

*** ld/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>

* NEWS: Document --pac-plt.
* emultempl/aarch64elf.em (OPTION_PAC_PLT): New.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS): Add pac-plt.
(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_PAC_PLT.
* testsuite/ld-aarch64/aarch64-elf.exp: Add the following tests.
* testsuite/ld-aarch64/bti-pac-plt-1.d: New test.
* testsuite/ld-aarch64/bti-pac-plt-2.d: New test.
* testsuite/ld-aarch64/pac-plt-1.d: New test.
* testsuite/ld-aarch64/pac-plt-2.d: New test.
* testsuite/ld-aarch64/bti-plt-1.s: Add .ifndef directive.

5 years ago[BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs
Sudakshina Das [Wed, 13 Mar 2019 10:54:30 +0000 (10:54 +0000)] 
[BFD, LD, AArch64, 2/3] Add --force-bti to enable BTI and to select BTI enabled PLTs

This is part of the patch series to add support for BTI and
PAC in AArch64 linker.

1) This patch adds a new ld command line option: --force-bti.
In the presence of this option, the linker enables BTI with the
GNU_PROPERTY_AARCH64_FEATURE_1_BTI feature. This gives out warning
in case of missing gnu notes for BTI in inputs.
2) It also defines a new set of BTI enabled PLTs. These are used either
when all the inputs are marked with GNU_PROPERTY_AARCH64_FEATURE_1_BTI
or when the new --force-bti option is used. This required adding new
fields in elf_aarch64_link_hash_table so that we could make the PLT
related information more generic.
3) It also defines a dynamic tag DT_AARCH64_BTI_PLT. The linker uses
this whenever it picks BTI enabled PLTs.
All these are made according to the new AArch64 ELF ABI
https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4

*** bfd/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>
    Szabolcs Nagy  <szabolcs.nagy@arm.com>

* bfd-in.h (aarch64_plt_type, aarch64_enable_bti_type): New.
(aarch64_bti_pac_info): New.
(bfd_elf64_aarch64_set_options): Add aarch64_bti_pac_info argument.
(bfd_elf32_aarch64_set_options): Likewise.
* bfd-in2.h: Regenerate
* elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): New.
(PLT_BTI_SMALL_ENTRY_SIZE, PLT_BTI_TLSDESC_ENTRY_SIZE): New.
(elfNN_aarch64_small_plt0_bti_entry): New.
(elfNN_aarch64_small_plt_bti_entry): New.
(elfNN_aarch64_tlsdesc_small_plt_bti_entry): New.
(elf_aarch64_obj_tdata): Add no_bti_warn and plt_type fields.
(elf_aarch64_link_hash_table): Add plt0_entry, plt_entry and
tlsdesc_plt_entry_size fields.
(elfNN_aarch64_link_hash_table_create): Initialise the new fields.
(setup_plt_values): New helper function.
(bfd_elfNN_aarch64_set_options): Use new bp_info to set plt sizes and
bti enable type.
(elfNN_aarch64_allocate_dynrelocs): Use new size members instead of
fixed macros.
(elfNN_aarch64_size_dynamic_sections): Likewise and add checks.
(elfNN_aarch64_create_small_pltn_entry): Use new generic pointers
to plt stubs instead of fixed ones and update filling them according
to the need for bti.
(elfNN_aarch64_init_small_plt0_entry): Likewise.
(elfNN_aarch64_finish_dynamic_sections): Likewise.
(get_plt_type, elfNN_aarch64_get_synthetic_symtab): New.
(elfNN_aarch64_plt_sym_val): Update size accordingly.
(elfNN_aarch64_link_setup_gnu_properties): Set up plts if BTI GNU NOTE
is set.
(bfd_elfNN_get_synthetic_symtab): Define.
(elfNN_aarch64_merge_gnu_properties): Give out warning with --force-bti
and mising BTI NOTE SECTION.

*** binutils/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>
    Szabolcs Nagy  <szabolcs.nagy@arm.com>

* readelf.c (get_aarch64_dynamic_type): New.
(get_dynamic_type): Use above for EM_AARCH64.
(dynamic_section_aarch64_val): New.
(process_dynamic_section): Use above for EM_AARCH64.

*** include/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>
    Szabolcs Nagy  <szabolcs.nagy@arm.com>

* elf/aarch64.h (DT_AARCH64_BTI_PLT): New.

*** ld/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>
    Szabolcs Nagy  <szabolcs.nagy@arm.com>

* NEWS: Document --force-bti.
* emultempl/aarch64elf.em (plt_type, bti_type, OPTION_FORCE_BTI): New.
(PARSE_AND_LIST_SHORTOPTS, PARSE_AND_LIST_OPTIONS): Add force-bti.
(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_FORCE_BTI.
* testsuite/ld-aarch64/aarch64-elf.exp: Add all the tests below.
* testsuite/ld-aarch64/bti-plt-1.d: New test.
* testsuite/ld-aarch64/bti-plt-1.s: New test.
* testsuite/ld-aarch64/bti-plt-2.s: New test.
* testsuite/ld-aarch64/bti-plt-2.d: New test.
* testsuite/ld-aarch64/bti-plt-3.d: New test.
* testsuite/ld-aarch64/bti-plt-4.d: New test.
* testsuite/ld-aarch64/bti-plt-5.d: New test.
* testsuite/ld-aarch64/bti-plt-6.d: New test.
* testsuite/ld-aarch64/bti-plt-7.d: New test.
* testsuite/ld-aarch64/bti-plt-so.s: New test.
* testsuite/ld-aarch64/bti-plt.ld: New test.

5 years ago[BFD, LD, AArch64, 1/3] Add support for GNU PROPERTIES in AArch64 for BTI and PAC
Sudakshina Das [Wed, 13 Mar 2019 10:42:27 +0000 (10:42 +0000)] 
[BFD, LD, AArch64, 1/3] Add support for GNU PROPERTIES in AArch64 for BTI and PAC

This is part of the patch series to add support for BTI and
PAC in AArch64 linker.

This patch implements the following:
1) This extends in the gnu property support in the linker for
AArch64 by defining backend hooks for elf_backend_setup_gnu_properties,
elf_backend_merge_gnu_properties and elf_backend_parse_gnu_properties.
2) It defines AArch64 specific GNU property
GNU_PROPERTY_AARCH64_FEATURE_1_AND and 2 bit for BTI and PAC in it.
3) It also adds support in readelf.c to read and print these new
GNU properties in AArch64.
All these are made according to the new AArch64 ELF ABI
https://developer.arm.com/docs/ihi0056/latest/elf-for-the-arm-64-bit-architecture-aarch64-abi-2018q4

*** bfd/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>

* elf-properties.c (_bfd_elf_link_setup_gnu_properties): Exclude
linker created inputs from merge.
* elfnn-aarch64.c (struct elf_aarch64_obj_tdata): Add field for
GNU_PROPERTY_AARCH64_FEATURE_1_AND properties.
(elfNN_aarch64_link_setup_gnu_properties): New.
(elfNN_aarch64_merge_gnu_properties): New.
(elf_backend_setup_gnu_properties): Define for AArch64.
(elf_backend_merge_gnu_properties): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Define.
(_bfd_aarch64_elf_parse_gnu_properties): Define.
(_bfd_aarch64_elf_merge_gnu_properties): Define.
* elfxx-aarch64.h (_bfd_aarch64_elf_link_setup_gnu_properties): Declare.
(_bfd_aarch64_elf_parse_gnu_properties): Declare.
(_bfd_aarch64_elf_merge_gnu_properties): Declare.
(elf_backend_parse_gnu_properties): Define for AArch64.

*** binutils/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>

* readelf.c (decode_aarch64_feature_1_and): New.
(print_gnu_property_note): Add case for AArch64 gnu notes.

*** include/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>

* elf/common.h (GNU_PROPERTY_AARCH64_FEATURE_1_AND): New.
(GNU_PROPERTY_AARCH64_FEATURE_1_BTI): New.
(GNU_PROPERTY_AARCH64_FEATURE_1_PAC): New.

*** ld/ChangeLog ***

2019-03-13  Sudakshina Das  <sudi.das@arm.com>

* NEWS: Document GNU_PROPERTY_AARCH64_FEATURE_1_BTI and
GNU_PROPERTY_AARCH64_FEATURE_1_PAC.
* testsuite/ld-aarch64/aarch64-elf.exp: Add run commands for new tests.
* testsuite/ld-aarch64/property-bti-pac1.d: New test.
* testsuite/ld-aarch64/property-bti-pac1.s: New test.
* testsuite/ld-aarch64/property-bti-pac2.d: New test.
* testsuite/ld-aarch64/property-bti-pac2.s: New test.
* testsuite/ld-aarch64/property-bti-pac3.d: New test.

5 years agox86: Properly set IBT and SHSTK properties for -z ibt/shstk
H.J. Lu [Wed, 13 Mar 2019 06:38:15 +0000 (14:38 +0800)] 
x86: Properly set IBT and SHSTK properties for -z ibt/shstk

There should be no AND properties if some input doesn't have them.  We
should set IBT and SHSTK properties for -z ibt and -z shstk if needed.

bfd/

PR ld/24322
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Properly
merge GNU_PROPERTY_X86_FEATURE_1_[IBT|SHSTK].

ld/

PR ld/24322
* testsuite/ld-i386/i386.exp: Run PR ld/24322 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr24322a.d: New file.
* testsuite/ld-i386/pr24322b.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/pr24322a.s: Likewise.
* testsuite/ld-x86-64/pr24322b.s: Likewise.
* testsuite/ld-x86-64/pr24322c.s: Likewise.

5 years agodwarf2: Align relocation within .debug_line section
Christian Eggers [Sun, 10 Mar 2019 18:21:58 +0000 (19:21 +0100)] 
dwarf2: Align relocation within .debug_line section

All relocations specify a byte address.  As dwarf debug information is
organized in octets, some relocations may not be aligned.  While it
might be possible to define special relocations that operate at an
octet offset from their address, it's easier to ensure the relocations
are aligned by padding with "nop" statements.

In most dwarf sections this requirement is already fulfilled, only
relocations for symbol address within the .debug_line section can be
misaligned.

* dwarf2dbg.c (out_set_addr): Align relocation within .debug_line.

5 years agodwarf2: Pad size of .debug_line section.
Christian Eggers [Sun, 10 Mar 2019 18:21:57 +0000 (19:21 +0100)] 
dwarf2: Pad size of .debug_line section.

As all dwarf debug information is organized in octets, the size of all
dwarf sections must be aligned to OCTETS_PER_BYTE.  Most DWARF sections
meet this requirement, only the .debug_line section can reach an
arbitrary octet size.

In order to align the size to a multiple of OCTETS_PER_BYTE, the section
is padded with "nop" statements at the end.

* dwarf2dbg.c (out_debug_line): Pad size of .debug_line section.

5 years agodwarf2: Use octets for .debug_string offsets
Christian Eggers [Sun, 10 Mar 2019 18:21:56 +0000 (19:21 +0100)] 
dwarf2: Use octets for .debug_string offsets

Like other dwarf2 offsets, also the string offsets in the .debug_info
section which points into the .debug_str section must be expressed in
octets instead of bytes.

* dwarf2dbg.c (out_debug_str): Use octets for .debug_string pointers.

5 years agodwarf2: Use octets for .debug_line prologue
Christian Eggers [Sun, 10 Mar 2019 18:21:55 +0000 (19:21 +0100)] 
dwarf2: Use octets for .debug_line prologue

Like the u32 size field at the beginning of the section, also the
prologue size must be expressed in octets.

* dwarf2dbg.c (out_debug_line): Use octets for .debug_line prologue.

5 years agodwarf2: Use octets for dwarf2 headers
Christian Eggers [Sun, 10 Mar 2019 18:21:54 +0000 (19:21 +0100)] 
dwarf2: Use octets for dwarf2 headers

The content of the dwarf2 sections .debug_line, .debug_aranges and
.debug_info starts with an u32 containing the the size of the remaining
data.  According to the dwarf2 specification this value must be expressed
in octets instead of bytes.

* dwarf2dbg.c (out_debug_line): Use octets for dwarf2 headers.
(out_debug_aranges, out_debug_info): Likewise.

5 years agoSymbols with octets value
Christian Eggers [Sun, 10 Mar 2019 18:21:53 +0000 (19:21 +0100)] 
Symbols with octets value

Up to now, all symbol values are in units of bytes, where a "byte" can
consist of one or more octets (e.g. 8 bit or 16 bit).

Allow to specfiy that the "unit" of a newly created symbol is octets
(exactly 8 bit), instead of bytes.

* symbols.h (symbol_temp_new_now_octets): Declare.
(symbol_set_value_now_octets, symbol_octets_p): Declare.
* symbols.c (struct symbol_flags): New member sy_octets.
(symbol_temp_new_now_octets): New function.
(resolve_symbol_value): Return octets instead of bytes if
sy_octets is set.
(symbol_set_value_now_octets): New function.
(symbol_octets_p): New function.

5 years agodwarf2: Fix calculation of line info offset
Christian Eggers [Sun, 10 Mar 2019 18:21:52 +0000 (19:21 +0100)] 
dwarf2: Fix calculation of line info offset

The units of the value returned by "frag_now_fix()" and "size" do not
match. "frag_now_fix()" returns bytes (can be 8, 16 or 32 bit), while
"size" is octets (exactly 8 bit).

* dwarf2dbg.c (dwarf2_emit_insn): Fix calculation of line info offset.

5 years agoAutomatic date update in version.in
GDB Administrator [Wed, 13 Mar 2019 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoThe NEWS file had two "New targets" sections for 8.3.
John Baldwin [Tue, 12 Mar 2019 20:56:53 +0000 (13:56 -0700)] 
The NEWS file had two "New targets" sections for 8.3.

gdb/ChangeLog:

* NEWS: Combine separate "New targets" sections for 8.3.

5 years agoSupport TLS variables on FreeBSD/powerpc.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Support TLS variables on FreeBSD/powerpc.

Derive the pointer to the DTV array from the %r2 register on 32-bit
powerpc and %r13 on 64-bit powerpc.

gdb/ChangeLog:

* ppc-fbsd-tdep.c (ppcfbsd_get_thread_local_address): New.
(ppcfbsd_init_abi): Install gdbarch
"fetch_tls_load_module_address" and "get_thread_local_address"
methods.

5 years agoSupport TLS variables on FreeBSD/riscv.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Support TLS variables on FreeBSD/riscv.

Derive the pointer to the DTV array from the tp register.

gdb/ChangeLog:

* riscv-fbsd-tdep.c (riscv_fbsd_get_thread_local_address): New.
(riscv_fbsd_init_abi): Install gdbarch
"fetch_tls_load_module_address" and "get_thread_local_address"
methods.

5 years agoSupport TLS variables on FreeBSD/i386.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Support TLS variables on FreeBSD/i386.

Derive the pointer to the DTV array from the gs_base register.  As
with FreeBSD/amd64, gs_base is currently only available via the native
target.

gdb/ChangeLog:

* i386-fbsd-tdep.c (i386fbsd_get_thread_local_address): New.
(i386fbsd_init_abi): Install gdbarch
"fetch_tls_load_module_address" and "get_thread_local_address"
methods.

5 years agoSupport TLS variables on FreeBSD/amd64.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Support TLS variables on FreeBSD/amd64.

Use the fs_base register to fetch the address of a thread's tcb and
calculate the address of the DTV array.  This value is then passed to
fbsd_get_thread_local_address to compute the final variable address.

Note that fs_base is currently only available via the native target as
core dumps on FreeBSD do not store the value of fs_base.

gdb/ChangeLog:

* amd64-fbsd-tdep.c (amd64fbsd_get_thread_local_address): New.
(amd64fbsd_init_abi): Install gdbarch
"fetch_tls_load_module_address" and "get_thread_local_address"
methods.

5 years agoAdd a helper function to resolve TLS variable addresses for FreeBSD.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Add a helper function to resolve TLS variable addresses for FreeBSD.

The fbsd_get_thread_local_address function accepts the base address of
a thread's DTV array and the base address of an object file's link map
and uses this to compute a TLS variable's address.  FreeBSD
architectures use an architecture-specific method to determine the
address of the DTV array pointer and call this helper function to
perform the rest of the address calculation.

* fbsd-tdep.c (fbsd_pspace_data_handle): New variable.
(struct fbsd_pspace_data): New type.
(get_fbsd_pspace_data, fbsd_pspace_data_cleanup)
(fbsd_read_integer_by_name, fbsd_fetch_rtld_offsets)
(fbsd_get_tls_index, fbsd_get_thread_local_address): New function.
(_initialize_fbsd_tdep): Initialize 'fbsd_pspace_data_handle'.
* fbsd-tdep.c (fbsd_get_thread_local_address): New prototype.

5 years agoAdd a more general version of lookup_struct_elt_type.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Add a more general version of lookup_struct_elt_type.

lookup_struct_elt is a new function which returns a tuple of
information about a component of a structure or union.  The returned
tuple contains a pointer to the struct field object for the component
as well as a bit offset of that field within the structure.  If the
field names a field in an anonymous substructure, the offset is the
"global" offset relative to the original structure type.  If noerr is
set, then the returned tuple will set the field pointer to NULL to
indicate a missing component rather than throwing an error.

lookup_struct_elt_type is now reimplemented in terms of this new
function.  It simply returns the type of the returned field.

gdb/ChangeLog:

* gdbtypes.c (lookup_struct_elt): New function.
(lookup_struct_elt_type): Reimplement via lookup_struct_elt.
* gdbtypes.h (struct struct_elt): New type.
(lookup_struct_elt): New prototype.

5 years agoRemove code disabled since at least 1999 from lookup_struct_elt_type.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Remove code disabled since at least 1999 from lookup_struct_elt_type.

Update the comment above the function to reflect the code removal and
document the existing behavior.

gdb/ChangeLog:

* gdbtypes.c (lookup_struct_elt_type): Update comment and
remove disabled code block.

5 years agoAdd a new gdbarch method to resolve the address of TLS variables.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Add a new gdbarch method to resolve the address of TLS variables.

Permit TLS variable addresses to be resolved purely by an ABI rather
than requiring a target method.  This doesn't try the target method if
the ABI function is present (even if the ABI function fails) to
simplify error handling.

gdb/ChangeLog:

* gdbarch.sh (get_thread_local_address): New method.
* gdbarch.h, gdbarch.c: Regenerate.
* target.c (target_translate_tls_address): Use
gdbarch_get_thread_local_address if present instead of
target::get_thread_local_address.

5 years agoUpdate comment for target::get_thread_local_address.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Update comment for target::get_thread_local_address.

There isn't an 'objfile' parameter, instead 'load_module_addr' is used
to indicate the executable or shared library.  Also, the function
throws errors rather than returning error values.

gdb/ChangeLog:

* target.h (target::get_thread_local_address): Update comment.

5 years agoHandle an edge case for minisym TLS variable lookups.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Handle an edge case for minisym TLS variable lookups.

If a TLS variable is provided by a minisym from a separate debug file,
the separate debug file is passed to
gdbarch_fetch_tls_load_module_address.  However, the object files
stored in the shared object list are the original object files, not
the separate debug object files.  In this case,
svr4_fetch_objfile_link_map was failing to find the link map entry
since the debug object file is not in its internal list, only the
original object file.

gdb/ChangeLog:

* solib-svr4.c (svr4_fetch_objfile_link_map): Look for
objfile->separate_debug_objfile_backlink if not NULL.

5 years agoSupport fs_base and gs_base on FreeBSD/i386.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Support fs_base and gs_base on FreeBSD/i386.

The i386 BSD native target uses the same ptrace operations
(PT_[GS]ET[FG]SBASE) as the amd64 BSD native target to fetch and store
the registers.

The amd64 BSD native now uses 'tdep->fsbase_regnum' instead of
hardcoding AMD64_FSBASE_REGNUM and AMD64_GSBASE_REGNUM to support
32-bit targets.  In addition, the store operations explicitly zero the
new register value before fetching it from the register cache to
ensure 32-bit values are zero-extended.

gdb/ChangeLog:

* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Use
tdep->fsbase_regnum instead of constants for fs_base and gs_base.
(amd64bsd_store_inferior_registers): Likewise.
* amd64-fbsd-nat.c (amd64_fbsd_nat_target::read_description):
Enable segment base registers.
* i386-bsd-nat.c (i386bsd_fetch_inferior_registers): Use
PT_GETFSBASE and PT_GETGSBASE.
(i386bsd_store_inferior_registers): Use PT_SETFSBASE and
PT_SETGSBASE.
* i386-fbsd-nat.c (i386_fbsd_nat_target::read_description): Enable
segment base registers.
* i386-fbsd-tdep.c (i386fbsd_core_read_description): Likewise.

5 years agoSupport the fs_base and gs_base registers on i386.
John Baldwin [Tue, 12 Mar 2019 20:39:02 +0000 (13:39 -0700)] 
Support the fs_base and gs_base registers on i386.

As on amd64, these registers hold the base address of the fs and gs
segments, respectively.  For i386 these two registers are 32 bits.

gdb/ChangeLog:

* amd64-fbsd-nat.c (amd64_fbsd_nat_target::read_description):
Update calls to i386_target_description to add 'segments'
parameter.
* amd64-tdep.c (amd64_init_abi): Set tdep->fsbase_regnum.  Don't
add segment base registers.
* arch/i386.c (i386_create_target_description): Add 'segments'
parameter to enable segment base registers.
* arch/i386.h (i386_create_target_description): Likewise.
* features/i386/32bit-segments.xml: New file.
* features/i386/32bit-segments.c: Generate.
* i386-fbsd-nat.c (i386_fbsd_nat_target::read_description): Update
call to i386_target_description to add 'segments' parameter.
* i386-fbsd-tdep.c (i386fbsd_core_read_description): Likewise.
* i386-go32-tdep.c (i386_go32_init_abi): Likewise.
* i386-linux-tdep.c (i386_linux_read_description): Likewise.
* i386-tdep.c (i386_validate_tdesc_p): Add segment base registers
if feature is present.
(i386_gdbarch_init): Pass I386_NUM_REGS to set_gdbarch_num_regs.
Add 'segments' parameter to call to i386_target_description.
(i386_target_description): Add 'segments' parameter to enable
segment base registers.
(_initialize_i386_tdep) [GDB_SELF_TEST]: Add 'segments' parameter
to call to i386_target_description.
* i386-tdep.h (struct gdbarch_tdep): Add 'fsbase_regnum'.
(enum i386_regnum): Add I386_FSBASE_REGNUM and I386_GSBASE_REGNUM.
Define I386_NUM_REGS.
(i386_target_description): Add 'segments' parameter to enable
segment base registers.

gdb/gdbserver/ChangeLog:

* linux-x86-tdesc.c (i386_linux_read_description): Update call to
i386_create_target_description for 'segments' parameter.
* lynx-i386-low.c (lynx_i386_arch_setup): Likewise.
* nto-x86-low.c (nto_x86_arch_setup): Likewise.
* win32-i386-low.c (i386_arch_setup): Likewise.

5 years agogdb/testsuite: Prepare for DejaGnu 1.6.2
Andrew Burgess [Thu, 7 Mar 2019 13:20:37 +0000 (13:20 +0000)] 
gdb/testsuite: Prepare for DejaGnu 1.6.2

Changes in DejaGnu 1.6.2 mean that our testsuite will no longer run.
This is because of some confusion over how the gdb.exp file is
handled.

The gdb.exp file is really the tool init file, which is loaded from
within the DejaGnu core, and it should not be loaded directly from any
other file in the testsuite.

DejaGnu tries to prevent the same library being loaded twice by
remembering the names of library files as they are loaded.  Until
recently loading the tool init file in DejaGnu was very similar to
loading a library file, as a result, loading the gdb.exp tool init
file simply recorded 'gdb.exp' as having been loaded, future attempts
to load 'gdb.exp' as a library would then be ignored (as the file was
marked as already loaded).

DejaGnu has now changed so that it supports having both a tool init
file and a library with the same name, something that was not possible
before.  What this means however is that when the core loads the
'gdb.exp' tool init file it no longer marks the library 'gdb.exp' as
having been loaded.  When we then execute 'load_lib gdb.exp' we then
try to reload the 'gdb.exp' file.

Unfortunately our gdb.exp file can only be loaded once.  It use of
'rename cd builtin_cd' means that a second attempt to load this file
will fail.

This was discussed on the DejaGnu list here:
   http://lists.gnu.org/archive/html/dejagnu/2019-03/msg00000.html

and the suggested advice is that, unless we have some real requirement
to load the tool init file twice, we should remove calls to 'load_lib
gdb.exp' and rely on DejaGnu to load the file for us, which is what
this patch does.

I've tested with native X86-64/GNU Linux and see no regressions.

gdb/testsuite/ChangeLog:

* config/default.exp: Remove 'load_lib gdb.exp'.
* config/monitor.exp: Likewise.
* config/sid.exp: Likewise.
* config/sim.exp: Likewise.
* config/slite.exp: Likewise.
* config/unix.exp: Likewise.
* gdb.base/default.exp: Remove unhelpful comment.

5 years agoFix MinGW build with source-highlight
Eli Zaretskii [Tue, 12 Mar 2019 17:47:23 +0000 (19:47 +0200)] 
Fix MinGW build with source-highlight

gdb/ChangeLog
2019-03-12  Eli Zaretskii  <eliz@gnu.org>

PR/24325
* source-cache.c: #undef open and close, to avoid unresolved
externals during linking.

5 years agoMake remote.c ptid constants "const"
Tom Tromey [Tue, 12 Mar 2019 17:03:03 +0000 (11:03 -0600)] 
Make remote.c ptid constants "const"

This changes magic_null_ptid, not_sent_ptid, and any_thread_ptid to be
"const".  This is a minor improvement that makes it so these can't be
accidentally modified.

Tested by rebuilding.  I'm checking this in.

gdb/ChangeLog
2019-03-12  Tom Tromey  <tromey@adacore.com>

* remote.c (magic_null_ptid, not_sent_ptid, any_thread_ptid): Now
const.  Add initializers.
(_initialize_remote): Don't initialize ptid globals.

5 years agoFix test-cp-name-parser build, parser_fprintf undefined
Pedro Alves [Tue, 12 Mar 2019 16:56:02 +0000 (16:56 +0000)] 
Fix test-cp-name-parser build, parser_fprintf undefined

  $ make test-cp-name-parser
  ...
  test-cp-name-parser.o: In function `yy_symbol_print(_IO_FILE*, int, YYSTYPE const*, cpname_state*)':
  build/gdb/cp-name-parser.c.tmp:1335: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  build/gdb/cp-name-parser.c.tmp:1339: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  test-cp-name-parser.o: In function `yy_stack_print(short*, short*)':
  build/gdb/cp-name-parser.c.tmp:1350: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  build/gdb/cp-name-parser.c.tmp:1354: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  build/gdb/cp-name-parser.c.tmp:1356: undefined reference to `parser_fprintf(_IO_FILE*, char const*, ...)'
  build/gdb/cp-name-parser.c.tmp:1376: more undefined references to `parser_fprintf(_IO_FILE*, char const*, ...)' follow
  collect2: error: ld returned 1 exit status
  make: *** [Makefile:1833: test-cp-name-parser] Error 1

gdb/ChangeLog:
2019-03-12  Pedro Alves  <palves@redhat.com>

* yy-remap.h [TEST_CPNAMES] (YYFPRINTF): Don't define.

5 years agoFix test-cp-name-parser build, unused variable
Pedro Alves [Tue, 12 Mar 2019 16:56:02 +0000 (16:56 +0000)] 
Fix test-cp-name-parser build, unused variable

  $ make test-cp-name-parser
  ...
  CXX    test-cp-name-parser.o
  src/gdb/cp-name-parser.y: In function ‘int gdb::main(int, char**)’:
  src/gdb/cp-name-parser.y:2137:6: error: unused variable ‘len’ [-Werror=unused-variable]
    int len;
^~~
  cc1plus: all warnings being treated as errors

gdb/ChangeLog:
2019-03-12  Pedro Alves  <palves@redhat.com>

* cp-name-parser.y (main): Remove unused 'len' variable.

5 years agoMake null_ptid and minus_one_ptid "const"
Tom Tromey [Mon, 4 Mar 2019 19:05:47 +0000 (12:05 -0700)] 
Make null_ptid and minus_one_ptid "const"

This makes null_ptid and minus_one_ptid "const".  I think this is an
improvement because it means they can't be accidentally modified.

2019-03-12  Tom Tromey  <tromey@adacore.com>

* common/ptid.c (null_ptid, minus_one_ptid): Now const.
* common/ptid.h (null_ptid, minus_one_ptid): Now const.

5 years agoChange iterate_over_lwps to take a gdb::function_view
Tom Tromey [Mon, 4 Mar 2019 19:05:03 +0000 (12:05 -0700)] 
Change iterate_over_lwps to take a gdb::function_view

This changes iterate_over_lwps to use a gdb::function_view.  This was
needed in order to make null_ptid and minus_one_ptid 'const'.

gdb/ChangeLog
2019-03-12  Tom Tromey  <tromey@adacore.com>

* linux-nat.c (iterate_over_lwps): Update.
(stop_callback): Remove parameter.
(stop_wait_callback, detach_callback, resume_set_callback)
(select_singlestep_lwp_callback, set_ignore_sigint)
(status_callback, resumed_callback, resume_clear_callback)
(kill_callback, kill_wait_callback, linux_nat_stop_lwp): Remove
data parameter.
(linux_nat_target::detach, linux_nat_target::resume)
(linux_stop_and_wait_all_lwps, select_event_lwp)
(linux_nat_filter_event, linux_nat_wait_1)
(linux_nat_target::kill, linux_nat_target::stop)
(linux_nat_target::stop): Update.
(linux_nat_resume_callback): Change type.
(resume_stopped_resumed_lwps, count_events_callback)
(select_event_lwp_callback): Likewise.
(linux_stop_lwp, linux_nat_stop_lwp): Update.
* arm-linux-nat.c (struct update_registers_data): Remove.
(update_registers_callback): Change type.
(arm_linux_insert_hw_breakpoint1): Update.
* nat/x86-linux-dregs.c (update_debug_registers_callback): Remove
parameter.
(x86_linux_dr_set_addr): Update.
(x86_linux_dr_set_control): Update.
* nat/linux-nat.h (iterate_over_lwps_ftype): Remove parameter.
(iterate_over_lwps): Use gdb::function_view.
* nat/aarch64-linux-hw-point.c (struct
aarch64_dr_update_callback_param): Remove.
(debug_reg_change_callback): Change type.
(aarch64_notify_debug_reg_change): Update.
* s390-linux-nat.c (s390_refresh_per_info): Update.

gdb/gdbserver/ChangeLog
2019-03-12  Tom Tromey  <tromey@adacore.com>

* linux-low.c (iterate_over_lwps): Update.

5 years agoDon't use bfd_get_file_size in objdump
Alan Modra [Tue, 12 Mar 2019 05:49:25 +0000 (16:19 +1030)] 
Don't use bfd_get_file_size in objdump

Compressed debug sections can have uncompressed sizes that exceed the
original file size, so we can't use bfd_get_file_size.  objdump also
used bfd_get_file_size to limit reloc section size, but I believe the
underlying bug causing the PR22508 out of bounds buffer access was
that we had an integer overflow when calculating the reloc buffer
size.  I've fixed that instead in most of the backends, som and
vms-alpha being the exceptions.  SOM and vmd-alpha have rather more
serious bugs in their slurp_relocs routines that would need fixing
first if we want to fuss about making them safe against fuzzed object
files.

The patch also fixes a number of other potential overflows by using
the bfd_alloc2/malloc2/zalloc2 memory allocation functions.

bfd/
* coffcode.h (buy_and_read): Delete unnecessary forward decl.  Add
nmemb parameter.  Use bfd_alloc2.
(coff_slurp_line_table): Use bfd_alloc2.  Update buy_and_read calls.
Delete assertion.
(coff_slurp_symbol_table): Use bfd_alloc2 and bfd_zalloc2.
(coff_slurp_reloc_table): Use bfd_alloc2.  Update buy_and_read calls.
* coffgen.c (coff_get_reloc_upper_bound): Ensure size calculation
doesn't overflow.
* elf.c (bfd_section_from_shdr): Use bfd_zalloc2.  Style fix.
(assign_section_numbers): Style fix.
(swap_out_syms): Use bfd_malloc2.
(_bfd_elf_get_reloc_upper_bound): Ensure size calculation doesn't
overflow.
(_bfd_elf_make_empty_symbol): Style fix.
(elfobj_grok_stapsdt_note_1): Formatting.
* elfcode.h (elf_object_p): Use bfd_alloc2.
(elf_write_relocs, elf_write_shdrs_and_ehdr): Likewise.
(elf_slurp_symbol_table): Use bfd_zalloc2.
(elf_slurp_reloc_table): Use bfd_alloc2.
(_bfd_elf_bfd_from_remote_memory): Use bfd_malloc2.
* elf64-sparc (elf64_sparc_get_reloc_upper_bound): Ensure
size calculation doesn't overflow.
(elf64_sparc_get_dynamic_reloc_upper_bound): Likewise.
* mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
* pdp11.c (get_reloc_upper_bound): Copy aoutx.h version.
binutils/
* objdump.c (load_specific_debug_section): Don't compare section
size against file size.
(dump_relocs_in_section): Don't compare reloc size against file size.
Print "failed to read relocs" on bfd_get_reloc_upper_bound error.

5 years agoAdd missing changelogs for previous commits.
Andreas Krebbel [Tue, 12 Mar 2019 13:23:10 +0000 (14:23 +0100)] 
Add missing changelogs for previous commits.

5 years agoS/390: arch13: Adjust to recent changes
Andreas Krebbel [Tue, 12 Mar 2019 13:09:55 +0000 (14:09 +0100)] 
S/390: arch13: Adjust to recent changes

opcodes/ChangeLog:

2019-03-12  Andreas Krebbel  <krebbel@linux.ibm.com>

* s390-opc.txt: Rename selhhhr to selfhr.  Remove optional operand
from vstrszb, vstrszh, and vstrszf.

gas/ChangeLog:

2019-03-12  Andreas Krebbel  <krebbel@linux.ibm.com>

* testsuite/gas/s390/zarch-arch13.s: Adjust testcase to optable changes.
* testsuite/gas/s390/zarch-arch13.d: Likewise.

5 years agoS/390: arch13: Add instruction descriptions
Andreas Krebbel [Tue, 12 Mar 2019 13:09:55 +0000 (14:09 +0100)] 
S/390: arch13: Add instruction descriptions

opcodes/ChangeLog:

2019-03-12  Andreas Krebbel  <krebbel@linux.ibm.com>

* s390-opc.txt: Add instruction descriptions.

5 years agoAutomatic date update in version.in
GDB Administrator [Tue, 12 Mar 2019 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

5 years agoRemove redundant assignment from dwarf2_find_containing_comp_unit
Tom Tromey [Mon, 11 Mar 2019 16:22:17 +0000 (10:22 -0600)] 
Remove redundant assignment from dwarf2_find_containing_comp_unit

dwarf2_find_containing_comp_unit has two assignments to "this_cu" in
quick succession, both of which are just:

  this_cu = dwarf2_per_objfile->all_comp_units[low];

... with no intervening assignments.

This patch removes the second assignment.  I'm checking this in as
obvious.  Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-03-11  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (dwarf2_find_containing_comp_unit): Remove
redundant assignment to "this_cu".

5 years agoAutomatic date update in version.in
GDB Administrator [Mon, 11 Mar 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, 10 Mar 2019 00:01:08 +0000 (00:01 +0000)] 
Automatic date update in version.in

5 years agoRemove unnecessary cases from rank_one_type's switch
Simon Marchi [Fri, 8 Mar 2019 15:15:12 +0000 (10:15 -0500)] 
Remove unnecessary cases from rank_one_type's switch

We return INCOMPATIBLE_TYPE_BADNESS for all these type codes, so we might as
well just let them go to the default case.

Incidentally, this patch also makes this false positive error go away when
compiling with gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0, default compiler on
Ubuntu 18.04.

  CXX    gdbtypes.o
/home/smarchi/src/binutils-gdb/gdb/gdbtypes.c: In function ‘rank rank_one_type(type*, type*, value*)’:
/home/smarchi/src/binutils-gdb/gdb/gdbtypes.c:4259:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^

gdb/ChangeLog:

* gdbtypes.c (rank_one_type): Remove unnecessary cases from switch.

5 years agoSplit rank_one_type_parm_set from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:11 +0000 (10:15 -0500)] 
Split rank_one_type_parm_set from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_set): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_struct from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:11 +0000 (10:15 -0500)] 
Split rank_one_type_parm_struct from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_struct): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_complex from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:11 +0000 (10:15 -0500)] 
Split rank_one_type_parm_complex from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_complex): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_float from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:10 +0000 (10:15 -0500)] 
Split rank_one_type_parm_float from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_float): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_bool from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:10 +0000 (10:15 -0500)] 
Split rank_one_type_parm_bool from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_bool): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_range from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:09 +0000 (10:15 -0500)] 
Split rank_one_type_parm_range from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_range): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_char from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:09 +0000 (10:15 -0500)] 
Split rank_one_type_parm_char from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_char): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_enum from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:09 +0000 (10:15 -0500)] 
Split rank_one_type_parm_enum from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_enum): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_int from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:08 +0000 (10:15 -0500)] 
Split rank_one_type_parm_int from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_int): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_func from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:08 +0000 (10:15 -0500)] 
Split rank_one_type_parm_func from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_func): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_array from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:08 +0000 (10:15 -0500)] 
Split rank_one_type_parm_array from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_array): New function extracted
from...
(rank_one_type): ... this.

5 years agoSplit rank_one_type_parm_ptr from rank_one_type
Simon Marchi [Fri, 8 Mar 2019 15:15:07 +0000 (10:15 -0500)] 
Split rank_one_type_parm_ptr from rank_one_type

gdb/ChangeLog:

* gdbtypes.c (rank_one_type_parm_ptr): New function extracted
from...
(rank_one_type): ... this.

5 years agoEnsure 'help set/show print inferior-events' shows the example events.
Philippe Waroquiers [Sat, 9 Mar 2019 11:25:11 +0000 (12:25 +0100)] 
Ensure 'help set/show print inferior-events' shows the example events.

Without this patch, the help stops after  'e.g.' :
  (gdb) apropos \(inferior\|thread\) event
  set print inferior-events -- Set printing of inferior events (e.g.
  set print thread-events -- Set printing of thread events (such as thread start and exit)
  show print inferior-events -- Show printing of inferior events (e.g.
  show print thread-events -- Show printing of thread events (such as thread start and exit)

Using the same notation as for the thread evenets (i.e. 'such as') gives:
 (gdb) apropos \(inferior\|thread\) event
 set print inferior-events -- Set printing of inferior events (such as inferior start and exit)
 set print thread-events -- Set printing of thread events (such as thread start and exit)
 show print inferior-events -- Show printing of inferior events (such as inferior start and exit)
 show print thread-events -- Show printing of thread events (such as thread start and exit)

5 years agoSupport styling on native MS-Windows console
Eli Zaretskii [Sat, 9 Mar 2019 06:44:56 +0000 (08:44 +0200)] 
Support styling on native MS-Windows console

gdb/ChangeLog:
2019-03-08  Eli Zaretskii  <eliz@gnu.org>

PR/24315
* utils.c (can_emit_style_escape) [_WIN32]: Don't disable styling
on MS-Windows if $TERM is not defined.

* cli/cli-style.c: Set cli_styling to 1 in the MinGW build.

* posix-hdep.c (gdb_console_fputs):
* mingw-hdep.c (rgb_to_16colors, gdb_console_fputs): New
functions.
* ui-file.h (gdb_console_fputs): Add prototype.

* ui-file.c (stdio_file::puts): Call gdb_console_fputs, and fall
back to fputs only if the former returns zero.

5 years agoAutomatic date update in version.in
GDB Administrator [Sat, 9 Mar 2019 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

This page took 0.054942 seconds and 4 git commands to generate.