binutils-gdb.git
6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 20 Jul 2018 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoEliminate remaining gdb/guile cleanups
Pedro Alves [Thu, 19 Jul 2018 15:34:55 +0000 (16:34 +0100)]
Eliminate remaining gdb/guile cleanups

The remaining gdb/guile cleanups all handle the memory returned by
gdbscm_scm_to_c_string.

This commit makes gdbscm_scm_to_c_string return a
gdb::unique_xmalloc_ptr instead of a naked pointer, and eliminates the
remaining cleanups.

gdb/ChangeLog:
2018-07-19  Pedro Alves  <palves@redhat.com>

* guile/guile-internal.h (gdbscm_scm_to_c_string): Now returns a
gdb::unique_xmalloc_ptr.
* guile/scm-breakpoint.c (gdbscm_set_breakpoint_condition_x):
Adjust to use dbscm_wrap and gdb::unique_xmalloc_ptr.
* guile/scm-exception.c (gdbscm_exception_message_to_string): Use
copy-initialization.
* guile/scm-pretty-print.c (ppscm_print_children): Use
gdb::unique_xmalloc_ptr instead of cleanups.
(gdbscm_apply_val_pretty_printer): Remove cleanups.
* guile/scm-string.c (gdbscm_scm_to_c_string): Now returns a
gdb::unique_xmalloc_ptr.
* guile/scm-type.c (gdbscm_type_field, gdbscm_type_has_field_p):
Adjust to use gdb::unique_xmalloc_ptr.
* guile/scm-utils.c (extract_arg): Adjust.
* guile/scm-value.c (gdbscm_value_field): Adjust to use
gdb::unique_xmalloc_ptr instead of a cleanup.

6 years agoRemove make_cleanup_value_free_to_mark
Tom Tromey [Thu, 19 Jul 2018 14:49:58 +0000 (08:49 -0600)]
Remove make_cleanup_value_free_to_mark

Pedro's patch to introduce gdbscm_wrap removed the last caller of
make_cleanup_value_free_to_mark.  This patch removes this function.

I'm checking this in as obvious.  Tested by rebuilding, and by
grepping.

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

* utils.c (do_value_free_to_mark)
(make_cleanup_value_free_to_mark): Remove.
* utils.h (make_cleanup_value_free_to_mark): Remove.

6 years ago[gdb/testsuite] Fix regexp in list-thread-groups-available.exp
Tom de Vries [Thu, 19 Jul 2018 14:24:16 +0000 (16:24 +0200)]
[gdb/testsuite] Fix regexp in list-thread-groups-available.exp

I ran into a gdb.mi/list-thread-groups-available.exp failure:
...
Running gdb/testsuite/gdb.mi/list-thread-groups-available.exp ...
FAIL: gdb.mi/list-thread-groups-available.exp:
        list available thread groups (unexpected output)
PASS: gdb.mi/list-thread-groups-available.exp:
        list available thread groups with filter
...
When doing an experiment of running it 100 times in a row, the failure
reproduced 3 times.

Analyzing the original failure led to insufficient quoting of square brackets
in a regexp.  This patch fixes the regexp, which resulted in 0 failures in a
100-in-a-row run.

Tested on x86_64-linux.

2018-07-19  Tom de Vries  <tdevries@suse.de>

* gdb.mi/list-thread-groups-available.exp (cores_re): Fix quoting in
regular expression.

6 years agoFix GDB build using mingw.org's MinGW
Eli Zaretskii [Thu, 19 Jul 2018 13:54:06 +0000 (16:54 +0300)]
Fix GDB build using mingw.org's MinGW

libiberty/
2018-07-18  Eli Zaretskii  <eliz@gnu.org>

PR gdb/23434
* libiberty/simple-object-elf.c (ENOTSUP): If not defined by
        errno.h, redirect ENOTSUP to ENOSYS.

6 years agoStop potential memory leaks in dwarf CIE reader.
Nick Clifton [Thu, 19 Jul 2018 13:23:31 +0000 (14:23 +0100)]
Stop potential memory leaks in dwarf CIE reader.

* dwarf.c (read_cie): Free allocated memory before returning with
a failure result.

6 years agogdbscm_wrap, really forward args
Pedro Alves [Thu, 19 Jul 2018 09:56:47 +0000 (10:56 +0100)]
gdbscm_wrap, really forward args

Commit 557e56be2648 ("Eliminate most remaining cleanups under
gdb/guile/") missed adding the && to Args to really forward the
arguments properly.  Noticed by inspection.

gdb/ChangeLog:
2018-07-19  Pedro Alves  <palves@redhat.com>

* guile/guile-internal.h (gdbscm_wrap): Really make 'args' a
forwarding reference.

6 years agoS/390: Set the htm flag on PPA
Andreas Krebbel [Thu, 19 Jul 2018 08:00:51 +0000 (10:00 +0200)]
S/390: Set the htm flag on PPA

The PPA instruction will be emitted by GCC transactional execution
builtins so it needs to be accepted with just -mhtm and without
-march=zEC12.

opcodes/ChangeLog:

2018-07-19  Andreas Krebbel  <krebbel@linux.ibm.com>

* s390-opc.txt (PPA): Add the htm flag.

6 years agox86: fold narrowing VCVT* templates
Jan Beulich [Thu, 19 Jul 2018 06:36:19 +0000 (08:36 +0200)]
x86: fold narrowing VCVT* templates

When multiple (here: two) forms of an insn take different width inputs
but produce identical size outputs (here: RegXMM), the templates can be
combined.

Also drop IgnoreSize (and the now redundant size specifiers) wherever
applicable.

6 years agox86: fold VFPCLASSP{D,S} templates
Jan Beulich [Thu, 19 Jul 2018 06:35:38 +0000 (08:35 +0200)]
x86: fold VFPCLASSP{D,S} templates

These are special because they may not have a register operand to derive
the vector length from, which requires to also deal with the braodcast
case when determining vector length in build_evex_prefix().

Also drop IgnoreSize (and the now redundant size specifiers) from their
suffixed counterparts.

6 years agox86: fold various AVX512* templates
Jan Beulich [Thu, 19 Jul 2018 06:34:45 +0000 (08:34 +0200)]
x86: fold various AVX512* templates

6 years agox86: fold various AVX512DQ templates
Jan Beulich [Thu, 19 Jul 2018 06:34:01 +0000 (08:34 +0200)]
x86: fold various AVX512DQ templates

6 years agox86: fold various AVX512BW templates
Jan Beulich [Thu, 19 Jul 2018 06:32:17 +0000 (08:32 +0200)]
x86: fold various AVX512BW templates

6 years agox86: fold various AVX512CD templates
Jan Beulich [Thu, 19 Jul 2018 06:31:24 +0000 (08:31 +0200)]
x86: fold various AVX512CD templates

6 years agox86: fold various AVX512VL templates into their AVX512F counterparts
Jan Beulich [Thu, 19 Jul 2018 06:29:35 +0000 (08:29 +0200)]
x86: fold various AVX512VL templates into their AVX512F counterparts

6 years agox86: pre-process opcodes table before parsing
Jan Beulich [Thu, 19 Jul 2018 06:28:29 +0000 (08:28 +0200)]
x86: pre-process opcodes table before parsing

Instead of expanding macro-like constructs in i386-gen, have the C pre-
processor do this for us. Besides being a prerequisite for the next
template folding steps, this also paves the way for removing various
hidden dependencies between #define-s in i386-opc.h and plain literal
numbers used in i386-opc.tbl.

The #undef of None is solely to leave the generated i386-tbl.h entirely
unchanged.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 19 Jul 2018 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoEliminate cleanup in gdbscm_execute_gdb_command
Pedro Alves [Wed, 18 Jul 2018 22:41:06 +0000 (23:41 +0100)]
Eliminate cleanup in gdbscm_execute_gdb_command

Note: the "may be modified" comment is no longer true nowadays.

gdb/ChangeLog:
2018-07-18  Pedro Alves  <palves@redhat.com>

* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
gdbscm_wrap.  Use gdb::unique_xmalloc_ptr<char> instead of a
cleanup.

6 years agoEliminate most remaining cleanups under gdb/guile/
Pedro Alves [Wed, 18 Jul 2018 21:55:59 +0000 (22:55 +0100)]
Eliminate most remaining cleanups under gdb/guile/

The main complication with the Guile code is that we have two types of
exceptions to consider.  GDB/C++ exceptions, and Guile/SJLJ
exceptions.  Code that is facing the Guile interpreter must not throw
GDB exceptions, instead Scheme exceptions must be thrown.  Also,
because Guile exceptions are SJLJ based, Guile-facing code must not
use local objects with dtors, unless wrapped in a scope with a
TRY/CATCH, because the dtors won't otherwise be run when a Guile
exceptions is thrown.

This commit adds a new gdbscm_wrap wrapper function than encapsulates
a pattern I noticed in many of the functions using
GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS.  The wrapper is written
such that you can pass either a lambda to it, or a function plus a
variable number of forwarded args.  I used a lambda when its body
would be reasonably short, and a separate function in the larger
cases.

This also convers a few functions that were using
GDBSCM_HANDLE_GDB_EXCEPTION to use gdbscm_wrap too because they
followed a similar pattern.

A few cases of make_cleanup calls are replaced with explicit xfree
calls.  The make_cleanup/do_cleanups calls in those cases are
pointless, because do_cleanups won't be called when a Scheme exception
is thrown.

We also have a couple cases of Guile-facing code using RAII-type
objects to manage memory, but those are incorrect, exactly because
their dtor won't be called if a Guile exception is thrown.

gdb/ChangeLog:
2018-07-18  Pedro Alves  <palves@redhat.com>

* guile/guile-internal.h: Add comment about mixing GDB and Scheme
exceptions.
(GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS): Delete.
(gdbscm_wrap): New.
* guile/scm-frame.c (gdbscm_frame_read_register): Use xfree
directly instead of a cleanup.
* guile/scm-math.c (vlscm_unop_gdbthrow): New, factored out from ...
(vlscm_unop): ... this.  Reimplement using gdbscm_wrap.
(vlscm_binop_gdbthrow): New, factored out from ...
(vlscm_binop): ... this.  Reimplement using gdbscm_wrap.
(vlscm_rich_compare): Use gdbscm_wrap.
* guile/scm-symbol.c (gdbscm_lookup_symbol): Use xfree directly
instead of a cleanup.
(gdbscm_lookup_global_symbol): Use xfree directly instead of a
cleanup.
* guile/scm-type.c (gdbscm_type_field, gdbscm_type_has_field_p):
Use xfree directly instead of a cleanup.
* guile/scm-value.c (gdbscm_make_value, gdbscm_make_lazy_value):
Adjust to use gdbscm_wrap and scoped_value_mark.
(gdbscm_value_optimized_out_p): Adjust to use gdbscm_wrap.
(gdbscm_value_address, gdbscm_value_dereference)
(gdbscm_value_referenced_value): Adjust to use gdbscm_wrap and
scoped_value_mark.
(gdbscm_value_dynamic_type): Use scoped_value_mark.
(vlscm_do_cast, gdbscm_value_field): Adjust to use gdbscm_wrap and
scoped_value_mark.
(gdbscm_value_subscript, gdbscm_value_call): Adjust to use
gdbscm_wrap and scoped_value_mark.
(gdbscm_value_to_string): Use xfree directly instead of a
cleanup.  Move 'buffer' unique_ptr to TRY scope.
(gdbscm_value_to_lazy_string): Use xfree directly instead of a
cleanup.  Move 'buffer' unique_ptr to TRY scope.  Use
scoped_value_mark.
(gdbscm_value_fetch_lazy_x): Use gdbscm_wrap.
(gdbscm_parse_and_eval): Adjust to use gdbscm_wrap and
scoped_value_mark.
(gdbscm_history_ref, gdbscm_history_append_x): Adjust to use
gdbscm_wrap.

6 years ago[gdb/exp] Fix printing of type of optimized out vla
Tom de Vries [Tue, 3 Jul 2018 09:06:45 +0000 (11:06 +0200)]
[gdb/exp] Fix printing of type of optimized out vla

Consider this snippet from gcc/testsuite/gcc.dg/guality/vla-1.c:
...
int __attribute__((noinline))
f1 (int i)
{
  char a[i + 1];
  a[0] = 5;             /* { dg-final { gdb-test .+1 "i" "5" } } */
  return a[0];          /* { dg-final { gdb-test . "sizeof (a)" "6" } } */
}
...

When we compile the test-case with -O1 -g, and query the size of optimized
out vla 'a', we get:
...
$ ./gdb -batch -ex "b f1" -ex "r" -ex "p sizeof (a)" vla-1.exe
Breakpoint 1 at 0x4004a8: file vla-1.c, line 17.

Breakpoint 1, f1 (i=i@entry=5) at vla-1.c:17
17        return a[0];
$1 = 0
...
while we expect a size of '6'.

The problem is that default_read_var_value does not resolve the dynamic type
of a variable if the variable is optimized out.

This patch fixes that, and consequently gdb prints '6', as expected.

Tested on x86_64-linux.

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

* findvar.c (default_read_var_value): Also resolve dynamic type for
LOC_OPTIMIZED_OUT vars.

* gdb.base/vla-optimized-out.c: New test.
* gdb.base/vla-optimized-out.exp: New file.

6 years agomicroMIPS: Add SYSCALL instruction decoding
Maciej W. Rozycki [Wed, 18 Jul 2018 18:17:39 +0000 (19:17 +0100)]
microMIPS: Add SYSCALL instruction decoding

Fix a bug with commit 4cc0665f24bb ("microMIPS support"),
<https://sourceware.org/ml/gdb-patches/2012-05/msg00724.html>, and add
missing microMIPS SYSCALL instruction decoding needed to determine the
location to put a breakpoint at when single-stepping though a syscall.

gdb/
* mips-tdep.c (micromips_next_pc): Add SYSCALL instruction
decoding.

6 years agoBFD/XCOFF: Fix storage class setting for weak defined symbols
Maciej W. Rozycki [Wed, 18 Jul 2018 16:51:54 +0000 (17:51 +0100)]
BFD/XCOFF: Fix storage class setting for weak defined symbols

Fix an issue with commit 8602d4fea60d ("Add AIX weak support"),
<https://sourceware.org/ml/binutils/2009-03/msg00189.html>, and use the
correct condition to set the storage class for weak defined symbols.

The context here is as follows:

  else if ((h->root.type == bfd_link_hash_defined
            || h->root.type == bfd_link_hash_defweak)
           && h->smclas == XMC_XO)
    {
      BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section));
      isym.n_value = h->root.u.def.value;
      isym.n_scnum = N_UNDEF;
      if (h->root.type == bfd_link_hash_undefweak
          && C_WEAKEXT == C_AIX_WEAKEXT)
        isym.n_sclass = C_WEAKEXT;
      else
        isym.n_sclass = C_EXT;
      aux.x_csect.x_smtyp = XTY_ER;
    }

