binutils-gdb.git
6 years agoUpdate documentation of readelf's --unwind option.
Nick Clifton [Thu, 18 Oct 2018 15:58:16 +0000 (16:58 +0100)]
Update documentation of readelf's --unwind option.

* doc/binutils.texi (readelf): Document alternatives to the
--unwind option if it is not supported for the target
architecture.

6 years ago[gdb/testsuite] Fix capitalized test names
Tom de Vries [Thu, 18 Oct 2018 11:23:08 +0000 (13:23 +0200)]
[gdb/testsuite] Fix capitalized test names

At https://sourceware.org/gdb/wiki/GDBTestcaseCookbook\
  #Follow_the_test_name_convention we find:
..
Test names should start with a lower case and don't need to end with a period
(they are not sentences).
...

Fix some capitalized test names.

Tested on x86_64-linux.

2018-10-18  Tom de Vries  <tdevries@suse.de>

* gdb.ada/bp_inlined_func.exp: Fix capitalized test name.
* gdb.ada/excep_handle.exp: Same.
* gdb.ada/mi_string_access.exp: Same.
* gdb.ada/mi_var_union.exp: Same.
* gdb.arch/arc-analyze-prologue.exp: Same.
* gdb.arch/arc-decode-insn.exp: Same.
* gdb.base/readnever.exp: Same.
* gdb.fortran/printing-types.exp: Same.
* gdb.guile/scm-lazy-string.exp: Same.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 18 Oct 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years ago gdb/ChangeLog:
Paul Koning [Wed, 17 Oct 2018 23:26:55 +0000 (19:26 -0400)]
gdb/ChangeLog:

        * charset.c (convert_between_encodings): Fix unsigned overflow.

    gdb/charset.c (convert_between_encodings): Fix unsigned overflow.

6 years agoShare the code to format "info proc mappings" entries for FreeBSD.
John Baldwin [Wed, 17 Oct 2018 18:41:30 +0000 (11:41 -0700)]
Share the code to format "info proc mappings" entries for FreeBSD.

gdb/ChangeLog:

* fbsd-nat.c (fbsd_nat_target::info_proc) Use
fbsd_info_proc_mappings_header and fbsd_info_proc_mappings_entry.
* fbsd-tdep.c (fbsd_vm_map_entry_flags): Mark static.
(fbsd_info_proc_mappings_header, fbsd_info_proc_mappings_entry):
New functions.
(fbsd_core_info_proc_mappings): Use fbsd_info_proc_mappings_header
and fbsd_info_proc_mappings_header.
* fbsd-tdep.h (fbsd_vm_map_entry_flags): Remove.
(fbsd_info_proc_mappings_header, fbsd_info_proc_mappings_entry):
New.

6 years agogdb/MAINTAINERS: Add Rainer Orth as Solaris maintainer for GDB
Joel Brobecker [Wed, 17 Oct 2018 18:04:14 +0000 (11:04 -0700)]
gdb/MAINTAINERS: Add Rainer Orth as Solaris maintainer for GDB

gdb/ChangeLog:

* MAINTAINERS (Responsible Maintainers): Add Rainer Orth as
Solaris Maintainer.

6 years agoPR23653, ld SIGSEGVs when attempts to link sparc object with x86_64 library
Alan Modra [Tue, 16 Oct 2018 22:47:30 +0000 (09:17 +1030)]
PR23653, ld SIGSEGVs when attempts to link sparc object with x86_64 library

This patch improves dynobj selection.  This allows the testcase in the
PR to proceed further before segfaulting due to other bugs in the
sparc backend.

../ld/ld-new --eh-frame-hdr -m elf_x86_64 -shared -o bug.so.5 bug.o ./libc.so.6 ./crtendS.o
../ld/ld-new: sparc architecture of input file `bug.o' is incompatible with i386:x86-64 output
../ld/ld-new: bug.o: in function `a':
bug.c:(.text+0x4): undefined reference to `_GLOBAL_OFFSET_TABLE_'
../ld/ld-new: bug.c:(.text+0x8): undefined reference to `_GLOBAL_OFFSET_TABLE_'
Segmentation fault

PR 23653
* elflink.c (_bfd_elf_link_create_dynstrtab): Match elf_object_id
too when choosing dynobj.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 17 Oct 2018 00:01:28 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years ago[gdb/testsuite] Rewrite catch-follow-exec.exp
Tom de Vries [Thu, 4 Oct 2018 22:04:27 +0000 (00:04 +0200)]
[gdb/testsuite] Rewrite catch-follow-exec.exp

There are two problems with the current catch-follow-exec.exp:
- INTERNAL_GDBFLAGS (containing the datadir setting) is not used
- remote host testing doesn't work

Fix the former by using gdb_spawn_with_cmdline_opts.  Fix the latter by
requiring gdb-native.

Build on x86_64-linux with and without ubsan, and tested.

2018-10-16  Tom de Vries  <tdevries@suse.de>

PR gdb/23730
* gdb.base/catch-follow-exec.c: Add copyright notice.
* gdb.base/catch-follow-exec.exp: Rewrite to use
gdb_spawn_with_cmdline_opts.  Require gdb-native.

6 years agoAArch64: Fix error checking for SIMD udot (by element)
Matthew Malcomson [Tue, 16 Oct 2018 17:49:36 +0000 (18:49 +0100)]
AArch64: Fix error checking for SIMD udot (by element)

Committed on behalf of Matthew Malcomson:

The SIMD UDOT instruction assembly has an unusual operand that selects a single
32 bit element with the mnemonic 4B.
This unusual mnemonic is handled by a special operand qualifier and associated
qualifier data in `aarch64_opnd_qualifiers`.

The current qualifier data describes 4 1-byte elements with the structure
{1, 4, 0x0, "4b", OQK_OPD_VARIANT}
This makes sense, as the instruction does work on 4 1-byte elements, however
some logic in the `operand_general_constraint_met_p` makes assumptions about
the range of index allowed when selecting a SIMD_ELEMENT depending on element
size.
That function reasons that e.g. in order to select a byte-sized element in a 16
byte V register an index must allow selection of one of the 16 elements and
hence its range will be in [0,15].

This reasoning breaks with the above description of a 4 part selection of 1
byte elements and allows an index outside the valid [0,3] range, triggering an
assert later on in the program in `aarch64_ins_reglane`.

vshcmd: > echo 'udot v0.2s, v1.8b, v2.4b[4]' | ../src/binutils-build/gas/as-new -march=armv8.4-a
as-new: ../../binutils-gdb/opcodes/aarch64-asm.c:134: aarch64_ins_reglane: Assertion `reglane_index < 4' failed.
{standard input}: Assembler messages:
{standard input}:1: Internal error (Aborted).
Please report this bug.

This patch changes the operand qualifier data so that it describes a single
32 bit element.
{4, 1, 0x0, "4b", OQK_OPD_VARIANT}
Hence the calculation in `operand_general_constraint_met_p` provides the
correct answer and the usual error checking machinery is used.

vshcmd: > echo 'udot v0.2s, v1.8b, v2.4b[4]' | ../src/binutils-build/gas/as-new -march=armv8.4-a
{standard input}: Assembler messages:
{standard input}:1: Error: register element index out of range 0 to 3 at operand 3 -- `udot v0.2s,v1.8b,v2.4b[4]'

6 years agoSimplify PR23110 PE_DEBUG_DATA size checks
Alan Modra [Tue, 16 Oct 2018 05:59:23 +0000 (16:29 +1030)]
Simplify PR23110 PE_DEBUG_DATA size checks

The negative size check can be rolled into the "exceeds space left in
section" check if that is done using an unsigned comparison.  We know
that "addr - section->vma" is never larger than section->size since
the section is found by find_section_by_vma.

* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Simplify
PE_DEBUG_DATA size checks.

6 years agoPR23781, _bfd_pe_bfd_copy_private_bfd_data_common memory leak
Alan Modra [Tue, 16 Oct 2018 04:53:20 +0000 (15:23 +1030)]
PR23781, _bfd_pe_bfd_copy_private_bfd_data_common memory leak

PR 23781
* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Free data
before returning.

6 years agoPR23780, assertion abort in function display_raw_attribute
Alan Modra [Tue, 16 Oct 2018 04:09:03 +0000 (14:39 +1030)]
PR23780, assertion abort in function display_raw_attribute

PR 23780
* readelf.c (display_raw_attribute): Correct assertion.

6 years agoPR23769, mixing split-stack and non-split-stack error message
Cherry Zhang [Tue, 16 Oct 2018 03:37:41 +0000 (14:07 +1030)]
PR23769, mixing split-stack and non-split-stack error message

Corrects which file is reported as being split-stack.

PR 23769
* gold.cc (queue_middle_tasks): Correct split-stack error message.

6 years agoRemove unnecessary casts from TUI
Tom Tromey [Sun, 14 Oct 2018 18:50:32 +0000 (12:50 -0600)]
Remove unnecessary casts from TUI

This removes a number of unnecessary casts from the TUI.  Some were
found with -Wuseless-cast (which, I think, can't easily be enabled for
gdb); and some were found by inspection.

Tested by rebuilding on x86-64 Fedora 28.
I'm checking this in.

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

* tui/tui.c (strcat_to_buf): Remove casts.
* tui/tui-winsource.c (tui_show_source_line)
(tui_set_is_exec_point_at, tui_line_is_displayed): Remove casts.
* tui/tui-wingeneral.c (tui_refresh_win, box_win): Remove casts.
* tui/tui-windata.c (tui_first_data_item_displayed)
(tui_delete_data_content_windows, tui_erase_data_content)
(tui_display_all_data, tui_display_data_from)
(tui_refresh_data_win, tui_vertical_data_scroll): Remove casts.
* tui/tui-win.c (tui_set_win_height)
(make_invisible_and_set_new_height, parse_scrolling_args): Remove
casts.
* tui/tui-win.c (tui_resize_all): Remove casts.
(tui_scroll_backward_command, tui_set_focus)
(tui_set_tab_width_command): Likewise.
* tui/tui-source.c (tui_vertical_source_scroll): Remove cast.
* tui/tui-regs.c (tui_show_register_group): Remove cast.
* tui/tui-layout.c (tui_set_layout_by_name): Remove cast.
* tui/tui-disasm.c (tui_vertical_disassem_scroll): Remove cast.
* tui/tui-data.c (tui_partial_win_by_name, tui_free_win_content):
Remove casts.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 16 Oct 2018 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRISC-V: Adjust __global_pointer$ value to reduce code size.
Jim Wilson [Mon, 15 Oct 2018 23:00:28 +0000 (16:00 -0700)]
RISC-V: Adjust __global_pointer$ value to reduce code size.