so clearly the inner condition can never be true.  Correct the condition
then to check for the `bfd_link_hash_defweak' symbol type instead here,
and in a similar place a little further down in the same function.

bfd/
* xcofflink.c (xcoff_write_global_symbol): Fix symbol type
checks for defined weak symbols.

6 years agoMIPS/GAS/testsuite: Correct whitespace issues with Loongson tests
Maciej W. Rozycki [Wed, 18 Jul 2018 13:08:37 +0000 (14:08 +0100)]
MIPS/GAS/testsuite: Correct whitespace issues with Loongson tests

Remove CR characters, trailing whitespace and space characters appearing
immediately before a tab character, and replace spaces with tabs, all
across Loongson GAS tests.

gas/
* testsuite/gas/mips/loongson-2e.d: Correct whitespace issues.
* testsuite/gas/mips/loongson-2f.d: Likewise.
* testsuite/gas/mips/loongson-2f-2.d: Likewise.
* testsuite/gas/mips/loongson-2f-3.d: Likewise.
* testsuite/gas/mips/loongson-3a.d: Likewise.
* testsuite/gas/mips/loongson-3a-2.d: Likewise.
* testsuite/gas/mips/loongson-2e.s: Likewise.
* testsuite/gas/mips/loongson-2f.s: Likewise.
* testsuite/gas/mips/loongson-2f-3.s: Likewise.
* testsuite/gas/mips/loongson-3a.s: Likewise.
* testsuite/gas/mips/loongson-3a-2.s: Likewise.

6 years agox86: Split vcvtps2{,u}qq and vcvttps2{,u}qq
H.J. Lu [Wed, 18 Jul 2018 12:33:36 +0000 (05:33 -0700)]
x86: Split vcvtps2{,u}qq and vcvttps2{,u}qq

After

commit 1b54b8d7e4fc8055f9220a5287e8a94d8a65a88d
Author: Jan Beulich <jbeulich@novell.com>
Date:   Mon Dec 18 09:36:14 2017 +0100

    x86: fold RegXMM/RegYMM/RegZMM into RegSIMD

    ... qualified by their respective sizes, allowing to drop FirstXmm0 at
    the same time.

folded RegXMM, RegYMM and RegZMM into RegSIMD, it's no longer impossible
to distinguish if Xmmword can represent a memory reference when operand
specification contains SIMD register. For example, template operands
specification like these

RegXMM|...|Xmmword|...

and

RegXMM|...

The Xmmword bitfield is always set by RegXMM which is represented by
"RegSIMD|Xmmword".  This patch splits each of vcvtps2qq, vcvtps2uqq,
vcvttps2qq and vcvttps2uqq into 2 templates: one template only has
RegXMM source operand and the other only has mempry source operand.

gas/

PR gas/23418
* testsuite/gas/i386/xmmword.s: Add tests for vcvtps2qq,
vcvtps2uqq, vcvttps2qq and vcvttps2uqq.
* testsuite/gas/i386/xmmword.l: Updated.

opcodes/

PR gas/23418
* i386-opc.h (Byte): Update comments.
(Word): Likewise.
(Dword): Likewise.
(Fword): Likewise.
(Qword): Likewise.
(Tbyte): Likewise.
(Xmmword): Likewise.
(Ymmword): Likewise.
(Zmmword): Likewise.
* i386-opc.tbl: Split vcvtps2qq, vcvtps2uqq, vcvttps2qq and
vcvttps2uqq.
* i386-tbl.h: Regenerated.

6 years agoS/390: Improve partial relro support for 64 bit
Andreas Krebbel [Thu, 21 Dec 2017 12:12:03 +0000 (13:12 +0100)]
S/390: Improve partial relro support for 64 bit

Currently on S/390 the .got.plt always comes first which prevents the
GNU_RELRO segment from being extended across the non-plt GOT entries.

Just swapping both unfortunately is not that simple since our ABI
requires the _GLOBAL_OFFSET_TABLE_ symbol to point to the very
beginning of the entire GOT. Of the 3 magic GOT entries the first is
accessed via got pointer while second and third are being accessed via
DT_PLTGOT.  In order to keep them together we make DT_PLTGOT to point
to the .got instead of .got.plt.  However, this violates an assumption
in the dynamic linker prelink undo code about the GOTPLT entries
starting at DT_PLTGOT + 3.  We got rid of this requirement with a
Glibc patch already in version 2.24:
https://sourceware.org/ml/libc-alpha/2016-06/msg01302.html

So the S/390 relro GOT layout will look like this with this patch:

      +----------------------------------+
      |got[0]: DYNAMIC                   |   <--- _GLOBAL_OFFSET_TABLE_ == DT_PLTGOT .got
      |got[1]: link_map parm             |
      |got[2]: &_dl_runtime_resolve      |
      +----------------------------------+
      |                                  |   non-plt GOT entries
      |                                  |
      |                                  |
      +----------------------------------+
      |                                  |   <--- .gotplt, PLT GOT entries
      |                                  |
      |                                  |
      |                                  |
      +----------------------------------+

The patch detects the current layout in size_dynamic_section in order
to deal also with linker scripts not generated by this ld version.
With partial relro enabled we pick a linker script where .got and
.got.plt are swapped which then triggers the rest of the logic.

ld/ChangeLog:

2018-07-18  Andreas Krebbel  <krebbel@linux.ibm.com>

* emulparams/elf64_s390.sh: Define GENERATE_RELRO_SCRIPT and
SEPARATE_GOTPLT.
* testsuite/ld-s390/gotreloc_64-relro-1.dd: New test.
* testsuite/ld-s390/gotreloc_64-norelro-1.dd: Renamed from ...
* testsuite/ld-s390/gotreloc_64-1.dd: ... this.
* testsuite/ld-s390/s390.exp: Split the GOT testcase into two.

bfd/ChangeLog:

2018-07-18  Andreas Krebbel  <krebbel@linux.ibm.com>

* elf-s390-common.c (s390_gotplt_after_got_p): New function.
(s390_got_pointer): New function.
(s390_got_offset): New function.
(s390_gotplt_offset): New function.
* elf64-s390.c (allocate_dynrelocs): Adjust comment.
(elf_s390_size_dynamic_sections): Move space for magic GOT entries
from .got.plt to .got if necessary and pick the right location for
_GLOBAL_OFFSET_TABLE_.
(elf_s390_relocate_section): Use the wrapper functions from
elf-s390-common.c to deal with both possible layouts (either .got
or .got.plt first).
(elf_s390_finish_dynamic_sections): Likewise.
(elf_s390_finish_dynamic_symbol): Make the location of the GOT
magic entries conditional.

6 years agold: Enable using separate linker script for -z relro
Andreas Krebbel [Mon, 11 Jun 2018 11:23:00 +0000 (13:23 +0200)]
ld: Enable using separate linker script for -z relro

With this patch dedicated linker scripts can be generated for partial
relro triggered by defining GENERATE_RELRO_SCRIPT in the target
specific scripts.

This is necessary for e.g. S/390 where usually the .got.plt comes
first and prevents the relro segment from being extended across the
non-plt GOT entries.

The patch started with the work from Marcin taken from the mwk user
branches.  However, the patch needed substantial changes due to the
'separate code' feature which got committed in the meantime.

ld/ChangeLog:

2018-07-18  Andreas Krebbel  <krebbel@linux.ibm.com>
    Marcin Koƛcielnicki <koriakin@0x04.net>

* emultempl/elf32.em: Add code to pick dedicated linker scripts
for partial relro.
* genscripts.sh: Generate dedicated linker scripts for partial relro.

6 years agoUpdated French translation for gold and Spanish translation for ld.
Nick Clifton [Wed, 18 Jul 2018 07:37:38 +0000 (08:37 +0100)]
Updated French translation for gold and Spanish translation for ld.

ld * po/es.po: Updated Spanish translation.
gold * po/fr.po: Updated French translation.

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

6 years agoReturn unique_xmalloc_ptr from gdbscm_scm_to_string
Tom Tromey [Sun, 27 May 2018 05:34:02 +0000 (23:34 -0600)]
Return unique_xmalloc_ptr from gdbscm_scm_to_string

This changes gdbscm_scm_to_string to return a unique_xmalloc_ptr and
then fixes all the callers.  This allows for the removal of some
cleanups.

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

* guile/scm-param.c (pascm_set_func, pascm_show_func)
(compute_enum_list, pascm_set_param_value_x)
(gdbscm_parameter_value): Update.
* guile/guile-internal.h (gdbscm_scm_to_string): Update.
(gdbscm_scm_to_host_string): Update.
* guile/scm-math.c (vlscm_convert_typed_value_from_scheme):
Update.
* guile/scm-cmd.c (cmdscm_add_completion): Update.
* guile/scm-pretty-print.c (ppscm_print_string_repr): Update.
* guile/scm-string.c (gdbscm_scm_to_string): Return
unique_xmalloc_ptr.
(gdbscm_scm_to_host_string): Likewise.

6 years agoReturn unique_xmalloc_ptr from gdbscm_safe_eval_string
Tom Tromey [Sun, 27 May 2018 05:26:39 +0000 (23:26 -0600)]
Return unique_xmalloc_ptr from gdbscm_safe_eval_string

This changes gdbscm_safe_eval_string to return a unique_xmalloc_ptr.
This allows for the removal of some cleanups.  It also fixes a
potential latent memory leak in gdbscm_set_backtrace.

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

* guile/guile.c (gdbscm_eval_from_control_command): Update.
* guile/guile-internal.h (gdbscm_safe_eval_string): Update.
* guile/scm-objfile.c (gdbscm_execute_objfile_script): Update.
* guile/scm-safe-call.c (gdbscm_safe_eval_string): Return
unique_xmalloc_ptr.

6 years agoChange gdbscm_exception_message_to_string to return a unique_xmalloc_ptr
Tom Tromey [Sun, 27 May 2018 05:21:23 +0000 (23:21 -0600)]
Change gdbscm_exception_message_to_string to return a unique_xmalloc_ptr

This changes gdbscm_exception_message_to_string to return a
unique_xmalloc_ptr, allowing for the removal of some cleanups.
unique_xmalloc_ptr was chosen because at the root of the call chains
is a function from Guile that returns a malloc'd string.

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

* guile/scm-param.c (pascm_signal_setshow_error): Update.
* guile/guile-internal.h (gdbscm_exception_message_to_string):
Update.
* guile/scm-cmd.c (cmdscm_function): Update.
* guile/scm-pretty-print.c
(ppscm_print_exception_unless_memory_error): Update.
* guile/scm-exception.c (gdbscm_exception_message_to_string):
Return unique_xmalloc_ptr.

6 years agoUse std::string in ppscm_make_pp_type_error_exception
Tom Tromey [Sun, 27 May 2018 05:16:13 +0000 (23:16 -0600)]
Use std::string in ppscm_make_pp_type_error_exception

This changes ppscm_make_pp_type_error_exception to use std::string,
removing a cleanup.

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

* guile/scm-pretty-print.c (ppscm_make_pp_type_error_exception):
Use string_printf.

6 years agoBFD: Use `bfd_is_abs_symbol' to determine whether a symbol is absolute
Maciej W. Rozycki [Tue, 17 Jul 2018 19:04:53 +0000 (20:04 +0100)]
BFD: Use `bfd_is_abs_symbol' to determine whether a symbol is absolute

Use `bfd_is_abs_symbol' to determine whether a symbol is absolute,
avoiding a problem with ordinary symbols defined in a linker script
outside an output section definition.  Such symbols have its owning
section set to the absolute section up to the final link phase.  A flag
has been added to the link hash to identify such symbols.  Rather than
checking the flag by hand, use the macro that does it uniformly for all
users.

bfd/
* elf32-nds32.c (nds32_elf_relax_loadstore): Use
`bfd_is_abs_symbol' rather than `bfd_is_abs_section' in checking
whether the symbol is absolute.
(nds32_elf_relax_lo12): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
(elfNN_aarch64_check_relocs): Likewise.
* xcofflink.c (xcoff_need_ldrel_p): Likewise.
(bfd_xcoff_import_symbol): Likewise.
(xcoff_write_global_symbol): Likewise.

6 years agoLD: Export relative-from-absolute symbol marking to BFD
Maciej W. Rozycki [Tue, 17 Jul 2018 19:04:53 +0000 (20:04 +0100)]
LD: Export relative-from-absolute symbol marking to BFD

It is usually possible to tell absolute and ordinary symbols apart in
BFD throughout the link, by checking whether the section that owns the
symbol is absolute or not.

That however does not work for ordinary symbols defined in a linker
script outside an output section statement.  Initially such symbols are
entered into to the link hash as absolute symbols, owned by the absolute
section.  A flag is set in the internal linker expression defining such
symbols to tell the linker to convert them to section-relative ones in
the final phase of the link.  That flag is however not accessible to BFD
linker code, including BFD target code in particular.

Add a flag to the link hash then to copy the information held in the
linker expression.  Define a macro, `bfd_is_abs_symbol', for BFD code to
use where determining whether a symbol is absolute or ordinary is
required before the final link phase.

This macro will correctly identify the special `__ehdr_start' symbol as
ordinary throughout link, for example, even though early on it will be
assigned to the absolute section.  Of course this does not let BFD code
identify what the symbol's ultimate section will be before the final
link phase has converted this symbol (in `update_definedness').

include/
* bfdlink.h (bfd_link_hash_entry): Add `rel_from_abs' member.

bfd/
* linker.c (bfd_is_abs_symbol): New macro.
* bfd-in2.h: Regenerate.

ld/
* ldexp.c (exp_fold_tree_1) <etree_assign, etree_provide>
<etree_provided>: Copy expression's `rel_from_abs' flag to the
link hash.

6 years agoRISC-V: Don't decrement pc after break.
Jim Wilson [Tue, 17 Jul 2018 16:44:42 +0000 (09:44 -0700)]
RISC-V: Don't decrement pc after break.

gdb/
* riscv-tdep.c (riscv_has_feature): Delete comment that refers to
set_gdbarch_decr_pc_after_break.  Call riscv_read_misa_reg always.
(riscv_gdbarch_init): Delete local has_compressed_isa.  Delete now
unecessary braces after EF_RISCV_RVC test.  Delete call to
set_gdbarch_decr_pc_after_break.

6 years agoRISC-V: Correct legacy misa register number.
Jim Wilson [Tue, 17 Jul 2018 16:42:23 +0000 (09:42 -0700)]
RISC-V: Correct legacy misa register number.

gdb/
* riscv-tdep.h (DECLARE_CSR): Use RISCV_FIRST_CSR_REGNUM instead of
RISCV_LAST_FP_REGNUM + 1.
(RSICV_CSR_LEGACY_MISA_REGNUM): Add RISCV_FIRST_CSR_REGNUM.

6 years agoRemove --disable-gdbcli
Tom Tromey [Thu, 28 Jun 2018 17:19:33 +0000 (11:19 -0600)]
Remove --disable-gdbcli

I think it doesn't really make sense to allow building gdb without the
CLI.  Perhaps at one time this was a goal, but libgdb is long gone and
the CLI is intrinsic to gdb.

So, this patch removes the implementation of this configure option.
It is still recognized (this is autoconf's default), but does nothing.

This simplifies configure.ac and Makefile.in a bit.

Tested by rebuilding.

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

* configure.ac: Remove --disable-gdbcli.
* configure: Rebuild.
* Makefile.in (SUBDIR_CLI_DEPS, SUBDIR_CLI_LDFLAGS)
(SUBDIR_CLI_CFLAGS): Remove.
(SFILES): Use SUBDIR_CLI_SRCS.
(COMMON_OBS): Use SUBDIR_CLI_OBS.

6 years agoUse scoped_free_pendings in coff_symtab_read
Tom Tromey [Fri, 29 Jun 2018 21:10:04 +0000 (15:10 -0600)]
Use scoped_free_pendings in coff_symtab_read

PR gdb/18624 concerns an assertion failure that occurs when setting a
breakpoint in a Go program on Windows.

What happens here is that coff_symtab_read uses buildsym but does not
instantiate scoped_free_pendings.  So, the struct pending objects are
never released.  Later, dwarf2read.c calls buildsym_init, which
asserts.

This patch fixes the problem by instantiating scoped_free_pendings in
coff_symtab_read.

Tested using the test executable from the PR.  I don't know how to
test this more fully.

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

PR gdb/18624:
* coffread.c (coff_symtab_read): Use scoped_free_pendings.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 17 Jul 2018 00:00:37 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRISC-V: Add osabi support.
Jim Wilson [Mon, 16 Jul 2018 21:50:36 +0000 (14:50 -0700)]
RISC-V: Add osabi support.

gdb/
* riscv-tdep.c (riscv_gdbarch_init): Call gdbarch_init_osabi.

6 years agoFix typo in NT_PPC_TM_CVSX note description
Pedro Franco de Carvalho [Mon, 16 Jul 2018 15:42:22 +0000 (12:42 -0300)]
Fix typo in NT_PPC_TM_CVSX note description

2018-07-16  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

binutils/
* readelf.c (get_note_type): Fix typo in NT_PPC_TM_CVSX note
description.

6 years agoAdd grok/write functions for new ppc core note sections
Edjunior Barbosa Machado [Mon, 16 Jul 2018 15:42:22 +0000 (12:42 -0300)]
Add grok/write functions for new ppc core note sections

This patch adds functions for grokking and writing more register core
note sections (NT_PPC_TAR, NT_PPC_PPR, NT_PPC_DSCR, NT_PPC_EBB,
NT_PPC_PMU, NT_PPC_TM_CGPR, NT_PPC_TM_CFPR, NT_PPC_TM_CVMX,
NT_PPC_TM_CVSX, NT_PPC_TM_SPR, NT_PPC_TM_CTAR, NT_PPC_TM_CPPR,
NT_PPC_TM_CDSCR).

2018-07-16  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

bfd/
* elf-bfd.h (elfcore_write_ppc_tar): Add prototype.
(elfcore_write_ppc_ppr): Likewise.
(elfcore_write_ppc_dscr): Likewise.
(elfcore_write_ppc_ebb): Likewise.
(elfcore_write_ppc_pmu): Likewise.
(elfcore_write_ppc_tm_cgpr): Likewise.
(elfcore_write_ppc_tm_cfpr): Likewise.
(elfcore_write_ppc_tm_cvmx): Likewise.
(elfcore_write_ppc_tm_cvsx): Likewise.
(elfcore_write_ppc_tm_spr): Likewise.
(elfcore_write_ppc_tm_ctar): Likewise.
(elfcore_write_ppc_tm_cppr): Likewise.
(elfcore_write_ppc_tm_cdscr): Likewise.
* elf.c (elfcore_write_ppc_tar): New function.
(elfcore_write_ppc_ppr): Likewise.
(elfcore_write_ppc_dscr): Likewise.
(elfcore_write_ppc_ebb): Likewise.
(elfcore_write_ppc_pmu): Likewise.
(elfcore_write_ppc_tm_cgpr): Likewise.
(elfcore_write_ppc_tm_cfpr): Likewise.
(elfcore_write_ppc_tm_cvmx): Likewise.
(elfcore_write_ppc_tm_cvsx): Likewise.
(elfcore_write_ppc_tm_spr): Likewise.
(elfcore_write_ppc_tm_ctar): Likewise.
(elfcore_write_ppc_tm_cppr): Likewise.
(elfcore_write_ppc_tm_cdscr): Likewise.
(elfcore_write_register_note): Call them.
(elfcore_grok_ppc_tar): New function.
(elfcore_grok_ppc_ppr): Likewise.
(elfcore_grok_ppc_dscr): Likewise.
(elfcore_grok_ppc_ebb): Likewise.
(elfcore_grok_ppc_pmu): Likewise.
(elfcore_grok_ppc_tm_cgpr): Likewise.
(elfcore_grok_ppc_tm_cfpr): Likewise.
(elfcore_grok_ppc_tm_cvmx): Likewise.
(elfcore_grok_ppc_tm_cvsx): Likewise.
(elfcore_grok_ppc_tm_spr): Likewise.
(elfcore_grok_ppc_tm_ctar): Likewise.
(elfcore_grok_ppc_tm_cppr): Likewise.
(elfcore_grok_ppc_tm_cdscr): Likewise.
(elfcore_grok_note): Call them.

6 years agoAdd missing ChangeLog entry
Simon Marchi [Mon, 16 Jul 2018 18:30:56 +0000 (14:30 -0400)]
Add missing ChangeLog entry

I forgot (yes, again) the ChangeLog entry in my latest patch.

6 years agoRemove unused variables in ia64*tdep.c
Simon Marchi [Mon, 16 Jul 2018 18:27:50 +0000 (14:27 -0400)]
Remove unused variables in ia64*tdep.c

gdb/ChangeLog:

* ia64-libunwind-tdep.c (libunwind_frame_cache): Remove unused
variable.
(libunwind_frame_sniffer): Likewise.
(libunwind_frame_prev_register): Likewise.
(libunwind_sigtramp_frame_sniffer): Likewise.
* ia64-tdep.c (ia64_access_reg): Likewise.
(ia64_access_rse_reg): Likewise.
(ia64_libunwind_sigtramp_frame_this_id): Likewise.
* ia64-vms-tdep.c (ia64_vms_find_proc_info_x): Likewise.

6 years agoFix compilation error in ia64-vms-tdep.c with libunwind-ia64
Simon Marchi [Mon, 16 Jul 2018 18:15:09 +0000 (14:15 -0400)]
Fix compilation error in ia64-vms-tdep.c with libunwind-ia64

I found this when doing a --enable-targets=all build with libunwind-ia64
properly configured.

  CXX    ia64-vms-tdep.o
/home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c: In function â€˜int ia64_vms_find_proc_info_x(unw_addr_space_t, unw_word_t, unw_proc_info_t*, int, void*)’:
/home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c:79:33: error: invalid conversion from â€˜void*’ to â€˜gdb_byte* {aka unsigned char*}’ [-fpermissive]
                             pi->unwind_info, pi->unwind_info_size);
                                 ^
In file included from /home/emaisin/src/binutils-gdb/gdb/target.h:70:0,
                 from /home/emaisin/src/binutils-gdb/gdb/exec.h:23,
                 from /home/emaisin/src/binutils-gdb/gdb/gdbcore.h:29,
                 from /home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c:25:
/home/emaisin/src/binutils-gdb/gdb/target/target.h:35:12: note:   initializing argument 2 of â€˜int target_read_memory(CORE_ADDR, gdb_byte*, ssize_t)’
 extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
            ^

gdb/ChangeLog:

* ia64-vms-tdep.c (ia64_vms_find_proc_info_x): Add cast.

6 years agoremote-sim.c: Remove unused variables
Simon Marchi [Mon, 16 Jul 2018 18:07:09 +0000 (14:07 -0400)]
remote-sim.c: Remove unused variables

gdb/ChangeLog:

* remote-sim.c (gdbsim_target::close,
gdbsim_target::mourn_inferior): Remove unused variables.

6 years agoAdd missing ChangeLog entry
Simon Marchi [Mon, 16 Jul 2018 18:08:26 +0000 (14:08 -0400)]
Add missing ChangeLog entry

I forgot to append the ChangeLog entry to the last commit...

6 years agoFix compilation error in ia64-tdep.c with libunwind-ia64
Simon Marchi [Sat, 7 Jul 2018 15:10:49 +0000 (11:10 -0400)]
Fix compilation error in ia64-tdep.c with libunwind-ia64

Commit

  9018be22e022 ("Make target_read_alloc & al return vectors")

failed to update the code in ia64-tdep.c, for HAVE_LIBUNWIND_IA64_H.
This patch fixes that.

gdb/ChangeLog:

* ia64-tdep.c (ktab_buf): New global.
(getunwind_table): Return a gdb::optional<gdb::byte_vector>.
(get_kernel_table): Adjust.

6 years agoUse outermost_context_p in more places
Tom Tromey [Mon, 21 May 2018 05:42:01 +0000 (23:42 -0600)]
Use outermost_context_p in more places

This changes a few explicit checks of context_stack_depth to use
outermost_context_p instead.  This simplifies some future work.

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

* xcoffread.c (read_xcoff_symtab): Use outermost_context_p.
* dwarf2read.c (using_directives, new_symbol): Use
outermost_context_p.
* dbxread.c (process_one_symbol): Use outermost_context_p.
* coffread.c (coff_symtab_read): Use outermost_context_p.

6 years agoMove the using directives to buildsym_compunit
Tom Tromey [Mon, 21 May 2018 05:28:39 +0000 (23:28 -0600)]
Move the using directives to buildsym_compunit

This moves the globals local_using_directives and
global_using_directives to be members of buildsym_compunit, and adds
the necessary accessors.

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

* dwarf2read.c (using_directives, read_func_scope)
(read_lexical_block_scope): Update.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Update.
* buildsym.h (local_using_directives, global_using_directives):
Don't declare.
(get_local_using_directives, set_local_using_directives)
(get_global_using_directives): Declare.
* buildsym.c (struct buildsym_compunit) <m_local_using_directives,
m_global_using_directives>: New members.
(finish_block_internal, prepare_for_building)
(reset_symtab_globals, end_symtab_get_static_block)
(push_context): Update.
(get_local_using_directives, set_local_using_directives)
(get_global_using_directives): New functions.
(buildsym_init): Update.

6 years agoMake free_pending_blocks static
Tom Tromey [Mon, 21 May 2018 04:45:44 +0000 (22:45 -0600)]
Make free_pending_blocks static

free_pending_blocks can be static because scoped_free_pendings (et al)
arrange for it to be NULL in the "steady state".  This removes a
couple of unnecessary calls to free_pending_blocks and changes it to
be static.

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

* xcoffread.c (xcoff_initial_scan): Don't call
free_pending_blocks.
* dbxread.c (dbx_symfile_read): Don't call free_pending_blocks.
* buildsym.h (class scoped_free_pendings): Add constructor.
(free_pending_blocks): Don't declare.
* buildsym.c (scoped_free_pendings::scoped_free_pendings): New.
(free_pending_blocks): Now static.

6 years agoMove the subfile stack to buildsym_compunit
Tom Tromey [Mon, 21 May 2018 02:48:44 +0000 (20:48 -0600)]
Move the subfile stack to buildsym_compunit

This moves the global subfile_stack to be a member of
buildsym_compunit.  It also change this to be a std::vector, which
simplifies the code.

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

* buildsym.h (push_subfile, pop_subfile): Update declarations.
* buildsym.c (struct buildsym_compunit) <m_subfile_stack>: New
member.
(struct subfile_stack): Remove.
(subfile_stack): Remove.
(push_subfile, pop_subfile, buildsym_init): Update.

6 years agoUse gdb_assert in two places in buildsym.c
Tom Tromey [Sun, 20 May 2018 22:15:14 +0000 (16:15 -0600)]
Use gdb_assert in two places in buildsym.c

This changes buildsym.c to use gdb_assert rather than internal_error
in a couple of spots.

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

* buildsym.c (push_subfile): Use gdb_assert.
(pop_subfile): Use gdb_assert.

6 years agoRemove merge_symbol_lists
Tom Tromey [Sun, 20 May 2018 18:07:44 +0000 (12:07 -0600)]
Remove merge_symbol_lists

I discovered that merge_symbol_lists is unused, so this removes it.

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

* buildsym.h (merge_symbol_lists): Remove.
* buildsym.c (merge_symbol_lists): Remove.

6 years agoMove scan_file_globals declaration to stabsread.h
Tom Tromey [Sun, 20 May 2018 18:06:43 +0000 (12:06 -0600)]
Move scan_file_globals declaration to stabsread.h

scan_file_globals is defined in stabsread.c, so move its declaration
to stabsread.h.

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

* stabsread.c (scan_file_globals): Update comment.
* stabsread.h (scan_file_globals): Move from buildsym.h.
* buildsym.h (scan_file_globals): Move to stabsread.h.

6 years agoRemove buildsym_new_init
Tom Tromey [Sun, 20 May 2018 17:25:20 +0000 (11:25 -0600)]
Remove buildsym_new_init

buildsym_new_init is just an alias for buildsym_init.  This removes
it.  In the long run buildsym_init will also go away; this patch just
helps make things a bit clearer in the meantime.

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

* xcoffread.c (xcoff_new_init): Update.
* mipsread.c (mipscoff_new_init): Update.
* mdebugread.c (mdebug_build_psymtabs): Update.
* elfread.c (elf_new_init): Update.
* dbxread.c (dbx_new_init, coffstab_build_psymtabs)
(elfstab_build_psymtabs, stabsect_build_psymtabs): Update.
* buildsym.h (buildsym_new_init): Don't declare.
* buildsym.c (buildsym_new_init): Remove.

6 years agoMove within_function to stabsread
Tom Tromey [Sun, 20 May 2018 17:19:14 +0000 (11:19 -0600)]
Move within_function to stabsread

The global within_function is only used by a few symbol readers.  This
patch moves the global out of buildsym and into stabsread, which
seemed like a better fit.  It also arranges for the existing readers
to clear the global at the appropriate time.

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

* stabsread.h (within_function): Move from buildsym.h.
* stabsread.c (start_stabs): Clear within_function.
* coffread.c (coff_start_symtab): Clear within_function.
* buildsym.h (within_function): Move to stabsread.h.
* buildsym.c (prepare_for_building): Update.

6 years agoMove processing_gcc to stabsread
Tom Tromey [Sun, 20 May 2018 17:16:57 +0000 (11:16 -0600)]
Move processing_gcc to stabsread

processing_gcc is also only used by stabsread -- it is set by the
DWARF reader, but this turns out not to be needed.  So, this patch
moves processing_gcc and removes the assignment from the DWARF reader.

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

* stabsread.h (processing_gcc_compilation): Move from buildsym.h.
* dwarf2read.c (dwarf2_start_symtab): Don't set
processing_gcc_compilation.
* buildsym.h (processing_gcc_compilation): Move to stabsread.h.

6 years agoMove some code from buildsym to stabsread
Tom Tromey [Sun, 20 May 2018 17:13:12 +0000 (11:13 -0600)]
Move some code from buildsym to stabsread

A few things that currently reside in buildsym.c turn out to be
specific to the stabs reader.  This patch moves these from
buildsym.[ch] to stabsread.[ch].

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

* stabsread.h (HASHSIZE, hashname, symnum, next_symbol_text)
(next_symbol_text_func): Move from buildsym.h.
* stabsread.c (hashname): Move from buildsym.c.
* buildsym.h (HASHSIZE, symnum, next_symbol_text)
(next_symbol_text_func, hashname): Move to stabsread.h.
* buildsym.c: Don't include bcache.h
(hashname): Move to stasbread.c.

6 years agoMake context_stack_size static in buildsym.c
Tom Tromey [Sun, 20 May 2018 17:12:57 +0000 (11:12 -0600)]
Make context_stack_size static in buildsym.c

context_stack_size is declared in buildsym.h, but only used in
buildsym.c.  This makes it static in buildsym.c.

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

* buildsym.h (context_stack_size): Don't declare.
* buildsym.c (context_stack_size): New global.

6 years agoMove processing_acc_compilation to dbxread.c
Tom Tromey [Sun, 20 May 2018 17:04:16 +0000 (11:04 -0600)]
Move processing_acc_compilation to dbxread.c

processing_acc_compilation is only used in dbxread.c, so move it
there.

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

* dbxread.c (processing_acc_compilation): New global.
* buildsym.h (processing_acc_compilation): Don't declare.

6 years agoMove last_source_start_addr to buildsym_compunit
Tom Tromey [Sun, 20 May 2018 17:01:37 +0000 (11:01 -0600)]
Move last_source_start_addr to buildsym_compunit

This moves the global last_source_start_addr into buildsym_compunit,
adding some accessors as well.

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

* xcoffread.c (aix_process_linenos, complete_symtab): Update.
* dbxread.c (read_ofile_symtab): Update.
* coffread.c (coff_start_symtab, coff_end_symtab): Update.
* buildsym.h (last_source_start_addr): Remove.
(set_last_source_start_addr, get_last_source_start_addr):
Declare.
* buildsym.c (buildsym_compunit::buildsym_compunit): Add last_addr
parameter.
(struct buildsym_compunit) <m_last_source_start_addr>: New
member.
(prepare_for_building): Remove start_addr parameter.
(start_symtab, restart_symtab, end_symtab_get_static_block)
(end_symtab_with_blockvector): Update.
(set_last_source_start_addr, get_last_source_start_addr): New
functions.

6 years agoMove have_line_numbers to buildsym_compunit
Tom Tromey [Sun, 20 May 2018 16:48:41 +0000 (10:48 -0600)]
Move have_line_numbers to buildsym_compunit

This moves the global have_line_numbers into buildsym_compunit.

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

* buildsym.c (struct buildsym_compunit) <m_have_line_numbers>: New
member.
(have_line_numbers): Remove.
(record_line, prepare_for_building, end_symtab_get_static_block)
(augment_type_symtab): Update.

6 years agoMove pending_macros to buildsym_compunit
Tom Tromey [Sun, 20 May 2018 16:46:25 +0000 (10:46 -0600)]
Move pending_macros to buildsym_compunit

This moves the pending_macros global into buildsym_compunit.

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

* buildsym.c (~buildsym_compunit): Free the macro table.
(struct buildsym_compunit) <get_macro_table, release_macros>: New
methods.
<m_pending_macros>: New member.
(pending_macros): Remove.
(~scoped_free_pendings, get_macro_table, prepare_for_building)
(reset_symtab_globals, end_symtab_get_static_block)
(end_symtab_with_blockvector, augment_type_symtab)
(buildsym_init): Update.

6 years agoMove last_source file to buildsym_compunit
Tom Tromey [Sun, 20 May 2018 16:39:24 +0000 (10:39 -0600)]
Move last_source file to buildsym_compunit

This moves the global last_source_file into buildsym_compunit.

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

* buildsym.c (buildsym_compunit::buildsym_compunit): Add name
parameter.
(buildsym_compunit::set_last_source_file): New method.
<m_last_source_file>: New member.
(prepare_for_building): Remove "name" parameter.
(start_symtab, restart_symtab, reset_symtab_globals): Update.
(last_source_file): Remove.
(set_last_source_file, get_last_source_file): Update.

6 years agoAdd assert in prepare_for_building
Tom Tromey [Sun, 20 May 2018 16:25:53 +0000 (10:25 -0600)]
Add assert in prepare_for_building

This adds an assertion in prepare_for_building.  This was useful for
verifying whether some subsequent changes were valid.

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

* buildsym.c (prepare_for_building): Add assert.

6 years agoChange buildsym_compunit::comp_dir to be a unique_xmalloc_ptr
Tom Tromey [Sun, 20 May 2018 16:22:19 +0000 (10:22 -0600)]
Change buildsym_compunit::comp_dir to be a unique_xmalloc_ptr

This change buildsym_compunit::comp_dir to be a unique_xmalloc_ptr.
This is just a small cleanup to remove some manual memory management.

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

* buildsym.c (~buildsym_compunit): Update.
(struct buildsym_compunit) <comp_unit>: Now a unique_xmalloc_ptr.
(start_subfile, patch_subfile_names)
(end_symtab_with_blockvector): Update.

6 years agoUse new and delete for buildsym_compunit
Tom Tromey [Sun, 20 May 2018 16:20:53 +0000 (10:20 -0600)]
Use new and delete for buildsym_compunit

This changes buildsym_compunit to use new and delete.

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

* buildsym.c (struct buildsym_compunit): Add constructor,
destructor, initializers.
(start_buildsym_compunit): Remove.
(free_buildsym_compunit): Use "delete".
(start_symtab, restart_symtab): Use "new".

6 years agoUpdate release making notes to metion checking for new top level files.
Nick Clifton [Mon, 16 Jul 2018 13:14:17 +0000 (14:14 +0100)]
Update release making notes to metion checking for new top level files.

* README-how-to-make-a-release: Add note to check for new top
level files and add them to the src-release.sh script.

6 years agoUpdate the src-release script to include the new top level files test-driver and...
Nick Clifton [Mon, 16 Jul 2018 13:10:35 +0000 (14:10 +0100)]
Update the src-release script to include the new top level files test-driver and ar-lib.

* src-release.sh (DEVO_SUPPORT): Add test-driver and ar-lib.

6 years agox86: fix operand size checking
Jan Beulich [Mon, 16 Jul 2018 06:19:21 +0000 (08:19 +0200)]
x86: fix operand size checking

Currently mov to/from control, debug, and test register insns accept any
size GPR operand (general pattern: templates with D set and both
operands being registers in distinct register files). This is due to
improper checking of the reverse case, including not informing the
caller whether a straight and/or reverse match was successful.

The helper functions need to be told two indexes: One to index the given
operand types array, and the other to index the template one. The caller
must attempt a further straight match only if the function reported a
straight match (and respectively for reverse matches).

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 16 Jul 2018 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoFix filename in prior ChangeLog entry
Simon Marchi [Sun, 15 Jul 2018 14:40:49 +0000 (10:40 -0400)]
Fix filename in prior ChangeLog entry

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

6 years agoFix internal error when using --emit-relocs with plugins.
Cary Coutant [Sat, 14 Jul 2018 18:52:27 +0000 (11:52 -0700)]
Fix internal error when using --emit-relocs with plugins.

When an .eh_frame section has deferred layout because of plugins, gold
was neglecting to mark the section as deferred. When we later processed
the corresponding relocation section, we were then ignoring it, causing
the internal error later on in the link.

gold/
PR gold/23397
* object.cc (Sized_relobj_file::do_layout): Mark section as deferred.
* testsuite/Makefile.am (plugin_test_1): Add --emit-relocs option to
existing test case.
* testsuite/Makefile.in: Regenerate.

6 years agoFix problem causing duplicated linker-generated symbols with versions.
Cary Coutant [Sat, 14 Jul 2018 19:29:03 +0000 (12:29 -0700)]
Fix problem causing duplicated linker-generated symbols with versions.

When generating _end, _edata, etc. symbols, and a version script provides
a version name, and we are linking against another shared library that
provides those symbols with a different version, gold ends up trying to
resolve the other shared library's symbols to the new definitions, resulting
in two copies of each symbol, one as default, and one as non-default.
This patch tests for that condition, and ignores the symbols provided
by the other shared library.

gold/
PR gold/23409
* symtab.cc (Symbol_table::define_special_symbol): Add check for
version name on existing symbol.
* testsuite/Makefile.am (ver_test_pr23409): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/ver_test_pr23409.sh: New test script.
* testsuite/ver_test_pr23409_1.script: New version script.
* testsuite/ver_test_pr23409_2.script: New version script.

6 years agoUpdate the notes on how to make a binutils release.
Nick Clifton [Sat, 14 Jul 2018 19:23:52 +0000 (20:23 +0100)]
Update the notes on how to make a binutils release.

* README-how-to-make-a-release: Updated with corrections based on
the 2.31 release experience.

6 years agoRemove struct keyword in range-based for loop
Simon Marchi [Sat, 14 Jul 2018 02:06:34 +0000 (22:06 -0400)]
Remove struct keyword in range-based for loop

Fix this with  gcc 6.3.0:

/home/simark/src/binutils-gdb/gdb/symfile.c: In function 'void set_objfile_default_section_offset(objfile*, const section_addr_info&, CORE_ADDR)':
/home/simark/src/binutils-gdb/gdb/symfile.c:2114:14: error: types may not be defined in a for-range-declaration [-Werror]
   for (const struct other_sections *objf_sect : objf_addrs_sorted)
              ^~~~~~
gdb/ChangeLog:

* symfile.c (set_objfile_default_section_offset): Remove struct
keyword.

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

6 years agosim: Add Stafford Horne as or1k maintainer.
Stafford Horne [Fri, 13 Jul 2018 20:59:26 +0000 (05:59 +0900)]
sim: Add Stafford Horne as or1k maintainer.

Since I helped upstream the or1k port I would like to claim myself as
maintainer.

sim/ChangeLog:

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

* MAINTAINERS (or1k): Add myself as or1k maintainer.

Signed-off-by: Stafford Horne <shorne@gmail.com>
6 years agogdb: Add Stafford Horne as or1k maintainer.
Stafford Horne [Fri, 13 Jul 2018 20:59:26 +0000 (05:59 +0900)]
gdb: Add Stafford Horne as or1k maintainer.

Since I helped upstream openrisc I would like to claim responsibility to
maintain it.

gdb/ChangeLog:

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

* (Responsible Maintainers): Add myself as or1k maintainer.

Signed-off-by: Stafford Horne <shorne@gmail.com>
6 years agoExpect for another variant of error message when gdbserver cannot resolve hostname
Sergio Durigan Junior [Fri, 13 Jul 2018 20:20:34 +0000 (16:20 -0400)]
Expect for another variant of error message when gdbserver cannot resolve hostname

I've noticed that on a few hosts, when given an invalid hostname,
gdbserver fails with:

  spawn /../../gdb/gdbserver/gdbserver --once tcp8:123:2353 /gdb/build/fedora-s390x/build/gdb/testsuite/outputs/gdb.server/server-connect/server-connect
  tcp8:123:2353: cannot resolve name: No address associated with hostname
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Exiting

Unfortunately, this causes a fail on the new
gdb.server/server-connect.exp test (introduced by the IPv6 patch):

  FAIL: gdb.server/server-connect.exp: tcp8: start gdbserver: gdbserver should fail but did not

This happens because we're expecting for another variant of this error
message:

  cannot resolve name: Name or service not known

Therefore, this patch extends the helper function 'gdbserver_start' to
also recognize the "No address associated with hostname" message.
This "fixes" the testcase on the hosts that use this variant.

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

* lib/gdbserver-support.exp (gdbserver_start): Expect for the
message "No address associated with hostname" when gdbserver
cannot resolve the hostname.

6 years agoRemove a warning on macOS
Tom Tromey [Fri, 13 Jul 2018 17:14:57 +0000 (11:14 -0600)]
Remove a warning on macOS

This removes a clang warning coming from -Wmissing-braces.

ChangeLog
2018-07-13  Tom Tromey  <tom@tromey.com>

* symfile.c (set_objfile_default_section_offset): Use extra braces
around initializer.

6 years agoAdd a test that relocs are correctly generated for missing build notes.
Nick Clifton [Fri, 13 Jul 2018 14:48:49 +0000 (15:48 +0100)]
Add a test that relocs are correctly generated for missing build notes.

* testsuite/gas/elf/missing-build-notes.s: New test.  Checks that
relocs are correctly generated for missing build notes.
* testsuite/gas/elf/missing-build-notes.d: New file.  Expected
output from objdump.
* testsuite/gas/elf/elf.exp: Run the new test.

6 years agoAllow bit-patterns in the immediate field of ARM neon mov instructions.
Nick Clifton [Fri, 13 Jul 2018 10:46:44 +0000 (11:46 +0100)]
Allow bit-patterns in the immediate field of ARM neon mov instructions.

* config/tc-arm.c (do_neon_mov): When converting an integer
immediate into a floating point value, check that the conversion
is valid.  Also warn if the immediate is valid as both a floating
point value and a bit pattern.
* testsuite/gas/arm/vfp-mov-enc.s: Add instructions that use
floating point bit patterns.
* testsuite/gas/arm/vfp-mov-enc.d: Add regexps for the disassembly
of the new insns.

6 years agoS390: Fix displaced stepping of "basr r,0"
Andreas Arnez [Fri, 13 Jul 2018 10:46:14 +0000 (12:46 +0200)]
S390: Fix displaced stepping of "basr r,0"

The BASR instruction behaves differently depending on whether the second
operand is a number from 1 to 15, or zero.  In the former case BASR jumps
to the address contained in the general register of that number, but in
the latter case no jump is performed.  GDB's displaced-stepping logic does
not distinguish these cases, although it should.

This is fixed.  In the case where no jump is performed the PC is adjusted
to point back after the original instruction.  Otherwise the PC is left
alone.

gdb/ChangeLog:

* s390-tdep.c (s390_displaced_step_fixup): Adjust PC for a
non-branching basr.

6 years agoGDBserver: Pass process_info pointer to target_kill
Pedro Alves [Fri, 13 Jul 2018 09:28:47 +0000 (10:28 +0100)]
GDBserver: Pass process_info pointer to target_kill

We start from a process_info pointer, pass down process->pid, and
then the target_kill implementations need to find the process from the
pid again.  Pass the process_info pointer down directly instead.

gdb/gdbserver/ChangeLog:
2018-07-13  Pedro Alves  <palves@redhat.com>

* linux-low.c (linux_kill): Change parameter to process_info
pointer instead of pid.  Adjust.
* lynx-low.c (lynx_kill): Likewise.
* nto-low.c (nto_kill): Likewise.
* spu-low.c (spu_kill): Likewise.
* win32-low.c (win32_kill): Likewise.
* server.c (handle_v_kill, kill_inferior_callback)
(detach_or_kill_for_exit): Adjust.
* target.c (kill_inferior): Change parameter to process_info
pointer instead of pid.  Adjust.
* target.h (struct target_ops) <kill>: Change parameter to
process_info pointer instead of pid.  Adjust all implementations
and callers.
(kill_inferior): Likewise.

6 years agoGDBserver: Pass process_info pointer to target_detach and target_join
Pedro Alves [Fri, 13 Jul 2018 09:28:46 +0000 (10:28 +0100)]
GDBserver: Pass process_info pointer to target_detach and target_join

We start from a process_info pointer, pass down process->pid, and then
the target_detach and target_join implementations need to find the
process from the pid again.  Pass the process_info pointer down
directly instead.

gdb/gdbserver/ChangeLog:
2018-07-13  Pedro Alves  <palves@redhat.com>

* linux-low.c (linux_detach, linux_join): Change parameter to
process_info pointer instead of pid.  Adjust.
* lynx-low.c (lynx_detach, lynx_join): Likewise.
* nto-low.c (nto_detach): Likewise.
* spu-low.c (spu_detach, spu_join): Likewise.
* win32-low.c (win32_detach, win32_join): Likewise.
* server.c (handle_detach, detach_or_kill_for_exit): Adjust.
* target.h (struct target_ops) <detach, join>: Change parameter to
process_info pointer instead of pid.  Adjust all implementations
and callers.
(detach_inferior, join_inferior): Rename 'pid' parameter to
'proc'.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Jul 2018 00:01:06 +0000 (00:01 +0000)]
Automatic date update in version.in