ld/
* emulparams/elf32lriscv-defs.sh (DATA_START_SYMBOLS): New.
(SDATA_START_SYMBOLS): Define __SDATA_BEGIN__.  Don't define
__global_pointer$.
(OTHER_END_SYMBOLS): New.  Define __global_pointer$.
* testsuite/ld-riscv-elf/pcrel-lo-addend-2.d (#ld): Add --no-relax.

6 years agoRe: BFD_INIT_MAGIC
Alan Modra [Mon, 15 Oct 2018 22:31:55 +0000 (09:01 +1030)]
Re: BFD_INIT_MAGIC

I should know better than to introduce the first use of size_t in
bfd.h.

PR 23534
* init.c (bfd_init): Return an unsigned int.
bfd-in2.h: Regenerate.

6 years agoAdd Alan Hayward as AArch64/ARM GDB maintainer
Simon Marchi [Mon, 15 Oct 2018 19:52:03 +0000 (15:52 -0400)]
Add Alan Hayward as AArch64/ARM GDB maintainer

gdb/ChangeLog:

* MAINTAINERS (Responsible Maintainers): Add Alan Hayward as
AArch64/ARM maintainer.

6 years agoBFD_INIT_MAGIC
Alan Modra [Mon, 15 Oct 2018 05:40:27 +0000 (16:10 +1030)]
BFD_INIT_MAGIC

This patch performs a run-time test that a shared libbfd.so has been
compiled with the same size bfd_vma as that of apps using the library.
On a 32-bit host it is easily possible to have one libbfd.so compiled
to support 64-bit targets (or configured with --enable-64-bit-bfd)
while another only supports 32-bit targets.  The two libraries will
have differently sized bfd_vma types, and if the wrong one is loaded
all sorts of weird behaviour might be seen.

bfd/
PR 23534
* init.c (BFD_INIT_MAGIC): Define.
(bfd_init): Return BFD_INIT_MAGIC.
bfd-in2.h: Regenerate.
binutils/
PR 23534
* addr2line.c (main): Exit with fatal error if bfd_init
returns an unexpected value.
* ar.c (main): Likewise.
* dlltool.c (identify_dll_for_implib): Likewise.
* nm.c (main): Likewise.
* objcopy.c (main): Likewise.
* objdump.c (main): Likewise.
* size.c (main): Likewise.
* strings.c (main): Likewise.
* windmc.c (main): Likewise.
* windres.c (main): Likewise.
gas/
PR 23534
* as.c (main): Exit with fatal error if bfd_init returns an
unexpected value.
ld/
PR 23534
* ldmain.c (main): Exit with fatal error if bfd_init returns
an unexpected value.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 15 Oct 2018 00:00:54 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 14 Oct 2018 00:01:07 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years ago_bfd_clear_contents bounds checking
Alan Modra [Sat, 13 Oct 2018 11:33:02 +0000 (22:03 +1030)]
_bfd_clear_contents bounds checking

This PR shows a fuzzed binary triggering a segfault via a bad
relocation in .debug_line.  It turns out that unlike normal
relocations applied to a section, the linker applies those with
symbols from discarded sections via _bfd_clear_contents without
checking that the relocation is within the section bounds.  The same
thing now happens when reading debug sections since commit
a4cd947aca23, the PR23425 fix.

PR 23770
PR 23425
* reloc.c (_bfd_clear_contents): Replace "location" param with
"buf" and "off".  Bounds check "off".  Return status.
* cofflink.c (_bfd_coff_generic_relocate_section): Update
_bfd_clear_contents call.
* elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Likewise.
* elf32-arc.c (elf_arc_relocate_section): Likewise.
* elf32-i386.c (elf_i386_relocate_section): Likewise.
* elf32-metag.c (metag_final_link_relocate): Likewise.
* elf32-nds32.c (nds32_elf_get_relocated_section_contents): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf32-visium.c (visium_elf_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* elf64-x86-64.c *(elf_x86_64_relocate_section): Likewise.
* libbfd-in.h (_bfd_clear_contents): Update prototype.
* libbfd.h: Regenerate.

6 years agoELF ld -r scripts
Alan Modra [Fri, 12 Oct 2018 01:36:40 +0000 (12:06 +1030)]
ELF ld -r scripts

"ld -r" generally should not combine object file sections with
different names.  For example, "ld -r" should not combine ".text",
".text.hot" and ".text.cold" into an output ".text" section.  An
exception needs to be made for linker created sections, for example,
branch trampoline sections that might be created even for ld -r.

"ld -r" also should not define symbols in linker scripts.  Any
definitions are likely to conflict with those defined at final link.

A MEMORY spec is also not needed for ld -r.

* Makefile.am (eelf32btsmip_fbsd.c, eelf32btsmipn32_fbsd.c),
(eelf32epiphany.c, eelf32epiphany_4x4.c, eelf32ltsmip_fbsd.c),
(eelf32ltsmipn32_fbsd.c, eelf32xc16x.c, eelf32xc16xl.c),
(eelf32xc16xs.c, emcorepe.c, enios2elf.c, enios2linux.c),
(eelf64btsmip_fbsd.c, eelf64ltsmip_fbsd.c): Correct dependencies.
* Makefile.in: Regenerate.
* emulparams/aarch64cloudabi.sh, * emulparams/aarch64fbsd.sh,
* emulparams/aarch64linux.sh, * emulparams/aarch64linux32.sh,
* emulparams/arc-nps.sh, * emulparams/elf32_spu.sh,
* emulparams/elf32_tic6x_le.sh, * emulparams/elf32bmip.sh,
* emulparams/elf32btsmipn32.sh, * emulparams/elf32lr5900n32.sh,
* emulparams/elf32mep.sh, * emulparams/elf32metag.sh,
* emulparams/elf64btsmip.sh, * emulparams/shelf_vxworks.sh,
* emulparams/shlelf_fd.sh, * scripttempl/DWARF.sc,
* scripttempl/alpha.sc, * scripttempl/alphavms.sc,
* scripttempl/arclinux.sc, * scripttempl/armbpabi.sc,
* scripttempl/avr.sc, * scripttempl/dlx.sc, * scripttempl/elf.sc,
* scripttempl/elf32cr16.sc, * scripttempl/elf32cr16c.sc,
* scripttempl/elf32crx.sc, * scripttempl/elf32msp430.sc,
* scripttempl/elf32msp430_3.sc, * scripttempl/elf32xc16x.sc,
* scripttempl/elf32xc16xl.sc, * scripttempl/elf32xc16xs.sc,
* scripttempl/elf64hppa.sc, * scripttempl/elf_chaos.sc,
* scripttempl/elfarc.sc, * scripttempl/elfarcv2.sc,
* scripttempl/elfd10v.sc, * scripttempl/elfd30v.sc,
* scripttempl/elfm68hc11.sc, * scripttempl/elfm68hc12.sc,
* scripttempl/elfm9s12z.sc, * scripttempl/elfmicroblaze.sc,
* scripttempl/elfxgate.sc, * scripttempl/elfxtensa.sc,
* scripttempl/epiphany_4x4.sc, * scripttempl/ft32.sc,
* scripttempl/hppaelf.sc, * scripttempl/ia64vms.sc,
* scripttempl/ip2k.sc, * scripttempl/iq2000.sc,
* scripttempl/mep.sc, * scripttempl/mmo.sc,
* scripttempl/nds32elf.sc, * scripttempl/pru.sc,
* scripttempl/sh.sc, * scripttempl/v850.sc,
* scripttempl/v850_rh850.sc, * scripttempl/visium.sc,
* scripttempl/xstormy16.sc: Condition various parts of scripts on
${RELOCATABLE} in order to prevent ld -r merging sections or
defining symbols.  Remove MEMORY and VERSION definitions from
ld -r scripts too.
* testsuite/ld-elf/group2.d, * testsuite/ld-elf/group4.d,
* testsuite/ld-elf/group5.d, * testsuite/ld-elf/group6.d,
* testsuite/ld-elf/group7.d, * testsuite/ld-elf/group8a.d,
* testsuite/ld-elf/group8b.d, * testsuite/ld-elf/group9a.d,
* testsuite/ld-elf/group9b.d, * testsuite/ld-elf/pr17550a.d,
* testsuite/ld-elf/pr17550b.d,
* testsuite/ld-elf/pr17550d.d: Don't xfail cr16 and crx.
* testsuite/ld-elf/init-fini-arrays.d,
* testsuite/ld-elf/pr22677.d: Likewise, and dont' xfail mep.

6 years agoClean up gdb.trace test results on targets not supporting this feature.
Sandra Loosemore [Sat, 13 Oct 2018 00:56:13 +0000 (17:56 -0700)]
Clean up gdb.trace test results on targets not supporting this feature.

2018-10-12  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.trace/actions-changed.exp: Check for arch support.
* gdb.trace/actions.exp: Likewise.
* gdb.trace/ax.exp: Likewise.
* gdb.trace/backtrace.exp: Likewise.
* gdb.trace/change-loc.exp: Likewise.
* gdb.trace/deltrace.exp: Likewise.
* gdb.trace/ftrace-lock.exp: Check for shlib and arch support.
* gdb.trace/ftrace.exp: Likewise.
* gdb.trace/infotrace.exp: Check for arch support.
* gdb.trace/mi-trace-frame-collected.exp: Likewise.
* gdb.trace/mi-tracepoint-changed.exp: Likewise.
* gdb.trace/mi-tsv-changed.exp: Likewise.
* gdb.trace/packetlen.exp: Likewise.
* gdb.trace/passc-dyn.exp: Likewise.
* gdb.trace/passcount.exp: Likewise.
* gdb.trace/pending.exp: Likewise.
* gdb.trace/range-stepping.exp: Check for shlib support.
* gdb.trace/report.exp: Check for arch support.
* gdb.trace/save-trace.exp: Likewise.
* gdb.trace/signal.exp: Check for signal support.
* gdb.trace/tfind.exp: Check for arch support.
* gdb.trace/trace-break.exp: Check for arch and shlib support.
* gdb.trace/trace-common.h: Add comment.
* gdb.trace/trace-condition.exp: Check for shlib and arch support.
* gdb.trace/trace-enable-disable.exp: Likewise.
* gdb.trace/trace-mt.exp: Likewise.  Remove redundant untested call.
* gdb.trace/tracecmd.exp: Check for arch support.
* gdb.trace/tspeed.exp: Check for shlib and target support.
* gdb.trace/tstatus.exp: Check for arch support.
* gdb.trace/tsv.exp: Likewise.
* gdb.trace/while-dyn.exp: Likewise.
* gdb.trace/while-stepping.exp: Likewise.
* lib/trace-support.exp (gdb_trace_common_supports_arch): New.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 13 Oct 2018 00:00:38 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix buglets in gdb.trace/tspeed.{exp,c}
Simon Marchi [Fri, 12 Oct 2018 20:27:29 +0000 (16:27 -0400)]
Fix buglets in gdb.trace/tspeed.{exp,c}

When trying to run gdb.trace/tspeed.exp, I get:

ERROR: can't read "ipalib": no such variable
    while executing
"gdb_load_shlib $ipalib"
    (procedure "prepare_for_trace_test" line 5)

This problem seems to come from commit

    c708f4d256f ("gdb: Don't call gdb_load_shlib unless GDB is running")

which moved the gdb_load_shlib call in prepare_for_trace_test.  In order
to access the ipalib variable, we need to declare "global ipalib" first.

Then, this test uses nowarnings, for no good reason I could find.  We
can remove that and fix the two trivial warnings that appear:

/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c: In function 'main':
/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c:87:16: warning: too many arguments for format [-Wformat-extra-args]
        printf ("Negative times, giving up\n", max_iters);
                ^
/home/emaisin/src/binutils-gdb/gdb/testsuite/gdb.trace/tspeed.c:99:7: warning: implicit declaration of function 'sleep' [-Wimplicit-function-declaration]
       sleep (1);  /* set post-run breakpoint here */
       ^

gdb/testsuite/ChangeLog:

* gdb.trace/tspeed.exp: Remove nowarnings.
(prepare_for_trace_test): Declare "global ipalib".
* gdb.trace/tspeed.c: Include unistd.h.
(main): Remove superfluous printf argument.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 12 Oct 2018 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix pathname regexp in gdb.base/solib-vanish.exp.
Sandra Loosemore [Thu, 11 Oct 2018 23:51:26 +0000 (16:51 -0700)]
Fix pathname regexp in gdb.base/solib-vanish.exp.

2018-10-11  Sandra Loosemore  <sandra@codesourcery.com>

gdb/testsuite/
* gdb.base/solib-vanish.exp: Fix regexp not to require a POSIX
directory prefix on the filename.

6 years agoPrevent the --keep-global-symbol and --globalize-symbol options from being used together.
Nick Clifton [Thu, 11 Oct 2018 10:38:10 +0000 (11:38 +0100)]
Prevent the --keep-global-symbol and --globalize-symbol options from being used together.

This is the result of an email thread starting here:
  https://sourceware.org/ml/binutils/2018-09/msg00031.html

The main point of the thread is this observation:

  * Supposing we had an object file with two globals, SomeGlobal and
  SomeOtherGlobal, if one were to do "--globalize-symbol SomeGlobal
  --keep-global-symbol SomeOtherGlobal", you might expect that both
  SomeGlobal and SomeOtherGlobal are global in the output file... but it
  isn't. Because --keep-global-symbol is set and doesn't include
  SomeGlobal, SomeGlobal will be demoted to a local symbol. And because
  the check to see if we should apply the --globalize-symbol flag checks
  "flags" (the original flag set), and not "sym->flags", it decides not
  to do anything, so SomeGlobal remains a local symbol. Although this is
  a weird edge case, should this be changed so that --keep-global-symbol
  implicitly keeps anything also specified via --globalize-symbol? (The
  code seems technically correct with respect to the documentation, but
  IMO the behavior is counter-intuitive).

binutils* objcopy.c (copy_main): Issue a fata error if the
--keep-global-symbol(s) and the --globalize-symbol(s) options are
used together.
* doc/binutils.texi: Document that the two options are
incompatible.
* testsuite/binutils-all/copy-5.d: New test.
* testsuite/binutils-all/objcopy.exp: Run the new test.

6 years agoFix interp::m_name resource leak found by Coverity
Gary Benson [Thu, 11 Oct 2018 09:19:26 +0000 (10:19 +0100)]
Fix interp::m_name resource leak found by Coverity

This commit fixes a resource leak found by Coverity, where interp's
constructor allocated memory for m_name that interp's destructor did
not free.

gdb/ChangeLog:

* interps.h (interp::m_name): Make private and mutable.
* interps.c (interp::~interp): Free m_name.

6 years agox86: add {,V}MOVQ cases to xmmword test
Jan Beulich [Thu, 11 Oct 2018 07:16:28 +0000 (09:16 +0200)]
x86: add {,V}MOVQ cases to xmmword test

I had overlooked these when putting together the original test.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 11 Oct 2018 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd parameter to allow enabling/disabling selftests via configure
Sergio Durigan Junior [Mon, 17 Sep 2018 19:58:55 +0000 (15:58 -0400)]
Add parameter to allow enabling/disabling selftests via configure

This is a follow-up of:

  https://sourceware.org/ml/gdb-patches/2018-08/msg00347.html

Instead of going throttle and always enabling our selftests (even in
non-development builds), this patch is a bit more conservative and
introduces a configure option ("--enable-unit-tests") that allows the
user to choose whether she wants unit tests in the build or not.  Note
that the current behaviour is retained: if no option is provided, GDB
will have selftests included in a development build, and will *not*
have selftests included in a non-development build.

The rationale for having this option is still the same: due to the
many racy testcases and random failures we see when running the GDB
testsuite, it is unfortunately not possible to perform a full test
when one is building a downstream package.  As the Fedora GDB
maintainer and one of the Debian GDB uploaders, I feel like this
situation could be improved by, at least, executing our selftests
after the package has been built.

This patch introduces no regressions to our build.

OK?

gdb/ChangeLog:
2018-10-10  Sergio Durigan Junior  <sergiodj@redhat.com>
    Simon Marchi <simark@simark.ca>

* README (`configure' options): Add documentation for new
"--enable-unit-tests" option.
* acinclude.m4: Include "selftest.m4".
* configure: Regenerate.
* configure.ac: Use "GDB_AC_SELFTEST".
* maint.c (maintenance_selftest): Update message informing
that selftests have been disabled.
(maintenance_info_selftests): Likewise.
* selftest.m4: New file.

gdb/gdbserver/ChangeLog:
2018-10-10  Sergio Durigan Junior  <sergiodj@redhat.com>
    Simon Marchi <simark@simark.ca>

* acinclude.m4: Include "../selftest.m4".
* configure: Regenerate.
* configure.ac: Use "GDB_AC_SELFTEST".
* configure.srv: Use "$enable_unittests" instead of
"$development" when checking whether unit tests have been
enabled.
* server.c (captured_main): Update message informing that
selftests have been disabled.

gdb/testsuite/ChangeLog:
2018-10-10  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.gdb/unittest.exp: Update expected message informing that
selftests have been disabled.
* gdb.server/unittest.exp: Likewise.

squash! Add parameter to allow enabling/disabling selftests via configure

6 years agoAdd missing va_end found by Coverity
Gary Benson [Wed, 10 Oct 2018 14:01:50 +0000 (15:01 +0100)]
Add missing va_end found by Coverity

This commit adds a missing va_end found by Coverity.

gdb/ChangeLog:

* remote.c (remote_target::remote_send_printf): Add
missing va_end found by Coverity.

6 years agobtrace: check for indirect jump return in _Unwind_RaiseException
Markus Metzger [Mon, 24 Sep 2018 09:33:11 +0000 (11:33 +0200)]
btrace: check for indirect jump return in _Unwind_RaiseException

Some versions of _Unwind_RaiseException, e.g. on Fedora 28, use an
indirect jump to return to the exception handler.

This messes up the output of "record function-call-history /c" since the
return is interpreted as cross-function goto.  It had been detected by
gdb.btrace/exception.exp.

Add a heuristic for "_Unwind_*" functions to interpret an indirect jump
that ends in one of our caller functions as return to the first instance
of that function in our call stack.

gdb/
* btrace.c (ftrace_update_function): Add indirect jump heuristic.

6 years agox86: fold Size{16,32,64} template attributes
Jan Beulich [Wed, 10 Oct 2018 06:41:52 +0000 (08:41 +0200)]
x86: fold Size{16,32,64} template attributes

Only one of them can be set at a time, which means they can be expressed
by a single 2-bit field instead of three 1-bit ones.

6 years agoHPPA64 .PARISC.unwind entries
Alan Modra [Wed, 10 Oct 2018 02:44:56 +0000 (13:14 +1030)]
HPPA64 .PARISC.unwind entries

.PARISC.unwind has 32-bit addresses in both 32-bit ELF and 64-bit ELF.
Well, strictly speaking, the 32-bit "start" and "end" fields are
segment relative offsets.  (The 64-bit ABI says so, while the 32-bit
ABI says they are addresses but it appears they are segment relative
offsets in practice.  Likely the 32-bit ABI lacks an update.)

* readelf.c (hppa_process_unwind): Don't use eh_addr_size to
calculate number of entries.
(slurp_hppa_unwind_table): Don't use eh_addr_size here either.

6 years agoS12Z: Set eh_addr_size to 4
Alan Modra [Wed, 10 Oct 2018 01:47:54 +0000 (12:17 +1030)]
S12Z: Set eh_addr_size to 4

* objdump.c (dump_dwarf): Set s12z eh_addr_size to 4.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 10 Oct 2018 00:00:45 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoMake @pxref for Inferior.architecture point to gdb.Frame documentation
Tom Tromey [Tue, 9 Oct 2018 19:57:10 +0000 (13:57 -0600)]
Make @pxref for Inferior.architecture point to gdb.Frame documentation

This fixes he @pxref in Inferior.architecture to point to the "Frames
In Python" node, as originally intended; somewhat reverting an earlier
build fix.  The initial patch had typod the "In".

Tested by "make info".

gdb/doc/ChangeLog
2018-10-09  Tom Tromey  <tom@tromey.com>

* python.texi (Inferiors In Python): Link to "Frames In Python",
not "Unwinding Frames in Python".

6 years agoDisable the undefined behavior sanitizer by default
Tom Tromey [Tue, 9 Oct 2018 17:51:33 +0000 (11:51 -0600)]
Disable the undefined behavior sanitizer by default

There have been a few undefined behavior failures reported, and Pedro
suggested that the sanitizer be disabled by default.  This patch
implements this.

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

* configure: Rebuild.
* sanitize.m4 (AM_GDB_UBSAN): Default to no.
* NEWS: Update --enable-ubsan documentation.

gdb/doc/ChangeLog
2018-10-09  Tom Tromey  <tom@tromey.com>

* gdb.texinfo (Configure Options): Update --enable-ubsan
documentation.

6 years ago[PATCH, BINUTULS, AARCH64, 9/9] Add SSBS to MSR/MRS
Sudakshina Das [Wed, 26 Sep 2018 10:04:32 +0000 (11:04 +0100)]
[PATCH, BINUTULS, AARCH64, 9/9] Add SSBS to MSR/MRS

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)
The encodings can be found in the System Register XML.

This patch adds support for the mitigation for Spectre Variant 4 by
adding the PSTATE bit SSBS which are accessible using MSR and MRS
instructions. Although this is a mandatory addition to the ARMv8.5-A,
it is permitted to be added to any version of the ARMv8 architecture.
This is enabled using the command line option of +ssbs for older
versions.

*** include/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_SSBS): New.
(AARCH64_ARCH_V8_5): Add AARCH64_FEATURE_SSBS by default.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* aarch64-opc.c (operand_general_constraint_met_p): Add
SSBS in the check for one-bit immediate.
(aarch64_sys_regs): New entry for SSBS.
(aarch64_sys_reg_supported_p): New check for above.
(aarch64_pstatefields): New entry for SSBS.
(aarch64_pstatefield_supported_p): New check for above.

*** gas/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* config/tc-aarch64.c (aarch64_features): Add new "ssbs".
* doc/c-aarch64.texi: Document the same.
* testsuite/gas/aarch64/ssbs-illegal1.d: New test.
* testsuite/gas/aarch64/ssbs-illegal1.l: New test.
* testsuite/gas/aarch64/ssbs-illegal2.d: New test.
* testsuite/gas/aarch64/ssbs-illegal2.l: New test.
* testsuite/gas/aarch64/ssbs.s: New test.
* testsuite/gas/aarch64/ssbs1.d: Test with +ssbs
* testsuite/gas/aarch64/ssbs2.d: Test with armv8.5-a.

6 years ago[PATCH, BINUTILS, AARCH64, 8/9] Add SCXTNUM_ELx and ID_PFR2_EL1 system registers
Sudakshina Das [Wed, 26 Sep 2018 10:02:28 +0000 (11:02 +0100)]
[PATCH, BINUTILS, AARCH64, 8/9] Add SCXTNUM_ELx and ID_PFR2_EL1 system registers

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)
The encodings can be found in the System Register XML.

This patch adds the new system registers SCXTNUM_ELx and ID_PFR2_EL1.

*** include/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_SCXTNUM): New.
(AARCH64_FEATURE_ID_PFR2): New.
(AARCH64_ARCH_V8_5): Add both by default.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* aarch64-opc.c (aarch64_sys_regs): New entries for
scxtnum_el[0,1,2,3,12] and id_pfr2_el1.
(aarch64_sys_reg_supported_p): New checks for above.

*** gas/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* testsuite/gas/aarch64/sysreg-4.s: Test registers
scxtnum_el[0,1,2,3,12] and id_pfr2_el1.
* testsuite/gas/aarch64/sysreg-4.d: Likewise.
* testsuite/gas/aarch64/illegal-sysreg-4.l: Likewise.

6 years ago[PATCH, BINUTILS, AARCH64, 7/9] Add BTI instruction
Sudakshina Das [Wed, 26 Sep 2018 10:00:49 +0000 (11:00 +0100)]
[PATCH, BINUTILS, AARCH64, 7/9] Add BTI instruction

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/docs/ddi0596/a/a64-base-instructions-alphabetic-order/bti-branch-target-identification)

The Branch Target Identification instructions (BTI) are allocated to
existing HINT space, using HINT numbers 32, 34, 36, 38, such that
bits[7:6] of the instruction identify the compatibility of the BTI
instruction to different branches.

BTI {<targets>}

where <targets> one of the following, specifying which type of
indirection is allowed:

j : Can be a target of any BR Xn isntruction.
c : Can be a target of any BLR Xn and BR {X16|X17}.
jc: Can be a target of any free branch.

A BTI instruction without any <targets> is the strictest of all and
can not be a target of nay free branch.

*** include/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_BTI): New.
(AARCH64_ARCH_V8_5): Add AARCH64_FEATURE_BTI by default.
(aarch64_opnd): Add AARCH64_OPND_BTI_TARGET.
(HINT_OPD_CSYNC, HINT_OPD_C, HINT_OPD_J): New macros to
define HINT #imm values.
(HINT_OPD_JC, HINT_OPD_NULL): Likewise.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* aarch64-opc.h (HINT_OPD_NOPRINT, HINT_ENCODE): New.
(HINT_FLAG, HINT_VALUE): New macros to encode NO_PRINT flag
with the hint immediate.
* aarch64-opc.c (aarch64_hint_options): New entries for
c, j, jc and default (with HINT_OPD_F_NOPRINT flag) for BTI.
(aarch64_print_operand): Add case for AARCH64_OPND_BTI_TARGET
while checking for HINT_OPD_F_NOPRINT flag.
* aarch64-dis.c (aarch64_ext_hint): Use new HINT_VALUE to
extract value.
* aarch64-tbl.h (aarch64_feature_bti, BTI, BTI_INSN): New.
(aarch64_opcode_table): Add entry for BTI.
(AARCH64_OPERANDS): Add new description for BTI targets.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.

*** gas/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* config/tc-aarch64.c (parse_bti_operand): New.
(process_omitted_operand): Add case for AARCH64_OPND_BTI_TARGET.
(parse_operands): Likewise.
* testsuite/gas/aarch64/system.d: Update for BTI.
* testsuite/gas/aarch64/bti.s: New.
* testsuite/gas/aarch64/bti.d: New.
* testsuite/gas/aarch64/illegal-bti.d: New.
* testsuite/gas/aarch64/illegal-bti.l: New.

6 years ago[PATCH, BINUTILS, AARCH64, 6/9] Add Random number instructions
Sudakshina Das [Wed, 26 Sep 2018 09:57:16 +0000 (10:57 +0100)]
[PATCH, BINUTILS, AARCH64, 6/9] Add Random number instructions

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)
The encodings can be found in the System Register XML.

This patch adds the following:
MSR Xn, RNDR
MSR Xn, RNDRRS

These are optional instructions in ARMv8.5-A and hence the new
+rng is added.

*** include/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_RNG): New.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* aarch64-opc.c (aarch64_sys_regs): New entries for
rndr and rndrrs.
(aarch64_sys_reg_supported_p): New check for above.

*** gas/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* config/tc-aarch64.c (aarch64_features): New "rng" option.
* doc/c-aarch64.texi: Document the same.
* testsuite/gas/aarch64/sysreg-4.s: Test both instructions.
* testsuite/gas/aarch64/sysreg-4.d: Likewise.
* testsuite/gas/aarch64/illegal-sysreg-4.l: Likewise.

6 years ago[PATCH, BINUTILS, AARCH64, 5/9] Add DC CVADP instruction
Sudakshina Das [Wed, 26 Sep 2018 09:54:07 +0000 (10:54 +0100)]
[PATCH, BINUTILS, AARCH64, 5/9] Add DC CVADP instruction

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/docs/ddi0596/a/a64-base-instructions-alphabetic-order/dc-data-cache-operation-an-alias-of-sys)

This patch adds the DC CVADP instruction. Since this has a separate
identification mechanism a new feature bit is added.

*** include/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_CVADP): New.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* aarch64-opc.c (aarch64_sys_regs_dc): New entry for cvadp.
(aarch64_sys_ins_reg_supported_p): New check for above.

*** gas/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* testsuite/gas/aarch64/sysreg-4.s: Test instruction.
* testsuite/gas/aarch64/sysreg-4.d: Likewise.
* testsuite/gas/aarch64/illegal-sysreg-4.l: Likewise.

6 years ago[PATCH, BINUTILS, AARCH64, 4/9] Add Execution and Data Restriction instructions
Sudakshina Das [Wed, 26 Sep 2018 09:52:51 +0000 (10:52 +0100)]
[PATCH, BINUTILS, AARCH64, 4/9] Add Execution and Data Restriction instructions

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/docs/ddi0596/a/a64-base-instructions-alphabetic-order)

This patch adds the prediction restriction instructions (that is, cfp,
dvp, cpp). These instructions are retrospectively made optional for
all versions of the architecture from ARMv8.0 to ARMv8.4 and is
mandatory from ARMv8.5. Hence adding a new +predres which can be used
by the older architectures.

*** include/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_PREDRES): New.
(AARCH64_ARCH_V8_5): Add AARCH64_FEATURE_PREDRES by default.
(aarch64_opnd): Add AARCH64_OPND_SYSREG_SR.
(aarch64_sys_regs_sr): Declare new table.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* aarch64-dis.c (aarch64_ext_sysins_op): Add case for
AARCH64_OPND_SYSREG_SR.
* aarch64-opc.c (aarch64_print_operand): Likewise.
(aarch64_sys_regs_sr): Define table.
(aarch64_sys_ins_reg_supported_p): Check for RCTX with
AARCH64_FEATURE_PREDRES.
* aarch64-tbl.h (aarch64_feature_predres): New.
(PREDRES, PREDRES_INSN): New.
(aarch64_opcode_table): Add entries for cfp, dvp and cpp.
(AARCH64_OPERANDS): Add new description for SYSREG_SR.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.

*** gas/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* config/tc-aarch64.c (aarch64_sys_regs_sr_hsh): New.
(parse_operands): Add entry for AARCH64_OPND_SYSREG_SR.
(md_begin): Allocate and initialize aarch64_sys_regs_sr_hsh
with aarch64_sys_regs_sr.
(aarch64_features): Add new "predres" option for older
architectures.
* doc/c-aarch64.texi: Document the same.
* testsuite/gas/aarch64/sysreg-4.s: New.
* testsuite/gas/aarch64/sysreg-4.d: New.
* testsuite/gas/aarch64/illegal-sysreg-4.d: New.
* testsuite/gas/aarch64/illegal-sysreg-4.l: New.
* testsuite/gas/aarch64/predres.s: New.
* testsuite/gas/aarch64/predres.d: New.

6 years ago[PATCH, BINUTILS, AARCH64, 3/9] Add instruction SB for ARMv8.5-A
Sudakshina Das [Wed, 26 Sep 2018 09:47:40 +0000 (10:47 +0100)]
[PATCH, BINUTILS, AARCH64, 3/9] Add instruction SB for ARMv8.5-A

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/docs/ddi0596/a/a64-base-instructions-alphabetic-order)

This instruction is retrospectively made optional for all versions of
the architecture from ARMv8.0 to ARMv8.4 and is mandatory from
ARMv8.5.  Hence a new command line option of "+sb" is added for older
architectures.

*** include/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_SB): New.
(AARCH64_ARCH_V8_5): Add AARCH64_FEATURE_SB by default.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* aarch64-tbl.h (aarch64_feature_sb): New.
(SB, SB_INSN): New.
(aarch64_opcode_table): Add entry for sb.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.

*** gas/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* config/tc-aarch64.c (aarch64_features): Add new "sb" option
for older architectures.
* doc/c-aarch64.texi: Document the same.
* testsuite/gas/aarch64/sb.s: New.
* testsuite/gas/aarch64/sb.d: New.

6 years ago[PATCH, BINUTILS, AARCH64, 2/9] Add Data procoessing instructions for ARMv8.5-A
Sudakshina Das [Wed, 26 Sep 2018 09:45:35 +0000 (10:45 +0100)]
[PATCH, BINUTILS, AARCH64, 2/9] Add Data procoessing instructions for ARMv8.5-A

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/docs/ddi0596/a/a64-base-instructions-alphabetic-order)

This patch adds the data processing instructions that are new to
ARMv8.5-A.

1) There are 2 instructions: xaflag, axflag, that are added to
manipulate the states of the flag and are used to convert between the
Arm representation and the fcmp representation.

2) The other instructions are rounding instructions which have 8
versions based on whether the floating-point number is a
Single-Precision or Double-Precision number, whether the target
integer is a 32-bit or 64-bit integer and whether the rounding mode is
the ambient rounding mode or to zero. Each of these instruction is
available in both Scalar and Vector forms.

Since both 1) and 2) have separate identification mechanism and it is
permissible that a ARMv8.4 compliant implementation may include any
arbitrary subset of the ARMv8.5 features unless otherwise specified,
new feature bits are added.

*** include/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* opcode/aarch64.h (AARCH64_FEATURE_FLAGMANIP): New.
(AARCH64_FEATURE_FRINTTS): New.
(AARCH64_ARCH_V8_5): Add both by default.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* aarch64-tbl.h (aarch64_feature_flagmanip): New.
(aarch64_feature_frintts): New.
(FLAGMANIP, FRINTTS): New.
(aarch64_opcode_table): Add entries for xaflag, axflag
and frint[32,64][x,z] instructions.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.

*** gas/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

* testsuite/gas/aarch64/armv8_5-a-dp.s: New.
* testsuite/gas/aarch64/armv8_5-a-dp.d: New.

6 years ago[PATCH, BINUTILS, AARCH64, 1/9] Add -march=armv8.5-a and related internal feature...
Sudakshina Das [Wed, 26 Sep 2018 09:38:59 +0000 (10:38 +0100)]
[PATCH, BINUTILS, AARCH64, 1/9] Add -march=armv8.5-a and related internal feature macros

This patch is part of the patch series to add support for ARMv8.5-A
extensions.
(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)

This is the first of the patch series and adds -march=armv8.5-a and
other internal feature marcos needed for it.

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

    * config/tc-aarch64.c (aarch64_archs): New entry for armv8.5-a.
    * doc/c-aarch64.texi: Add documentation for the same.

*** include/ChnageLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

    * opcode/aarch64.h (AARCH64_FEATURE_V8_5): New.
    (AARCH64_ARCH_V8_5): New.

*** opcodes/ChangeLog ***

2018-10-09  Sudakshina Das  <sudi.das@arm.com>

    * aarch64-tbl.h (aarch64_feature_set aarch64_feature_v8_5): New.
    (ARMV8_5, V8_5_INSN): New.

6 years ago[gdb/testsuite] Fix target_supports_scheduler_locking raciness
Tom de Vries [Thu, 4 Oct 2018 12:10:39 +0000 (14:10 +0200)]
[gdb/testsuite] Fix target_supports_scheduler_locking raciness

When calling gdb_start_cmd, it's the caller's responsibility to wait for gdb
to return to the prompt.  In target_supports_scheduler_locking, that's not the
case, and consequently, target_supports_scheduler_locking fails spuriously.

Fix by using runto_main instead.

Build and reg-tested on x86_64-linux.

2018-10-09  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (target_supports_scheduler_locking): Replace gdb_start_cmd
with runto_main.

6 years agoFix buffer overrun found by Coverity
Gary Benson [Tue, 9 Oct 2018 13:13:12 +0000 (14:13 +0100)]
Fix buffer overrun found by Coverity

This commit fixes a buffer overrun found by Coverity, where
36 bytes are written into a 24 byte buffer.

gdb/ChangeLog:

* dwarf2read.c (create_dwp_hash_table): Fix buffer overrun
found by Coverity.

6 years agoDo not place symbols into a discarded .dynsym
Egeyar Bagcioglu [Wed, 3 Oct 2018 21:27:32 +0000 (23:27 +0200)]
Do not place symbols into a discarded .dynsym

Prevents getting an error about dynamic symbols in sections indexed
64K+ when .dynsym is discarded.

* elflink.c (elf_link_output_extsym): Do not place symbols into a
discarded .dynsym.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 9 Oct 2018 00:01:10 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoRemove unused variables from riscv-fbsd-tdep.c
Tom Tromey [Mon, 8 Oct 2018 22:39:29 +0000 (16:39 -0600)]
Remove unused variables from riscv-fbsd-tdep.c

This removes a couple of unused variables from riscv-fbsd-tdep.c.
This allows a --enable-targets=all build to complete on
x86-64 Fedora 28.

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

* riscv-fbsd-tdep.c (riscv_fbsd_sigframe_init): Remove unused
variable.
(riscv_fbsd_init_abi): Likewise.

6 years agoFix the [-Werror=shadow=local] warning
Weimin Pan [Mon, 8 Oct 2018 22:14:11 +0000 (22:14 +0000)]
Fix the [-Werror=shadow=local] warning

Rename local variable in value_struct_elt_for_reference()
to work around the shadowing a previous local warning.

6 years agoAdd native target for FreeBSD/riscv.
John Baldwin [Mon, 8 Oct 2018 21:47:34 +0000 (14:47 -0700)]
Add native target for FreeBSD/riscv.

gdb/ChangeLog:

* Makefile.in (ALLDEPFILES): Add riscv-fbsd-nat.c.
* NEWS: Mention new FreeBSD/riscv native configuration.
* configure.host: Add riscv*-*-freebsd*.
* configure.nat: Likewise.
* riscv-fbsd-nat.c: New file.

gdb/doc/ChangeLog:

* gdb.texinfo (Contributors): Add SRI International and University
of Cambridge for FreeBSD/riscv.

6 years agoAdd FreeBSD/riscv architecture.
John Baldwin [Mon, 8 Oct 2018 21:47:34 +0000 (14:47 -0700)]
Add FreeBSD/riscv architecture.

Support for collecting and supplying general purpose and floating
point register sets is provided along with signal frame unwinding.

FreeBSD only supports RV64 currently, so while some provision is made
for RV32 in the general-purpose register set, the changes have only
been tested on RV64.

gdb/ChangeLog:

* Makefile.in (ALL_TARGET_OBS): Add riscv-fbsd-tdep.o.
(HFILES_NO_SRCDIR): Add riscv-fbsd-tdep.h.
(ALLDEPFILES): Add riscv-fbsd-tdep.c.
* NEWS: Mention new FreeBSD/riscv target.
* configure.tgt: Add riscv*-*-freebsd*.
* riscv-fbsd-tdep.c: New file.
* riscv-fbsd-tdep.h: New file.

6 years agoAdd a helper function to trad_frame to support register cache maps.
John Baldwin [Mon, 8 Oct 2018 21:47:33 +0000 (14:47 -0700)]
Add a helper function to trad_frame to support register cache maps.

Currently, signal frame handlers require explicitly coded calls to
trad_frame_set_reg_addr() to describe the location of saved registers
within a signal frame.  This change permits the regcache_map_entry
arrays used with regcache::supply_regset and regcache::collect_regset
to be used to describe a block of saved registers given an initial
address for the register block.

Some systems use the same layout for registers in core dump notes,
native register sets with ptrace(), and the register contexts saved in
signal frames.  On these systems, a single register map can now be
used to describe the layout of registers in all three places.

If a register map entry's size does not match the native size of a
register, try to match the semantics used by
regcache::transfer_regset.  If a register slot is too large, assume
that the register's value is stored in the first N bytes and ignore
the remaning bytes.  If the register slot is smaller than the
register, assume the slot holds the low N bytes of the register's
value.  Read these low N bytes from the target and zero-extend them to
generate a register value.

While here, document the semantics for both regcache::transfer_regset
and trad_frame with respect to register slot's whose size does not
match the register's size.

gdb/ChangeLog:

* regcache.h (struct regcache_map_entry): Note that this type can
be used with traditional frame caches.
* trad-frame.c (trad_frame_set_reg_regmap): New.
* trad-frame.h (trad_frame_set_reg_regmap): New.

6 years agoFinding data member in virtual base class
Weimin Pan [Mon, 8 Oct 2018 21:16:59 +0000 (21:16 +0000)]
Finding data member in virtual base class

This patch fixes the original problem - printing member in a virtual base,
using various expressions, do not yield the same value. Simple test case
below demonstrates the problem:

% cat t.cc
struct base { int i; };
typedef base tbase;
struct derived: virtual tbase { void func() { } };
int main() { derived().func(); }
% g++ -g t.cc
% gdb a.out
(gdb) break derived::func
(gdb) run
(gdb) p i
$1 = 0
(gdb) p base::i
$3 = 0
(gdb) p derived::i
$4 = 4196392

To fix the problem, add function get_baseclass_offset() which searches
recursively for the base class along the class hierarchy. If the base
is virtual, it uses "vptr" in virtual class object, which indexes to
its derived class's vtable, to get and returns the baseclass offset.
If the base is non-virtual, it returns the accumulated offset of its
parent classes. The offset is then added to the address of the class
object to access its member in value_struct_elt_for_reference().

6 years agoAArch64: Replace C initializers with memset
Tamar Christina [Mon, 8 Oct 2018 12:33:42 +0000 (13:33 +0100)]
AArch64: Replace C initializers with memset

Clang doesn't accept {0} as a valid C struct initializer under their implementation
of -Wmissing-field-initializers.  This makes using C initializers a bit tricky.

Instead I'm changing the code to use memset instead, which at least GCC inlines and
generates the same code for.  This also seems to be the idiom used in binutils for
most targets.

opcodes/

* aarch64-opc.c (verify_constraints): Use memset instead of {0}.

6 years agox86: Don't add GNU_PROPERTY_X86_FEATURE_2_NEEDED for -z separate-code
H.J. Lu [Mon, 8 Oct 2018 12:14:02 +0000 (05:14 -0700)]
x86: Don't add GNU_PROPERTY_X86_FEATURE_2_NEEDED for -z separate-code

With

commit 64029e93683a266c38d19789e780f3748bd6a188
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Oct 5 11:40:54 2018 +0930

    Separate header PT_LOAD for -z separate-code

there is no need to add a GNU_PROPERTY_X86_ISA_1_USED note to force
program header in in non-code PT_LOAD segment when -z separate-code
is used.

bfd/

PR ld/23428
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Don't
add GNU_PROPERTY_X86_FEATURE_2_NEEDED to force program header
in non-code PT_LOAD segment.

ld/

PR ld/23428
* testsuite/ld-i386/property-x86-4a.d: Updated.
* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a.d: Likewise.

6 years agoELF: Properly group and place orphan note sections
H.J. Lu [Mon, 8 Oct 2018 11:39:09 +0000 (04:39 -0700)]
ELF: Properly group and place orphan note sections

Properly group orphan note sections.  When placing orphan note section
as the first note section, place it after the section before all note
sections.

PR ld/23658
* ldlang.c (lang_insert_orphan): Properly group and place orphan
note sections.  Properly handle orphan note section before all
note sections.
* testsuite/ld-elf/pr23658-1.d: Renamed to ...
* testsuite/ld-elf/pr23658-1a.d: This.  Updated.
* testsuite/ld-elf/pr23658-1b.d: New test.
* testsuite/ld-elf/pr23658-1c.d: Likewise.

6 years agoSeparate header PT_LOAD for -z separate-code
Alan Modra [Fri, 5 Oct 2018 02:10:54 +0000 (11:40 +0930)]
Separate header PT_LOAD for -z separate-code

This patch, along with previous patches in the series, supports
putting the ELF file header and program headers in a PT_LOAD without
sections.

Logic governing whether headers a loaded has changed a little:  The
primary reason to include headers is now the presence of
SIZEOF_HEADERS in a linker script.  However, to support scripts that
may have reserved space for headers by hand, we continue to add
headers whenever the first section address is past the end of headers
modulo page size.

include/
* bfdlink.h (struct bfd_link_info): Add load_phdrs field.
bfd/
* elf-nacl.c (nacl_modify_segment_map): Cope with header PT_LOAD
lacking sections.
* elf.c (_bfd_elf_map_sections_to_segments): Assume file and
program headers are required when info->load_phdrs.  Reorganize
code handling program headers.  Generate a mapping without
sections just for file and program headers when -z separate-code
would indicate they should be on a different page to the first
section.
ld/
* ldexp.c (fold_name <SIZEOF_HEADERS>): Set link_info.load_phdrs.
* testsuite/ld-elf/loadaddr1.d: Pass -z noseparate-code.
* testsuite/ld-elf/loadaddr2.d: Likewise.
* testsuite/ld-i386/vxworks2.sd: Adjust expected output.
* testsuite/ld-powerpc/vxworks2.sd: Likewise.
* testsuite/ld-elf/overlay.d: Remove spu xfail.
* testsuite/ld-spu/ovl.lnk: Don't use SIZEOF_HEADERS.
* testsuite/ld-tic6x/dsbt-be.ld: Likewise.
* testsuite/ld-tic6x/dsbt-inrange.ld: Likewise.
* testsuite/ld-tic6x/dsbt-overflow.ld: Likewise.
* testsuite/ld-tic6x/dsbt.ld: Likewise.

6 years agold insert_os_after ignoring first assignment
Alan Modra [Sun, 7 Oct 2018 22:14:50 +0000 (08:44 +1030)]
ld insert_os_after ignoring first assignment

Some time ago the pr19593 test was xfailed for alpha.  This turned out
to be the wrong course of action since the test exposed a bug in
orphan section placement.  On alpha, orphan sections were being
inserted before ". = SIZEOF_HEADERS" due to the test having two
assignments, and on alpha, an output section statement from
-Ttext-segment being passed to ld.

* ldlang.c (insert_os_after): Clear ignore_first on assignment to
dot, not any assignment.  Clear ignore_first on output section
statement contents too.
* testsuite/ld-elf/pr19539.d: Remove alpha xfail.

6 years agoUse p_vaddr_offset to set p_vaddr on segments without sections
Alan Modra [Sat, 6 Oct 2018 02:54:28 +0000 (12:24 +0930)]
Use p_vaddr_offset to set p_vaddr on segments without sections

p_vaddr is currently set from the first section vma if a segment has
sections, and to zero if a segment has no sections.  This means we
lose p_vaddr when objcopy'ing executables if a segment without
sections has a non-zero p_vaddr.

This patch saves p_vaddr to p_vaddr_offset, and to make the use of
p_vaddr_offset consistent, inverts the sign.  (It's now added to
section vma to get segment vaddr, and added to zero when there are no
sections.)

* elf.c (assign_file_positions_for_load_sections): Set p_vaddr
from m->p_vaddr_offset for segments without sections.  Invert
sign of p_vaddr_offset.
(rewrite_elf_program_header, copy_elf_program_header): Save
old segment p_vaddr to p_vaddr_offset.  Invert sign of
p_vaddr_offset.

6 years agoNo PT_INTERP when .interp is zero size
Alan Modra [Fri, 5 Oct 2018 14:35:51 +0000 (00:05 +0930)]
No PT_INTERP when .interp is zero size

Some targets don't set a default interpreter, resulting in an empty
.interp section unless --dynamic-linker is passed to ld.  A PT_INTERP
without a path is rather useless.

The testsuite change fixes a failure on microblaze-linux.

bfd/
* elf.c (get_program_header_size): Don't count PT_INTERP if
.interp is empty.
(_bfd_elf_map_sections_to_segments): Don't create PT_INTERP if
.interp is empty.
ld/
* testsuite/ld-elf/pr22423.d: Pass --dynamic-linker to ld.

6 years agoSPU overlay headers
Alan Modra [Fri, 5 Oct 2018 14:05:01 +0000 (23:35 +0930)]
SPU overlay headers

Overlay PT_LOAD headers are moved early for reasons explained by
comments in spu_elf_modify_segment_map.  This patch fixes cases that
shouldn't occur in sane SPU executables.

* elf32-spu.c (spu_elf_modify_segment_map): Don't insert
overlays before segment containing headers.

6 years agoTidy elf_segment_map allocation
Alan Modra [Fri, 5 Oct 2018 12:47:00 +0000 (22:17 +0930)]
Tidy elf_segment_map allocation

This cleans up elf_segment_map allocation when the section array is
empty.  "amt += (to - from - 1) * sizeof (asection *)", when "to" and
"from" are unsigned int results in an unsigned value inside the
parentheses.  When "to" and "from" are equal on a 64-bit host,
0xffffffff * 8 is added to "amt", not -8 as desired.

The patch also renames a variable for consistency with other functions
using a similar index.

* elf.c (make_mapping): Cope with zero size array at end of
struct elf_segment_map.
(_bfd_elf_map_sections_to_segments): Likewise.
(rewrite_elf_program_header, copy_elf_program_header): Likewise.
(_bfd_elf_map_sections_to_segments): Rename phdr_index to hdr_index.

6 years agoGDB: Work around buggy dwarf line information produced by Codewarrior Version 5.0...
John Darrington [Thu, 20 Sep 2018 17:52:07 +0000 (19:52 +0200)]
GDB: Work around buggy dwarf line information produced by Codewarrior Version 5.0.40 (build 15175).

gdb/ChangeLog:
* dwarf2read.c (dwarf2_cu) <producer_is_codewarrior>: New field.
  (check_producer): Check if the producer is codewarrior.
  (producer_is_codewarrior): New function.
  (lnp_state_machine::record_line): Ignore is_stmt flag for records
   produced by codewarrior.
  (dwarf2_cu::dwarf2_cu): Initialize producer_is_codewarrior.

6 years agoHandle R_RISCV_32_PCREL in readelf
Andreas Schwab [Thu, 4 Oct 2018 12:35:12 +0000 (14:35 +0200)]
Handle R_RISCV_32_PCREL in readelf

* readelf.c (is_32bit_pcrel_reloc): Handle R_RISCV_32_PCREL.

6 years agoPython doc build fixes
Andreas Krebbel [Mon, 8 Oct 2018 07:48:04 +0000 (09:48 +0200)]
Python doc build fixes

gdb/doc/ChangeLog:

2018-10-08  Andreas Krebbel  <krebbel@linux.ibm.com>

* python.texi (Inferior.Architecture): Add "@end defun". Rename
ref target to "Unwinding Frames in Python".

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 8 Oct 2018 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd Inferior.architecture method
Tom Tromey [Sun, 7 Oct 2018 04:57:19 +0000 (22:57 -0600)]
Add Inferior.architecture method

I've written a couple of gdb unwinders in Python, and while doing so,
I wanted to find the architecture of the inferior.  (In an unwinder in
particular, one can't use the frame's architecture, because there is
no frame.)

This patch adds Inferior.architecture to allow this.  Normally I think
I would have chosen an attribute and not a method here, but seeing
that Frame.architecture is a method, I chose a method as well, for
consistency.

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

PR python/19399:
* python/py-inferior.c: Add "architecture" entry.
(infpy_architecture): New function.

gdb/doc/ChangeLog
2018-10-06  Tom Tromey  <tom@tromey.com>

PR python/19399:
* python.texi (Inferiors In Python): Document
Inferior.Architecture.

gdb/testsuite/ChangeLog
2018-10-06  Tom Tromey  <tom@tromey.com>

PR python/19399:
* gdb.python/py-inferior.exp: Add architecture test.

6 years agoUpdate symbol domain and location values for Python
Tom Tromey [Sun, 7 Oct 2018 04:55:19 +0000 (22:55 -0600)]
Update symbol domain and location values for Python

In the distant past, there was no distinction between domain_enum and
search_domain.  At that point, there were two sets of enumerators in a
single enum -- which is why these were eventually split.  This
confusion leaked out to the Python API as well, as noted in
PR python/21765.

This patch deprecates the constants that aren't useful to the Python
API.  They are left in place for now, but removed from the
documentation.  Also, their values are changed so that, if used, they
might work.  Finally, missing domains and location constants are
added.

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

PR python/21765:
* python/py-symbol.c (gdbpy_initialize_symbols): Redefine
SYMBOL_VARIABLES_DOMAIN, SYMBOL_FUNCTIONS_DOMAIN,
SYMBOL_TYPES_DOMAIN.  Define SYMBOL_MODULE_DOMAIN,
SYMBOL_COMMON_BLOCK_DOMAIN, SYMBOL_LOC_COMMON_BLOCK.

gdb/doc/ChangeLog
2018-10-06  Tom Tromey  <tom@tromey.com>

PR python/21765:
* python.texi (Symbols In Python): Document the module and
common-block domains.  Remove documentation for incorrect
domains.

6 years agoUse standard_output_file in a couple more places
Tom Tromey [Fri, 28 Sep 2018 20:32:42 +0000 (14:32 -0600)]
Use standard_output_file in a couple more places

I noticed a few files left over in the testsuite/ directory in the
build tree after running tests.  Normally output files should not wind
up there, but instead should end up in the test's subdirectory.  This
isn't always crucial, but in the past there were problems with tests
clashing, preventing parallel runs, and so it is better to be clean
here.

This patch changes a couple of tests to use standard_output_file to
fix this problem.

Tested by re-running the tests in question and examining the
directory.

gdb/testsuite/ChangeLog
2018-10-06  Tom Tromey  <tom@tromey.com>

* gdb.base/gnu-ifunc.exp (build): Use standard_output_file.
* gdb.trace/unavailable-dwarf-piece.exp: Use standard_output_file.

6 years agoDo not accidentally include in-tree readline headers
Tom Tromey [Wed, 26 Sep 2018 12:54:17 +0000 (06:54 -0600)]
Do not accidentally include in-tree readline headers

PR build/17077 points out that when --with-system-readline is given,
gdb will still pick up the in-tree readline headers.  Normally this is
not a big problem, because readline is very stable and so the ABI does
not change much; but it is clearly a bug to do this, and could bite at
some point.

The basic problem is that OPCODES_CFLAGS uses -I$(OPCODES_SRC)/..  so
that #include "opcodes/..." works.  However, this also makes it so the

This patch fixes the problem in a mildly hacky way: remove the
offending -I option, and change gdb to use #include "../opcodes/..."
instead.  This continues to make it clear where the header comes from,
without allowing incorrect behavior.

Tested by rebuilding and then looking at the *.Po files.

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

PR build/17077:
* Makefile.in (OPCODES_CFLAGS): Remove "-I$(OPCODES_SRC)/..".
* arc-tdep.c, frv-tdep.c, lm32-tdep.c, mep-tdep.c,
microblaze-tdep.c, or1k-tdep.h: Use ../opcodes, not opcodes, in
#include.

6 years agoFix Python gdb.Breakpoint.location crash
Tom Tromey [Tue, 18 Sep 2018 12:27:09 +0000 (06:27 -0600)]
Fix Python gdb.Breakpoint.location crash

I noticed today that gdb.Breakpoint.location will crash when applied
to a catchpoint made with "catch throw".

The bug is that "catch throw" makes a breakpoint that is of type
bp_breakpoint, but which does not have a location.

Regression tested on x86-64 Fedora 28.

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

* python/py-breakpoint.c (bppy_get_location): Handle a
bp_breakpoint without a location.

gdb/testsuite/ChangeLog
2018-10-06  Tom Tromey  <tom@tromey.com>

* gdb.python/py-breakpoint.exp (check_last_event): Check location
of a "throw" catchpoint.

6 years agoUpdate help text for commands implemented in Python
Tom Tromey [Sun, 7 Oct 2018 04:01:42 +0000 (22:01 -0600)]
Update help text for commands implemented in Python

Philippe pointed out that the "enable frame-filter" help text looked
funny.

While fixing this I noticed a few more problems in the help text of
commands written in Python:

* Trailing newlines
* Wrong style for metasyntactic variables
* Indentation of the text
* ... and finally, I thought the function usage lines didn't need
  that extra newline -- someday I'd like to be able to write a
  "usage" command that just greps for the Usage line, so ideally it
  would be tighter than what was done here

This patch fixes all the problems I noticed.

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

* python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq)
(_RegEx): Reformat help text.
* python/lib/gdb/function/caller_is.py (CallerIs, CallerMatches)
(AnyCallerIs, AnyCallerMatches): Reformat help text.
* python/lib/gdb/function/as_string.py (_AsString): Reformat help
text.
* python/lib/gdb/command/xmethods.py (InfoXMethod)
(EnableXMethod, DisableXMethod): Remove help indentation.
Capitalize meta-syntactic variables.
* python/lib/gdb/command/unwinders.py (InfoUnwinder)
(EnableUnwinder, DisableUnwinder): Remove help indentation.
Capitalize meta-syntactic variables.
* python/lib/gdb/command/explore.py (ExploreCommand)
(ExploreValueCommand, ExploreTypeCommand): Reformat help text.
* python/lib/gdb/command/type_printers.py (InfoTypePrinter)
(EnableTypePrinter, DisableTypePrinter): Remove help indentation.
* python/lib/gdb/command/pretty_printers.py (InfoPrettyPrinter):
Remove help indentation.
(EnablePrettyPrinter, DisablePrettyPrinter): Likewise.
* python/lib/gdb/command/frame_filters.py (EnableFrameFilter)
(DisableFrameFilter, SetFrameFilterPriority)
(ShowFrameFilterPriority, InfoFrameFilter): Reword help text.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 7 Oct 2018 00:01:19 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoCall nonl before wgetch in TUI
Tom Tromey [Mon, 3 Sep 2018 21:23:48 +0000 (15:23 -0600)]
Call nonl before wgetch in TUI

PR tui/28819 points out that, in the TUI, the C-j and C-m keys cannot
be bound differently in one's ~/.inputrc.  However, this works in
other readline applications.

The bug is that the TUI uses curses' "nl" mode, which causes wgetch to
return the same value for both keys.  There is a "nonl" mode, but it
also affects output.

This patch fixes the bug by arranging to call nonl before reading a
key and then nl afterward.  This avoids any potential problem with
changing the output if gdb was to use nonl globally.

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

PR tui/28819:
* tui/tui-io.c (gdb_wgetch): New function.
(tui_mld_getc, tui_getc): Use it.

6 years agoUpdate string expected from "help info proc" on gdb.base/info-proc.exp
Sergio Durigan Junior [Sat, 6 Oct 2018 15:23:02 +0000 (11:23 -0400)]
Update string expected from "help info proc" on gdb.base/info-proc.exp

Commit 73f1bd769a5 ("Make the "info proc" documentation more
consistent.") updated the output from "help info proc", but forgot to
update the test on gdb.base/info-proc.exp.  This obvious patch does
that.

Checked-in as obvious.

gdb/testsuite/ChangeLog:
2018-10-06  Sergio Durigan Junior  <sergiodj@redhat.com>

* gdb.base/info-proc.exp: Update string expected from "help info
proc".

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 6 Oct 2018 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agox86: Add Intel ENCLV to assembler and disassembler
H.J. Lu [Fri, 5 Oct 2018 18:56:42 +0000 (11:56 -0700)]
x86: Add Intel ENCLV to assembler and disassembler

gas/

* testsuite/gas/i386/se1.s: Add enclv.
* testsuite/gas/i386/x86-64-se1.s: Likewise.
* testsuite/gas/i386/se1.d: Updated.
* testsuite/gas/i386/x86-64-se1.d: Likewise.

opcodes/

* i386-dis.c (rm_table): Add enclv.
* i386-opc.tbl: Add enclv.
* i386-tbl.h: Regenerated.

6 years agoFix -Wshadow=local warning in sol_thread_target::wait
Tom Tromey [Fri, 5 Oct 2018 13:28:16 +0000 (07:28 -0600)]
Fix -Wshadow=local warning in sol_thread_target::wait

Rainer pointed out that -Wshadow=local broke the Solaris build.
This fixes it.

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

* sol-thread.c (sol_thread_target::wait): Rename inner
"save_ptid".

6 years agoSet correct SHT_NOTE type for .note.spu_name
Alan Modra [Fri, 5 Oct 2018 10:22:55 +0000 (19:52 +0930)]
Set correct SHT_NOTE type for .note.spu_name

* elf32-spu.c (spu_elf_create_sections): Make .note.spu_name
SHT_NOTE.

6 years ago[Arm, 3/3] Add Execution and Data Prediction instructions for AArch32
Sudakshina Das [Fri, 5 Oct 2018 09:51:22 +0000 (10:51 +0100)]
[Arm, 3/3] Add Execution and Data Prediction instructions for AArch32

This patch is part of the patch series to add support for ARMv8.5-A
extensions.

(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)

This patch adds the Execution and Data Prediction Restriction
instructions (that is, cfprctx, dvprxtc, cpprctx). These are all
aliases to MCR and are disassembled as such.

This instruction is retrospectively made optional for all versions of
the architecture from ARMv8.0 to ARMv8.4 and is mandatory from
ARMv8.5.  Hence adding a new +predres for older versions of the
architecture.

*** include/ChangeLog ***

2018-10-05  Sudakshina Das  <sudi.das@arm.com>

* opcode/arm.h (ARM_EXT2_PREDRES): New.
(ARM_ARCH_V8_5A): Add ARM_EXT2_PREDRES by default.

*** gas/ChangeLog ***

2018-10-05  Sudakshina Das  <sudi.das@arm.com>

* config/tc-arm.c (arm_ext_predres): New.
(insns): Add new cfprctx, dvprctx and cpprctx instructions.
(arm_extensions): Add "predres".
* doc/c-arm.texi: Document the above.
* testsuite/gas/arm/predres-bad.d: New test.
* testsuite/gas/arm/predres-bad.l: New test.
* testsuite/gas/arm/predres.s: New test.
* testsuite/gas/arm/predres1.d: New test.
* testsuite/gas/arm/predres2.d: New test.

6 years ago[Arm, 2/3] Add instruction SB for AArch32
Sudakshina Das [Fri, 5 Oct 2018 09:49:53 +0000 (10:49 +0100)]
[Arm, 2/3] Add instruction SB for AArch32

This patch is part of the patch series to add support for ARMv8.5-A
extensions.

(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)

This patch adds the instruction SB. This instruction is
retrospectively made optional for all versions of the architecture
from ARMv8.0 to ARMv8.4 and is mandatory from ARMv8.5. Hence adding a
new "+sb" for older archtectures.

*** include/ChangeLog ***

2018-10-05  Sudakshina Das  <sudi.das@arm.com>

* opcode/arm.h (ARM_EXT2_SB): New.
(ARM_ARCH_V8_5A): Add ARM_EXT2_SB by default.

*** opcodes/ChangeLog ***

2018-10-05  Sudakshina Das  <sudi.das@arm.com>

* arm-dis.c (arm_opcodes): Add sb.
(thumb32_opcodes): Likewise.

*** gas/ChangeLog ***

2018-10-05  Sudakshina Das  <sudi.das@arm.com>

* config/tc-arm.c (arm_ext_sb): New.
(insns): Add new sb instruction.
(arm_extensions): Add "sb".
* doc/c-arm.texi: Document the above.
* testsuite/gas/arm/sb-bad.d: New test.
* testsuite/gas/arm/sb-bad.l: New test.
* testsuite/gas/arm/sb-thumb1.d: New test.
* testsuite/gas/arm/sb-thumb2.d: New test.
* testsuite/gas/arm/sb.s: New test.
* testsuite/gas/arm/sb1.d: New test.
* testsuite/gas/arm/sb2.d: New test.

6 years ago[Arm, 1/3] Add -march=armv8.5-a and related internal feature macros to AArch32
Sudakshina Das [Fri, 5 Oct 2018 09:47:29 +0000 (10:47 +0100)]
[Arm, 1/3] Add -march=armv8.5-a and related internal feature macros to AArch32

This patch is part of the patch series to add support for ARMv8.5-A
extensions.

(https://developer.arm.com/products/architecture/cpu-architecture/a-profile/exploration-tools)

This is the first of the patch series and adds -march=armv8.5-a and
other internal feature marcos needed for it.

*** gas/ChangeLog ***

2018-10-05  Sudakshina Das  <sudi.das@arm.com>

* config/tc-arm.c (arm_archs): New entry for armv8.5-a.
(cpu_arch_ver): Likewise.
* doc/c-arm.texi: Add documentation for the same.
* testsuite/gas/arm/attr-march-armv8_5-a.d: New.

*** include/ChnageLog ***

2018-10-05  Sudakshina Das  <sudi.das@arm.com>

* opcode/arm.h (ARM_EXT2_V8_5A): New.
(ARM_AEXT2_V8_5A, ARM_ARCH_V8_5A): New.

6 years agoAdd -Wshadow=local
Tom Tromey [Sat, 21 Apr 2018 22:09:10 +0000 (16:09 -0600)]
Add -Wshadow=local

This adds -Wshadow=local to configure.

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

* configure: Rebuild.
* warning.m4 (AM_GDB_WARNINGS): Add -Wshadow=local.

gdb/gdbserver/ChangeLog
2018-10-04  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.

6 years agoShadowing fix in gdbscm_frame_read_var
Tom Tromey [Sun, 22 Apr 2018 16:46:03 +0000 (10:46 -0600)]
Shadowing fix in gdbscm_frame_read_var

-Wshadow=local pointed out that the shadowing in gdbscm_frame_read_var
means that the ultimate call to read_var_value will always be passed
block==NULL.  The fix is to remove the inner declaration.

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

* guile/scm-frame.c (gdbscm_frame_read_var): Remove inner
declaration of "block".

6 years agoAvoid shadowing in fdwalk
Tom Tromey [Sun, 22 Apr 2018 16:11:32 +0000 (10:11 -0600)]
Avoid shadowing in fdwalk

-Wshadow=local caught this buglet.  fdwalk redeclares "result" in the
inner scope, meaning that this function will always return 0, even on
error.

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

* common/filestuff.c (fdwalk): Remove inner declaration of
"result".

6 years agoFix latent bug in msp430-tdep.c
Tom Tromey [Sun, 22 Apr 2018 04:42:00 +0000 (22:42 -0600)]
Fix latent bug in msp430-tdep.c

-Wshadow=local found this latent bug.  msp430-tdep.c does:

    const gdb_byte *arg_bits;
    {
      /* Aggregates of any size are passed by reference.  */
      gdb_byte struct_addr[4];
[...
      arg_bits = struct_addr;
    }
    ... use arg_bits

Here, arg_bits can point to an object that's gone out of scope.

The fix is to hoist the inner "struct_addr" buffer to an outer scope,
and rename it to avoid shadowing.

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

* msp430-tdep.c (msp430_push_dummy_call): Rename inner
"structs_addr" and hoist declaration.

6 years agoAvoid shadowing in linux-tdep.c
Tom Tromey [Sun, 22 Apr 2018 16:46:51 +0000 (10:46 -0600)]
Avoid shadowing in linux-tdep.c

This is one of the uglier changes to avoid local shadowing.  Because
obstack.h uses statement expressions, in some cases a nested obstack
call will result in shadowing.  Rather than try to fix obstack.h, this
patch simply works around the one instance of this problem.

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

* linux-tdep.c (linux_make_mappings_corefile_notes): Introduce new
variable "size".

6 years agoUse std::string in mdebugread.c
Tom Tromey [Sun, 22 Apr 2018 16:26:18 +0000 (10:26 -0600)]
Use std::string in mdebugread.c

This changes a couple of spots in mdebugread to use std::string rather
than manual management.  This is simpler, and also avoids shadowing by
renaming the variable in question.

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

* mdebugread.c (parse_partial_symbols): Use std::string.

6 years agoAvoid shadowing in gdbserver
Tom Tromey [Sun, 22 Apr 2018 16:50:27 +0000 (10:50 -0600)]
Avoid shadowing in gdbserver

This fixes a few instances of shadowing in gdbserver.  These are all
simple fixes.

gdb/gdbserver/ChangeLog
2018-10-04  Tom Tromey  <tom@tromey.com>

* server.c (handle_status): Rename inner "thread".
(process_serial_event): Declare "res" in 'm' case.
* linux-low.c (last_thread_of_process_p, find_lwp_pid)
(iterate_over_lwps): Rename inner "thread".
(linux_qxfer_libraries_svr4): Rename inner "len".
* gdbthread.h (find_thread_in_random): Rename inner "thread".

6 years agoSimple -Wshadow=local fixes
Tom Tromey [Sat, 21 Apr 2018 22:16:27 +0000 (16:16 -0600)]
Simple -Wshadow=local fixes

This fixes all the straightforward -Wshadow=local warnings in gdb.  A
few standard approaches are used here:

* Renaming an inner (or outer, but more commonly inner) variable;
* Lowering a declaration to avoid a clash;
* Moving a declaration into a more inner scope to avoid a clash,
  including the special case of moving a declaration into a loop header.

I did not consider any of the changes in this patch to be particularly
noteworthy, though of course they should all still be examined.

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

* ctf.c (SET_ARRAY_FIELD): Rename "u32".
* p-valprint.c (pascal_val_print): Split inner "i" variable.
* xtensa-tdep.c (xtensa_push_dummy_call): Declare "i" in loop
header.
* xstormy16-tdep.c (xstormy16_push_dummy_call): Declare "val" in
more inner scope.
* xcoffread.c (read_xcoff_symtab): Rename inner "symbol".
* varobj.c (varobj_update): Rename inner "newobj",
"type_changed".
* valprint.c (generic_emit_char): Rename inner "buf".
* valops.c (find_overload_match): Rename inner "temp".
(value_struct_elt_for_reference): Declare "v" in more inner
scope.
* v850-tdep.c (v850_push_dummy_call): Rename "len".
* unittests/array-view-selftests.c (run_tests): Rename inner
"vec".
* tui/tui-stack.c (tui_show_frame_info): Declare "i" in loop
header.
* tracepoint.c (merge_uploaded_trace_state_variables): Declare
"tsv" in more inner scope.
(print_one_static_tracepoint_marker): Rename inner
"tuple_emitter".
* tic6x-tdep.c (tic6x_analyze_prologue): Declare "inst" lower.
(tic6x_push_dummy_call): Don't redeclare "addr".
* target-float.c: Declare "dto" lower.
* symtab.c (lookup_local_symbol): Rename inner "sym".
(find_pc_sect_line): Rename inner "pc".
* stack.c (print_frame): Don't redeclare "gdbarch".
(return_command): Rename inner "gdbarch".
* s390-tdep.c (s390_prologue_frame_unwind_cache): Renam inner
"sp".
* rust-lang.c (rust_internal_print_type): Declare "i" in loop
header.
* rs6000-tdep.c (ppc_process_record): Rename inner "addr".
* riscv-tdep.c (riscv_push_dummy_call): Declare "info" in inner
scope.
* remote.c (remote_target::update_thread_list): Don't redeclare
"tp".
(remote_target::process_initial_stop_replies): Rename inner
"thread".
(remote_target::remote_parse_stop_reply): Don't redeclare "p".
(remote_target::wait_as): Don't redeclare "stop_reply".
(remote_target::get_thread_local_address): Rename inner
"result".
(remote_target::get_tib_address): Likewise.

6 years agoFix undefined behavior, don't pass NULL to fwrite
Simon Marchi [Fri, 5 Oct 2018 02:43:27 +0000 (22:43 -0400)]
Fix undefined behavior, don't pass NULL to fwrite

If a vector that we try to write using file_write is empty, we may end
up passing NULL to fwrite, which triggers UBSan:

  .../gdb/dwarf-index-write.c:73:14: runtime error: null pointer passed as argument 1, which is declared to never be null

Avoid it by skipping the write if the vector is empty.

gdb/ChangeLog:

* dwarf-index-write.c (file_write): Don't write if the vector is
empty.

6 years agoor1k: Add OpenRISC gas documentation
Stafford Horne [Fri, 5 Oct 2018 02:41:42 +0000 (11:41 +0900)]
or1k: Add OpenRISC gas documentation

gas/ChangeLog:

yyyy-mm-dd  Stafford Horne  <shorne@gmail.com>

* doc/Makefile.am (CPU_DOCS): Add entry for OpenRISC.
* doc/Makefile.in: Regenerated.
* doc/all.texi: Set OPENRISC.
* doc/as.texi: Document OpenRISC.
* doc/c-or1k.texi: New file.