6 years agoAdd a self-test for cli-utils.c
Philippe Waroquiers [Mon, 21 May 2018 07:16:13 +0000 (09:16 +0200)]
Add a self-test for cli-utils.c

tests added for:
* number_or_range_parser
  In particular, it tests the cur_tok when parsing is finished.

* parse_flags

* parse_flags_qcs

gdb/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/cli-utils-selftests.c
* unittests/cli-utils-selftests.c: New file.

6 years agoModify gdb.threads/pthreads.exp to test FLAG qcs arguments for thread apply.
Philippe Waroquiers [Sun, 20 May 2018 18:31:27 +0000 (20:31 +0200)]
Modify gdb.threads/pthreads.exp to test FLAG qcs arguments for thread apply.

Also, add prefixes to make some non unique tests unique.

gdb/testsuite/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.threads/pthreads.exp: Test qcs FLAG arguments.
Add some test prefixes to make tests unique.

6 years agoAdd a test for 'frame apply'
Philippe Waroquiers [Thu, 12 Jul 2018 21:04:13 +0000 (23:04 +0200)]
Add a test for 'frame apply'

gdb/testsuite/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/frameapply.c: New file.
* gdb.base/frameapply.exp: New file.

6 years agoAnnounce the user visible changes for frame/thread apply in NEWS.
Philippe Waroquiers [Thu, 12 Jul 2018 21:02:14 +0000 (23:02 +0200)]
Announce the user visible changes for frame/thread apply in NEWS.

'frame apply', faas, taas, tfaas commands and [FLAG]... arg for thread apply.

gdb/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* NEWS: Mention new commands.  Mention change to 'thread apply'.

6 years agoDocuments the new commands 'frame apply', faas, taas, tfaas
Philippe Waroquiers [Sun, 24 Jun 2018 11:02:43 +0000 (13:02 +0200)]
Documents the new commands 'frame apply', faas, taas, tfaas

Documents the new commands 'frame apply', faas, taas, tfaas.
Documents the new arguments [FLAG]... added to 'thread apply'.

gdb/doc/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.texinfo (Debugging Programs with Multiple Threads):
Document changes to 'thread apply'.  Document 'taas'.
Document 'tfaas'.
(Examining the Stack): Document 'frame apply'.  Document 'faas'.

6 years agoAdd [FLAG]... arguments to 'thread apply'.
Philippe Waroquiers [Sat, 5 May 2018 18:33:38 +0000 (20:33 +0200)]
Add [FLAG]... arguments to 'thread apply'.

Enhance 'thread apply' command to also accept [FLAG]... arguments.

An example usage for this new argument:
   thread apply all -s frame apply all -s p some_local_var_somewhere
      Prints the thread id, frame location and some_local_var_somewhere
      value in frames of threads that have such local var.

To make the life of the user easier, the most typical use cases
have shortcuts :
   taas  : shortcut for 'thread apply all -s'
   tfaas : shortcut for 'thread apply all -s frame apply all -s"

An example usage :
   tfaas p some_local_var_somewhere
     same as the longer:
        'thread apply all -s frame apply all -s p some_local_var_somewhere'

gdb/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* thread.c (thr_try_catch_cmd): New function.
(thread_apply_all_command): Handle qcs flags.
(thread_apply_command): Handle qcs flags.
(taas_command): New function.
(tfaas_command): New function.
(_initialize_thread): Update to setup the new commands 'taas
and 'tfaas'. Change doc string for 'thread apply'.

6 years agoImplement frame apply [all | COUNT | -COUNT | level LEVEL... ] [FLAG]... COMMAND.
Philippe Waroquiers [Sat, 5 May 2018 18:27:11 +0000 (20:27 +0200)]
Implement frame apply [all | COUNT | -COUNT | level LEVEL... ] [FLAG]... COMMAND.

Implement frame apply [all | COUNT | -COUNT | level LEVEL... ] [FLAG]... COMMAND.
Also implement the command 'faas COMMAND', a shortcut for
'frame apply all -s COMMAND'.

The syntax of 'frame apply' to specify some innermost or outermost
frames is similar to 'backtrace' command, using COUNT or -COUNT.

To apply a COMMAND to a more specific set of frames, the following
new command and syntax can be used:
frame apply level LEVEL... [FLAG]... COMMAND
where LEVEL is one or more frame levels or range of frame levels.

The new command 'frame apply' allows to apply a COMMAND to a number of frames,
or to all frames, or to a set of frames.
The optional [FLAG]... arguments allow to control what output to produce
and how to handle errors raised when applying COMMAND to a frame.

Some example usages for this new command:
   frame apply all info frame
      Produce info frame for all frames.
   frame apply all p $sp
      For each frame, print the location, followed by the frame sp.
   frame apply all -q p $sp
      Same as before, but -q flag (q = quiet) indicates to only print
      the frames sp.
   frame apply all p some_local_var_somewhere
      Print some_local_var_somewhere in all frames. 'frame apply'
      will abort as soon as the print command fails.
   frame apply all -c p some_local_var_somewhere
      Same as before, but -c flag (c = continue) means to
      print the error and continue applying command in case the
      print command fails.
   frame apply all -s p some_local_var_somewhere
      Same as before, but -s flag (s = silent) means to
      be silent for frames where the print command fails.
      In other words, this allows to 'search' the frame in which
      some_local_var_somewhere can be printed.
   frame apply all -s -q p some_local_var_somewhere
      Same as before, but does not print the frame info in which
      the variable is found.
   frame apply level 2-4 5 8-10 -s p i = i + 1
      Increments i in the identified frames.

gdb/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* stack.c: (trailing_outermost_frame): New function, mostly
extracted from backtrace_command_1.
(leading_innermost_frame): New function.
(backtrace_command_1): Update to call trailing_outermost_frame.
(frame_apply_command_count): New function.
(frame_apply_level_command): New function.
(frame_apply_all_command): New function.
(frame_apply_command): New function.
(faas_command): New function.
(frame_cmd_list): New variable.
(_initialize_stack): Update to setup the new commands 'frame apply'
and 'faas'.

6 years agoAdd helper functions parse_flags and parse_flags_qcs
Philippe Waroquiers [Sat, 5 May 2018 18:20:56 +0000 (20:20 +0200)]
Add helper functions parse_flags and parse_flags_qcs

Add helper functions parse_flags and parse_flags_qcs.
parse_flags helper function allows to look for a set of flags at
the start of a string.
A flag must be given individually.

parse_flags_qcs is a specialised helper function to handle
the flags -q, -c and -s, that are used in the new command 'frame apply'
and in the command 'thread apply.

Modify number_or_range_parser::get_number to differentiate a
- followed by digits from a - followed by an alpha (i.e. a flag or an option).
That is needed for the addition of the [FLAG]... arguments to
thread apply ID... [FLAG]... COMMAND

Remove bool number_or_range_parser::m_finished, rather
implement the 'finished' logic inside number_or_range_parser::finished.
The new logic properly detects the end of parsing even if not at
end of the string. This ensures that number_or_range_parser::cur_tok
really points past the last parsed token when parsing is finished.
Before, it was always pointing at the end of the string.
As parsing now is finished directly when not positioned on a number,
number_is_in_list must do an error check before the loop getting all
numbers.

The error message for 'thread apply -$unknownconvvar p 1'
is now the more clear:
  Convenience variable must have integer value.
  Invalid thread ID: -$unknownconvvar p 1
instead of previously:
  negative value

gdb/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* cli-utils.c (number_or_range_parser::get_number): Only handle
numbers or convenience var as numbers.
(parse_flags): New function.
(parse_flags_qcs): New function.
(number_or_range_parser::finished): Ensure parsing end is detected
before end of string.
* cli-utils.h (parse_flags): New function.
(parse_flags_qcs): New function.
(number_or_range_parser): Remove m_finished bool.
(number_or_range_parser::skip_range): Set m_in_range to false.

gdb/testsuite/ChangeLog
2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.base/skip.exp: Update expected error message.

6 years agoMIPS/LD/testsuite: Correct mips-elf.exp test ABI/emul/endian arrangement
Maciej W. Rozycki [Thu, 12 Jul 2018 19:01:44 +0000 (20:01 +0100)]
MIPS/LD/testsuite: Correct mips-elf.exp test ABI/emul/endian arrangement

Similarly to commit 86b24e15c45b ("MIPS/LD/testsuite: Correct
comm-data.exp test ABI/emul/endian arrangement") update the mips-elf.exp
test script to:

- correctly select emulations for targets using non-traditional MIPS
  emulations,

- correctly select ABIs for targets that do not support all of them,

- use the default endianness selection where possible to benefit targets
  that support only one,

- simplify test invocation by providing ABI-specific `run_dump_test'
  wrappers, specifically `run_dump_test_o32', `run_dump_test_n32',
  `run_dump_test_n64' and `run_dump_test_eabi', which remove the need to
  use conditionals across the Expect script or to repeat ABI-specific
  GAS and LD flags with each invocation,

removing numerous test failures for `mips-sgi-irix6', `mips64-openbsd',
`mips64el-openbsd' and `mips64el-ps2-elf' targets and broadening
coverage for several MIPS targets.

There are some new failures for the `mips64el-ps2-elf' target with tests
that were not previously run for that target:

FAIL: MIPS16 link branch to absolute expression (n32)
FAIL: MIPS16 link branch to absolute expression 1 (n32)
FAIL: MIPS16 link branch to absolute expression 2 (n32)
FAIL: microMIPS link branch to absolute expression (n32)
FAIL: MIPS ELF got reloc n32
FAIL: MIPS ELF xgot reloc n32
FAIL: undefined weak symbol overflow (n32)
FAIL: R_MIPS16_HI16 and R_MIPS16_LO16 relocs n32
FAIL: ld-mips-elf/attr-gnu-4-0-n32-ph
FAIL: ld-mips-elf/attr-gnu-4-1-n32-ph
FAIL: ld-mips-elf/attr-gnu-4-2-n32-ph
FAIL: ld-mips-elf/attr-gnu-4-3-n32-ph
FAIL: MIPSr6 JALR reloc unaligned/cross-mode link test (n32)

which are mostly due to dump discrepancies caused by mapping differences
coming from the default linker scripts used by these test cases, or
sometimes because of the specific MIPS processor architecture recorded
in the ELF file taking precedence over the general MIPS ISA level also
recorded.  Finally, the R_MIPS16_HI16/R_MIPS16_LO16 relocation test
failure is a preexisting issue with the IRIX style emulation.

These failures will have to be addressed separately.

ld/
* testsuite/ld-mips-elf/mips-elf.exp (run_dump_test_abi)
(run_dump_test_o32, run_dump_test_n32, run_dump_test_n64)
(run_dump_test_eabi): New procedures.
(has_newabi, has_elf32): Remove variables.
(has_abi): New associative array variable.
(abi_asflags, abi_ldflags): Update settings across targets.
(irixemul): New variable.
Replace `run_dump_test' calls where applicable throughout with
`run_dump_test_o32', `run_dump_test_n32', `run_dump_test_n64'
and `run_dump_test_eabi' as appropriate.  Remove explicit
passing of `abi_asflags' and `abi_ldflags'.  Use `noarch' for
tests that require their own architecture setting.  Force the
big endianness for tests that require it.  Select the endianness
required for `objdump invocation with the `reloc-2' test.
Conditionalize tests run via `run_ld_link_tests' on the ABI
required and use the ABI list from the `has_abi' array where
appropriate.
* testsuite/ld-mips-elf/attr-gnu-4-0-n32-ph.d: Remove ABI and
endianness selection options from `ld' and `source' tags.  Relax
output format matching.
* testsuite/ld-mips-elf/attr-gnu-4-0-n64-ph.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-1-n32-ph.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-1-n64-ph.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-2-n32-ph.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-2-n64-ph.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-3-n32-ph.d: Likewise.
* testsuite/ld-mips-elf/attr-gnu-4-3-n64-ph.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n32.d: Remove
ABI and endianness selection options from `as', `ld', `source'
tags, and also the `-march=from-abi' option.  Remove the `as'
tag where it would become empty.
* testsuite/ld-mips-elf/bal-jalx-addend-micromips-n64.d:
Likewise.
* testsuite/ld-mips-elf/bal-jalx-addend-micromips.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-addend-n32.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-addend-n64.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-addend.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-local-micromips-n32.d:
Likewise.
* testsuite/ld-mips-elf/bal-jalx-local-micromips-n64.d:
Likewise.
* testsuite/ld-mips-elf/bal-jalx-local-micromips.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-local-n32.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-local-n64.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-local.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n32.d:
Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips-n64.d:
Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-micromips.d:
Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-n32.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore-n64.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-ignore.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-n32.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic-n64.d: Likewise.
* testsuite/ld-mips-elf/bal-jalx-pic.d: Likewise.
* testsuite/ld-mips-elf/branch-absolute-addend-n32.d: Likewise.
* testsuite/ld-mips-elf/branch-absolute-addend-n64.d: Likewise.
* testsuite/ld-mips-elf/branch-absolute-addend.d: Likewise.
* testsuite/ld-mips-elf/branch-absolute-n32.d: Likewise.
* testsuite/ld-mips-elf/branch-absolute-n64.d: Likewise.
* testsuite/ld-mips-elf/branch-absolute.d: Likewise.
* testsuite/ld-mips-elf/dyn-sec64.d: Likewise.
* testsuite/ld-mips-elf/eh-frame1-n32.d: Likewise.
* testsuite/ld-mips-elf/eh-frame1-n64.d: Likewise.
* testsuite/ld-mips-elf/eh-frame2-n32.d: Likewise.
* testsuite/ld-mips-elf/eh-frame2-n64.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-got-n32-embed.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-got-n32.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-got-n64-embed.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-got-n64-irix.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-got-n64.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-xgot-n32-embed.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-xgot-n32.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-xgot-n64-embed.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-xgot-n64-irix.d: Likewise.
* testsuite/ld-mips-elf/elf-rel-xgot-n64.d: Likewise.
* testsuite/ld-mips-elf/emit-relocs-1.d: Likewise.
* testsuite/ld-mips-elf/got-dump-2.d: Likewise.
* testsuite/ld-mips-elf/got-page-2.d: Likewise.
* testsuite/ld-mips-elf/jal-global-overflow-0.d: Likewise.
* testsuite/ld-mips-elf/jal-global-overflow-1.d: Likewise.
* testsuite/ld-mips-elf/jal-local-overflow-0.d: Likewise.
* testsuite/ld-mips-elf/jal-local-overflow-1.d: Likewise.
* testsuite/ld-mips-elf/jalbal.d: Likewise.
* testsuite/ld-mips-elf/jalx-addend-n32.d: Likewise.
* testsuite/ld-mips-elf/jalx-addend-n64.d: Likewise.
* testsuite/ld-mips-elf/jalx-addend.d: Likewise.
* testsuite/ld-mips-elf/jalx-local-n32.d: Likewise.
* testsuite/ld-mips-elf/jalx-local-n64.d: Likewise.
* testsuite/ld-mips-elf/jalx-local.d: Likewise.
* testsuite/ld-mips-elf/jr-to-b-1.d: Likewise.
* testsuite/ld-mips-elf/jr-to-b-2.d: Likewise.
* testsuite/ld-mips-elf/lsi-4010-isa.d: Likewise.
* testsuite/ld-mips-elf/micromips-branch-absolute-addend-n32.d:
Likewise.
* testsuite/ld-mips-elf/micromips-branch-absolute-addend-n64.d:
Likewise.
* testsuite/ld-mips-elf/micromips-branch-absolute-addend.d:
Likewise.
* testsuite/ld-mips-elf/micromips-branch-absolute-n32.d:
Likewise.
* testsuite/ld-mips-elf/micromips-branch-absolute-n64.d:
Likewise.
* testsuite/ld-mips-elf/micromips-branch-absolute.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-2.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-3.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-1.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-2.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend-1.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32-1.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend-n32.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64-1.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend-n64.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-addend.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-n32-1.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-n32-2.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-n32.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-n64-1.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-n64-2.d:
Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute-n64.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-absolute.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-addend-2.d: Likewise.
* testsuite/ld-mips-elf/mips16-branch-addend-3.d: Likewise.
* testsuite/ld-mips-elf/mips16-hilo-n32.d: Likewise.
* testsuite/ld-mips-elf/mips16-pcrel-0.d: Likewise.
* testsuite/ld-mips-elf/mips16-pcrel-1.d: Likewise.
* testsuite/ld-mips-elf/mips16-pcrel-addend-2.d: Likewise.
* testsuite/ld-mips-elf/mips16-pcrel-addend-6.d: Likewise.
* testsuite/ld-mips-elf/mips16-pcrel-n32-0.d: Likewise.
* testsuite/ld-mips-elf/mips16-pcrel-n32-1.d: Likewise.
* testsuite/ld-mips-elf/mips16-pcrel-n64-sym32-0.d: Likewise.
* testsuite/ld-mips-elf/mips16-pcrel-n64-sym32-1.d: Likewise.
* testsuite/ld-mips-elf/mips16e2-pcrel-0.d: Likewise.
* testsuite/ld-mips-elf/mips16e2-pcrel-1.d: Likewise.
* testsuite/ld-mips-elf/mips16e2-pcrel-addend-2.d: Likewise.
* testsuite/ld-mips-elf/mips16e2-pcrel-addend-6.d: Likewise.
* testsuite/ld-mips-elf/mips16e2-pcrel-n32-0.d: Likewise.
* testsuite/ld-mips-elf/mips16e2-pcrel-n32-1.d: Likewise.
* testsuite/ld-mips-elf/mips16e2-pcrel-n64-sym32-0.d: Likewise.
* testsuite/ld-mips-elf/mips16e2-pcrel-n64-sym32-1.d: Likewise.
* testsuite/ld-mips-elf/multi-got-1.d: Likewise.
* testsuite/ld-mips-elf/multi-got-hidden-1.d: Likewise.
* testsuite/ld-mips-elf/multi-got-hidden-2.d: Likewise.
* testsuite/ld-mips-elf/multi-got-no-shared.d: Likewise.
* testsuite/ld-mips-elf/no-shared-1-n32.d: Likewise.
* testsuite/ld-mips-elf/no-shared-1-n64.d: Likewise.
* testsuite/ld-mips-elf/no-shared-1-o32.d: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-2.d: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-3-error.d: Likewise.
* testsuite/ld-mips-elf/pic-and-nonpic-4-error.d: Likewise.
* testsuite/ld-mips-elf/pie-n32.d: Likewise.
* testsuite/ld-mips-elf/pie-n64.d: Likewise.
* testsuite/ld-mips-elf/pie-o32.d: Likewise.
* testsuite/ld-mips-elf/rel32-n32.d: Likewise.
* testsuite/ld-mips-elf/rel32-o32.d: Likewise.
* testsuite/ld-mips-elf/rel64.d: Likewise.
* testsuite/ld-mips-elf/relax-jalr-n32.d: Likewise.
* testsuite/ld-mips-elf/reloc-1-n32.d: Likewise.
* testsuite/ld-mips-elf/reloc-1-n64.d: Likewise.
* testsuite/ld-mips-elf/reloc-2.d: Likewise.
* testsuite/ld-mips-elf/reloc-3-n32.d: Likewise.
* testsuite/ld-mips-elf/reloc-local-overflow.d: Likewise.
* testsuite/ld-mips-elf/textrel-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-2.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-branch-micromips.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-mips16.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-r6-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch-r6-2.d: Likewise.
* testsuite/ld-mips-elf/unaligned-branch.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-0.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-2.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-3.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-0.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-0.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d:
Likewise.
* testsuite/ld-mips-elf/unaligned-jump-micromips.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jump-mips16.d: Likewise.
* testsuite/ld-mips-elf/unaligned-jump.d: Likewise.
* testsuite/ld-mips-elf/unaligned-ldpc-0.d: Likewise.
* testsuite/ld-mips-elf/unaligned-ldpc-1.d: Likewise.
* testsuite/ld-mips-elf/unaligned-lwpc-0.d: Likewise.
* testsuite/ld-mips-elf/unaligned-lwpc-1.d: Likewise.

6 years agoMIPS/LD/testsuite: Limit reloc 6 tests to DSO targets
Maciej W. Rozycki [Thu, 12 Jul 2018 19:01:44 +0000 (20:01 +0100)]
MIPS/LD/testsuite: Limit reloc 6 tests to DSO targets

Complement commit 500c05ddbe98 ("MIPS/ld/testsuite: Limit export class
call reloc tests to DSO targets") and also check for target's shared
library support in determining whether to run reloc 6 tests, which
require it.  No changes in results as all targets currently enabled for
NewABI testing support shared libraries.

ld/
* testsuite/ld-mips-elf/mips-elf.exp: Limit reloc 6 tests to
shared library targets.

6 years agoDeclare 'ioarg' (from ser-tcp.c:try_connect) as 'u_long' when on Windows (and unbreak...
Sergio Durigan Junior [Thu, 12 Jul 2018 17:03:31 +0000 (13:03 -0400)]
Declare 'ioarg' (from ser-tcp.c:try_connect) as 'u_long' when on Windows (and unbreak build on mingw32)

When building GDB on mingw32, it fails with:

  ../../binutils-gdb/gdb/ser-tcp.c: In function 'int try_connect(const addrinfo*, unsigned int*)':
  ../../binutils-gdb/gdb/ser-tcp.c:176:25: error: invalid conversion from 'int*' to 'u_long* {aka long unsigned int*}' [-fpermissive]
     ioctl (sock, FIONBIO, &ioarg);
   ^~~~~~
  In file included from ../../binutils-gdb/gdb/serial.h:23:0,
   from ../../binutils-gdb/gdb/ser-tcp.c:21:
  /usr/x86_64-w64-mingw32/sys-root/mingw/include/winsock2.h:977:34: note:   initializing argument 3 of 'int ioctlsocket(SOCKET, long int, u_long*)'
     WINSOCK_API_LINKAGE int WSAAPI ioctlsocket(SOCKET s,__LONG32 cmd,u_long *argp);
    ^~~~~~~~~~~
  make[2]: *** [Makefile:1610: ser-tcp.o] Error 1

The problem happens because the IPv6
commit (c7ab0aef11d91b637bf091aa9176b8dc4aadee46) wrongly removed the
code responsible for declaring 'ioarg' with a different type if
building for Windows.  This patch restores that.

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

* ser-tcp.c (try_connect): Declare 'ioarg' as 'u_long' if building
on Windows.