deliverable/binutils-gdb.git
7 years agoPR22348, conflicting global vars in crx and cr16
Alan Modra [Wed, 25 Oct 2017 11:29:14 +0000 (21:59 +1030)] 
PR22348, conflicting global vars in crx and cr16

include/
PR 22348
* opcode/cr16.h (instruction): Delete.
(cr16_words, cr16_allWords, cr16_currInsn): Delete.
* opcode/crx.h (crx_cst4_map): Rename from cst4_map.
(crx_cst4_maps): Rename from cst4_maps.
(crx_no_op_insn): Rename from no_op_insn.
(instruction): Delete.
opcodes/
PR 22348
* cr16-dis.c (cr16_cinvs, instruction, cr16_currInsn): Make static.
(cr16_words, cr16_allWords, processing_argument_number): Likewise.
(imm4flag, size_changed): Likewise.
* crx-dis.c (crx_cinvs, NUMCINVS, instruction, currInsn): Likewise.
(words, allWords, processing_argument_number): Likewise.
(cst4flag, size_changed): Likewise.
* crx-opc.c (crx_cst4_map): Rename from cst4_map.
(crx_cst4_maps): Rename from cst4_maps.
(crx_no_op_insn): Rename from no_op_insn.
gas/
PR 22348
* config/tc-crx.c (instruction, output_opcode): Make static.
(relocatable, ins_parse, cur_arg_num): Likewise.
(parse_insn): Adjust for renamed opcodes globals.
(check_range): Likewise

7 years agoAdd common AARCH64 REGNUM defines
Alan Hayward [Wed, 25 Oct 2017 08:06:41 +0000 (09:06 +0100)] 
Add common AARCH64 REGNUM defines

gdb/
* aarch64-tdep.h (enum aarch64_regnum): Remove.
* arch/aarch64.h: New file.

gdbserver/
* linux-aarch64-low.c (aarch64_fill_gregset): Replace defines
with REGNO.
(aarch64_store_gregset): Likewise.
(aarch64_fill_fpregset): Likewise.
(aarch64_store_fpregset): Likewise.

7 years agoAllow for __gnu_lto_slim prefixed with extra "_"
Alan Modra [Wed, 25 Oct 2017 05:02:52 +0000 (15:32 +1030)] 
Allow for __gnu_lto_slim prefixed with extra "_"

Some targets prefix global symbols with "_".

bfd/
* archive.c (_bfd_compute_and_write_armap): Match "__gnu_lto_slim"
optionally prefixed with "_".
* linker.c (_bfd_generic_link_add_one_symbol): Likewise.
binutils/
* nm.c (filter_symbols): Match "__gnu_lto_slim" optionally prefixed
with "_".
gold/
* symtab.cc (Symbol_table::add_from_relobj): Match "__gnu_lto_slim"
optionally prefixed with "_".
ld/
* testsuite/ld-plugin/lto-3r.d: Match "__gnu_lto_v" optionally
prefixed with "_".
* testsuite/ld-plugin/lto-5r.d: Likewise.

7 years agoYet another fill-1 test fix
Alan Modra [Wed, 25 Oct 2017 05:01:58 +0000 (15:31 +1030)] 
Yet another fill-1 test fix

tic4x fails due to being a 4 octets per byte target, while tic54x is 2
octets per byte.

mmix still fails with
fill-1.s:4: Error: unknown pseudo-op: `.l1:'
fill-1.s:6: Error: unknown pseudo-op: `.l2:'
fill-1.s:3: Error: .space specifies non-absolute value

and if the labels are changed to L1 and L2 then mep-elf fails with
fill-1.s:3: Error: .space specifies non-absolute value

Since both of those look like they ought to be investigated by the
target maintainers, I'm tweaking the test to fail on both targets.

* testsuite/gas/all/fill-1.d: Exclude tic4x and tic54x.
* testsuite/gas/all/fill-1.s: Use L1 rather than .L1.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 25 Oct 2017 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoFix format typos in previous previous ld/ChangeLog entry
Hans-Peter Nilsson [Tue, 24 Oct 2017 22:46:24 +0000 (00:46 +0200)] 
Fix format typos in previous previous ld/ChangeLog entry

7 years agotestsuite/ld-riscv-elf/ld-riscv-elf.exp: Fix typo for istarget.
Hans-Peter Nilsson [Tue, 24 Oct 2017 22:45:05 +0000 (00:45 +0200)] 
testsuite/ld-riscv-elf/ld-riscv-elf.exp: Fix typo for istarget.

7 years agoFix racy test in gdb.base/new-ui.exp
Pedro Alves [Tue, 24 Oct 2017 22:22:56 +0000 (23:22 +0100)] 
Fix racy test in gdb.base/new-ui.exp

I noticed gdb.base/new-ui.exp failing once here with:

 FAIL: gdb.base/new-ui.exp: do_test: delete all breakpoints on extra console (got interactive prompt)
 FAIL: gdb.base/new-ui.exp: do_test: main console: next causes no spurious output on other console
 FAIL: gdb.base/new-ui.exp: do_test: main console: breakpoint hit reported on other console

The problem is 100% reproducible with check-read1:
  $ make check-read1 TESTS="gdb.*/new-ui.exp"

testsuite/gdb.log shows:
  delete
  Delete all breakpoints? (y or n) [answered Y; input not from terminal]
  (gdb) FAIL: gdb.base/new-ui.exp: do_test: delete all breakpoints on extra console (got interactive prompt)

This commit fixes the problem.

gdb/testsuite/ChangeLog:
2017-10-24  Pedro Alves  <palves@redhat.com>

* gdb.base/new-ui.exp (do_test): Split "delete all breakpoints on
extra console" test in two stages.

7 years agoRISC-V: Fix disassembly of c.addi4spn, c.addi16sp, c.lui when imm=0
Andrew Waterman [Thu, 19 Oct 2017 18:21:44 +0000 (11:21 -0700)] 
RISC-V: Fix disassembly of c.addi4spn, c.addi16sp, c.lui when imm=0

These are all invalid instructions, so they should not disassemble.

opcodes/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * riscv-opc.c (match_c_addi16sp) : New function.
        (match_c_addi4spn): New function.
        (match_c_lui): Don't allow 0-immediate encodings.
        (riscv_opcodes) <addi>: Use the above functions.
        <add>: Likewise.
        <c.addi4spn>: Likewise.
        <c.addi16sp>: Likewise.

gas/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * testsuite/gas/riscv/c-addi16sp-fail.d: New test.
        testsuite/gas/riscv/c-addi16sp-fail.l: Likewise.
        testsuite/gas/riscv/c-addi16sp-fail.s: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.d: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.l: Likewise.
        testsuite/gas/riscv/c-addi4spn-fail.s: Likewise.
        testsuite/gas/riscv/riscv.exp: Add new tests.

7 years agoUse const reference for decimal_from_string argument
Ulrich Weigand [Tue, 24 Oct 2017 16:34:41 +0000 (18:34 +0200)] 
Use const reference for decimal_from_string argument

No functional change.

gdb/ChangeLog:
2017-10-24  Ulrich Weigand  <uweigand@de.ibm.com>

* dfp.h (decimal_from_string): Use const reference for argument.
* dfp.c (decimal_from_string): Likewise.

7 years agoTarget FP printing: Use floatformat_to_string in tdep code
Ulrich Weigand [Tue, 24 Oct 2017 16:01:39 +0000 (18:01 +0200)] 
Target FP printing: Use floatformat_to_string in tdep code

A few tdep files use target-specific printing routines to output values in
the floating-point registers.  To get rid of host floating-point code,
this patch changes them to use floatformat_to_string instead.

No functional change intended, the resulting output should look the same.

ChangeLog:
2017-10-24  Ulrich Weigand  <uweigand@de.ibm.com>

* i387-tdep.c (print_i387_value): Use floatformat_to_string.
* sh64-tdep.c (sh64_do_fp_register): Likewise.
* mips-tdep.c (mips_print_fp_register): Likewise.

7 years agoTarget FP printing: Simplify and fix ui_printf
Ulrich Weigand [Tue, 24 Oct 2017 16:00:50 +0000 (18:00 +0200)] 
Target FP printing: Simplify and fix ui_printf

This patch adds support for handling format strings to both
floatformat_to_string and decimal_to_string, and then uses
those routines to implement ui_printf formatted printing.

There is already a subroutine printf_decfloat that ui_printf uses to
handle decimal FP.  This is renamed to printf_floating and updated
to handle both binary and decimal FP.  This includes the following
set of changes:

- printf_decfloat currently parses the format string again to determine
  the intended target format.  This seems superfluous since the common
  parsing code in parse_format_string already did this, but then did
  not pass the result on to its users.  Fixed by splitting the decfloat_arg
  argument class into three distinct classes, and passing them through.

- Now we can rename printf_decfloat to printf_floating and also call it
  for the argument classes representing binary FP types.

- The code will now use the argclass to detect the type the value should
  be printed at, and converts the input value to this type if necessary.
  To remain compatible with current behavior, for binary FP the code
  instead tries to re-interpret the input value as a FP type of the
  same size if that exists.  (Maybe this behavior is more confusing
  than useful -- but this can be changed later if we want to ...)

- Finally, we can use floatformat_to_string / decimal_to_string passing
  the format string to perform the formatted output using the desired
  target FP type.

Note that we no longer generate different code depending on whether or not
the host supports "long double" -- this check is obsolete anyway since C++11
mandates "long double", and in any case a %lg format string is intended to
refer to the *target* long double type, not the host version.

Note also that formatted printing of DFP numbers may not work correctly,
since it attempts to use the host printf to do so (and makes unwarranted
assumptions about the host ABI while doing so!).  This is no change to
the current behavior -- I simply moved the code from printf_decfloat to
the decimal_to_string routine in dfp.c.  If we want to fix it in the
future, that is a more appropriate place anyway.

ChangeLog:
2017-10-24  Ulrich Weigand  <uweigand@de.ibm.com>

* common/format.h (enum argclass): Replace decfloat_arg by
dec32float_arg, dec64float_arg, and dec128float_arg.
* common/format.c (parse_format_string): Update to return
new decimal float argument classes.

* printcmd.c (printf_decfloat): Rename to ...
(printf_floating): ... this.  Add argclass argument, and use it
instead of parsing the format string again.  Add support for
binary floating-point values, using floatformat_to_string.
Convert value to the target format if it doesn't already match.
(ui_printf): Call printf_floating instead of printf_decfloat,
also for double_arg / long_double_arg.  Pass argclass.

* dfp.c (decimal_to_string): Add format string argument.
* dfp.h (decimal_to_string): Likewise.

* doublest.c (floatformat_to_string): Add format string argument.
* doublest.h (floatformat_to_string): Likewise.

7 years agoTarget FP printing: Simplify and fix print_floating
Ulrich Weigand [Tue, 24 Oct 2017 15:59:22 +0000 (17:59 +0200)] 
Target FP printing: Simplify and fix print_floating

The print_floating routine currently makes a lot of assumptions about host
and target floating point formats.  This patch cleans up many of those.

One problem is that print_floating may currently be called with types
that are not actually floating-point types, and it tries hard to output
those as floating-point values anyway.  However, there is only one single
caller of print_floating where this can ever happen: print_scalar_formatted.
And in fact, it is much simpler to handle the case where the value to be
printed is not already of floating-point type right there.

So this patch changes print_scalar_formatted to handle the 'f' format
as follows:

- If the value to be printed is already of floating-point type, just
  call print_floating on it.

- Otherwise, if there is a standard target floating-point type of
  the same size as the value, call print_floating using that type.

- Otherwise, just print the value as if the 'f' format had not been
  specified at all.

This has the overall effect to printing everything the same way as
the old code did, but is overall a lot simpler.  (Also, it would
allow us to change the above strategy more easily, if that might
be a more intuitive user interface.  For example, in the third
case above, maybe an error would be more appropriate?)

Given that change, print_floating can become much simpler.  In particular,
we now always have a floating-point format that we can consult.  This
means we can use the floating-point format to programmatically determine
the number of digits necessary to print the value.

The current code uses a hard-coded value of 9, 17, or 35 digits.  Note
that this matches the DECIMAL_DIG values for IEEE-32, IEEE-64, and
IEEE-128.  (Actually, for IEEE-128 the correct value is 36 -- the 35
seems to be an oversight.)  The DECIMAL_DIG value is defined to be
the smallest number so that any number in the target format, when
printed to this number of digits and then scanned back into a binary
floating-point number, will result in the original value.

Now that we always have a FP format, we can just compute the DECIMAL_DIG
value using the formula from the C standard.  This will be correct for
*all* FP formats, not just the above list, and it will be correct (as
opposed to current code) if the target formats differ from the host ones.

The patch moves the new logic to a new floatformat_to_string routine
(analogous to the existing decimal_to_string).  The print_floating
routine now calls floatformat_to_string or decimal_to_string, making
the separate print_decimal_floating and generic_val_print_decfloat routines
unnecessary.

gdb/ChangeLog:
2017-10-24  Ulrich Weigand  <uweigand@de.ibm.com>

* doublest.c (floatformat_precision): New routine.
(floatformat_to_string): Likewise.
* doublest.c (floatformat_to_string): Add prototype.

* printcmd.c (print_scalar_formatted): Only call print_floating
on floating-point types.
* valprint.c: Do not include "floatformat.h".
(generic_val_print_decfloat): Remove.
(generic_val_print): Call generic_val_print_float for both
TYPE_CODE_FLT and TYPE_CODE_DECFLOAT.
(print_floating): Use floatformat_to_string.  Handle decimal float.
(print_decimal_floating): Remove, merge into floatformat_to_string.
* value.h (print_decimal_floating): Remove.

* Makefile.in: Do not build doublest.c with -Wformat-nonliteral.

7 years agoRISC-V: Only relax to C.LUI when imm != 0 and rd != 0/2
Andrew Waterman [Sun, 24 Sep 2017 01:04:16 +0000 (18:04 -0700)] 
RISC-V: Only relax to C.LUI when imm != 0 and rd != 0/2

This matches the ISA specification.  This also adds two tests: one to
make sure the assembler rejects invalid 'c.lui's, and one to make sure
we only relax valid 'c.lui's.

bfd/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * elfnn-riscv.c (_bfd_riscv_relax_lui): Don't relax to c.lui
        when rd is x0.

include/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * opcode/riscv.h (VALID_RVC_LUI_IMM): c.lui can't load the
        immediate 0.

gas/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * testsuite/gas/riscv/c-lui-fail.d: New testcase.
        gas/testsuite/gas/riscv/c-lui-fail.l: Likewise.
        gas/testsuite/gas/riscv/c-lui-fail.s: Likewise.
        gas/testsuite/gas/riscv/riscv.exp: Likewise.

ld/ChangeLog

2017-10-24  Andrew Waterman  <andrew@sifive.com>

        * ld/testsuite/ld-riscv-elf/c-lui.d: New testcase.
        ld/testsuite/ld-riscv-elf/c-lui.s: Likewise.
        ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp: New test suite.

7 years agoFix my previous gas/ChangeLog entry
Palmer Dabbelt [Tue, 24 Oct 2017 13:58:48 +0000 (06:58 -0700)] 
Fix my previous gas/ChangeLog entry

7 years agoi386: Support .code64 directive only with 64-bit bfd
H.J. Lu [Tue, 24 Oct 2017 14:47:32 +0000 (07:47 -0700)] 
i386: Support .code64 directive only with 64-bit bfd

Without 64-bit bfd, we can't properly support .code64 directive in
32-bit mode.

* config/tc-i386.c (md_pseudo_table): Add .code64 directive
only if BFD64 is defined.
* testsuite/gas/i386/code64-inval.l: New file.
* gas/testsuite/gas/i386/code64-inval.s: Likewise.
* gas/testsuite/gas/i386/code64.d: Likewise.
* gas/testsuite/gas/i386/code64.s: Likewise.
* testsuite/gas/i386/i386.exp: Run mixed-mode-reloc32,
att-regs, intel-regs, intel-expr and string-ok tests only if
assembler supports x86-64.  Run code64 and code64-inval.

7 years agoFix gdb.opt/inline-cmds.exp regressions
Ulrich Weigand [Tue, 24 Oct 2017 14:33:53 +0000 (16:33 +0200)] 
Fix gdb.opt/inline-cmds.exp regressions

When sorting pending blocks in end_symtab_get_static_block, blocks
with the same starting address must remain in the original order
to preserve inline function caller/callee relationships.

The original code seems to have implicitly relied on the fact that the
glibc qsort implemention actually (in the common case) provides a stable
sort, although this is not guaranteed by the standard.  But the GNU
libstdc++ std::sort implementation is *not* stable.

gdb/ChangeLog:
2017-10-24  Ulrich Weigand  <uweigand@de.ibm.com>

* buildsym.c (end_symtab_get_static_block): Use std::stable_sort.

7 years ago[BFD][PR21703]Override the new defined symbol with the old normal symbol when --allow...
Renlin Li [Tue, 24 Oct 2017 11:42:30 +0000 (12:42 +0100)] 
[BFD][PR21703]Override the new defined symbol with the old normal symbol when --allow-multiple-definition is provided.

The behavior of _bfd_elf_merge_symbol and _bfd_generic_link_add_one_symbol is
inconsistent.

In multiple definition case, _bfd_elf_merge_symbol decided to override the old
symbol definition with the new defintion, (size, type, target data)
In _bfd_generic_link_add_one_symbol, it simply return without doing anything
because of allow-multiple-definition is provided.
This leaves the symbol in a wrong state.

Here, following the documentation, I made this patch to force the old definition
override the new definition if the old symbol is not dynamic or weak.
Because, in those two cases, it's expected to do some merge. I have checked
that, those two cases are properly handled.

bfd/
PR ld/21703
* elflink.c (_bfd_elf_merge_symbol): Handle multiple definition case.

ld/

PR ld/21703
* testsuite/ld-elf/elf.exp: Run new tests.
* testsuite/ld-elf/pr21703-1.s: New.
* testsuite/ld-elf/pr21703-2.s: New.
* testsuite/ld-elf/pr21703-3.s: New.
* testsuite/ld-elf/pr21703-4.s: New.
* testsuite/ld-elf/pr21703-r.sd: New.
* testsuite/ld-elf/pr21703-shared.sd: New.
* testsuite/ld-elf/pr21703.sd: New.
* testsuite/ld-elf/pr21703.ver: New.

7 years agoReindent gdb.threads/attach-into-signal.exp
Pedro Alves [Tue, 24 Oct 2017 09:43:45 +0000 (10:43 +0100)] 
Reindent gdb.threads/attach-into-signal.exp

A previous patch removed one nesting level.

gdb/testsuite/ChangeLog:
2017-10-24  Pedro Alves  <palves@redhat.com>

* gdb.threads/attach-into-signal.exp (corefunc): Reindent.

7 years agoDrop /proc/PID/status polling from gdb.threads/attach-into-signal.exp
Pedro Alves [Tue, 24 Oct 2017 09:43:35 +0000 (10:43 +0100)] 
Drop /proc/PID/status polling from gdb.threads/attach-into-signal.exp

I noticed that the 'with_test_prefix "stoppedtry $stoppedtry"' prefix
in this testcase is unnecessary, because inside that block there are
no pass/fail calls.  In fact the block includes a comment saying:

  # No PASS message as we may be looping in multiple
  # attempts.

but looking deeper at this I noticed a few odd things with this code
block:

1. This code is assuming that the second line in the /proc/PID/status
   files is the "State:" line, which may have been true when this was
   originally written, but is not true on my machine at least (Linux
   4.8.13).

     $ cat /proc/self/status
     Name:   cat
     Umask:  0002
     State:  R (running)

   So nowadays, that 'string match "*(stopped)*"' is running against
   the "Umask:" line and thus always returns false, meaning the loop
   always breaks on $stoppedtry == 0.

2. The loop seems to be waiting for the process to become "(stopped)",
   but if so then that 'if {![string match]}' check is reversed, it
   should be checking 'if {[string match]}' instead, because "string
   match" returns true if the string matches, not 0.

3. But if we fixed all that, we'd still run into the simple fact that
   nothing is actually stopping the test's inferior process before GDB
   attaches...  The top of the testcase says:

    # This test was created by modifying attach-stopped.exp.

   ... and attach-stopped.exp does have:

       # Stop the program
       remote_exec build "kill -s STOP ${testpid}"

   but then attach-stopped.exp doesn't have an equivalent
   /proc/PID/status poll loop...  (Maybe it could.)

So remove this whole loop as useless.

gdb/testsuite/ChangeLog:
2017-10-24  Pedro Alves  <palves@redhat.com>

* gdb.threads/attach-into-signal.exp: Remove whole "stoppedtry"
loop.

7 years agoFix unstable test names in gdb.threads/attach-into-signal.exp
Pedro Alves [Tue, 24 Oct 2017 09:43:35 +0000 (10:43 +0100)] 
Fix unstable test names in gdb.threads/attach-into-signal.exp

Currently, if you diff testsuite/gdb.sum of two testsuite runs you'll
often see spurious hunks like these:

  -PASS: gdb.threads/attach-into-signal.exp: nonthreaded: attempt 2: attach (pass 2), pending signal catch
  +PASS: gdb.threads/attach-into-signal.exp: nonthreaded: attempt 1: attach (pass 2), pending signal catch
   PASS: gdb.threads/attach-into-signal.exp: successfully compiled posix threads test case
   PASS: gdb.threads/attach-into-signal.exp: threaded: handle SIGALRM stop print pass
  -PASS: gdb.threads/attach-into-signal.exp: threaded: attempt 1: attach (pass 1), pending signal catch
  -PASS: gdb.threads/attach-into-signal.exp: threaded: attempt 1: attach (pass 2), pending signal catch
  +PASS: gdb.threads/attach-into-signal.exp: threaded: attempt 2: attach (pass 1), pending signal catch
  +PASS: gdb.threads/attach-into-signal.exp: threaded: attempt 4: attach (pass 2), pending signal catch

Fix this by removing the "attempt $attempt" test prefix.  The attempt
number can be retrieved from gdb.log instead, since the testcase is
already using "verbose -log" to that effect.

(The 'with_test_prefix "stoppedtry $stoppedtry"' prefix is unnecessary
too, because inside that block there are no pass/fail calls.  In fact
the block includes a comment saying:

  # No PASS message as we may be looping in multiple
  # attempts.

but I'll drop that whole loop in the next patch instead.)

After this commit we'll show:

  PASS: gdb.threads/attach-into-signal.exp: nonthreaded: handle SIGALRM stop print pass
  PASS: gdb.threads/attach-into-signal.exp: nonthreaded: attach (pass 1), pending signal catch
  PASS: gdb.threads/attach-into-signal.exp: nonthreaded: attach (pass 2), pending signal catch
  PASS: gdb.threads/attach-into-signal.exp: successfully compiled posix threads test case
  PASS: gdb.threads/attach-into-signal.exp: threaded: handle SIGALRM stop print pass
  PASS: gdb.threads/attach-into-signal.exp: threaded: attach (pass 1), pending signal catch
  PASS: gdb.threads/attach-into-signal.exp: threaded: attach (pass 2), pending signal catch

(I've avoided reindenting to make the patch easier to maintain/read.
I'll reindent the blocks after this is in.)

gdb/testsuite/ChangeLog:
2017-10-24  Pedro Alves  <palves@redhat.com>

* gdb.threads/attach-into-signal.exp (corefunc): Remove "attach
$attempt" test prefix.

7 years agoFix unstable test names in gdb.python/py-objfile.exp
Pedro Alves [Tue, 24 Oct 2017 09:43:34 +0000 (10:43 +0100)] 
Fix unstable test names in gdb.python/py-objfile.exp

Currently, if you diff testsuite/gdb.sum of different builds you see
this spurious hunk:

  -PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id" (6a0bfcab663f9810ccff33c756afdebb940037d4)
  +PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id" (1f5531c657c57777b05fc95baa0025fd1d115c3b)

Fix this by syncing get_python_valueof with get_integer_valueof, which
stopped outputting the value in commit 2f20e312aad6
("get_integer_valueof: Don't output value in test name").

After this commit we'll show:

  PASS: gdb.python/py-objfile.exp: get python valueof "sep_objfile.build_id"

As the comment explicitly says get_python_valueof is modeled on
get_integer_valueof, I went ahead and also added the optional 'test'
parameter while at it.

gdb/testsuite/ChangeLog:
2017-10-24  Pedro Alves  <palves@redhat.com>

* lib/gdb-python.exp (get_python_valueof): Add 'test' optional
parameter and handle it.  Don't output read value in test name.

7 years agoFix unstable test names in gdb.gdb/unittest.exp
Pedro Alves [Tue, 24 Oct 2017 09:43:34 +0000 (10:43 +0100)] 
Fix unstable test names in gdb.gdb/unittest.exp

Currently, if you diff testsuite/gdb.sum of two builds built from different
source directories you see this spurious hunk:

  -PASS: gdb.gdb/unittest.exp: maintenance check xml-descriptions /home/pedro/gdb1/src/gdb/testsuite/../features
  +PASS: gdb.gdb/unittest.exp: maintenance check xml-descriptions /home/pedro/gdb2/src/gdb/testsuite/../features

After this commit we'll show instead:

  PASS: gdb.gdb/unittest.exp: maintenance check xml-descriptions ${srcdir}/../features

gdb/testsuite/ChangeLog:
2017-10-24  Pedro Alves  <palves@redhat.com>

* gdb.gdb/unittest.exp ('maintenance check xml-descriptions'): Use
custom test name.

7 years agoFix unstable test names in gdb.base/startup-with-shell.exp
Pedro Alves [Tue, 24 Oct 2017 09:43:33 +0000 (10:43 +0100)] 
Fix unstable test names in gdb.base/startup-with-shell.exp

Currently, if you diff testsuite/gdb.sum of two builds in different
directories you see these spurious hunks:

  -PASS: gdb.base/startup-with-shell.exp: touch /home/pedro/gdb1/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-extension
  +PASS: gdb.base/startup-with-shell.exp: touch /home/pedro/gdb2/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/unique-file.unique-extension

  -PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: set args /home/pedro/gdb1/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/*.unique-extension
  +PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: set args /home/pedro/gdb2/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/*.unique-extension

  -PASS: gdb.base/startup-with-shell.exp: startup_with_shell = off; run_args = *.unique-extension: set args /home/pedro/gdb1/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/*.unique-extension
  +PASS: gdb.base/startup-with-shell.exp: startup_with_shell = off; run_args = *.unique-extension: set args /home/pedro/gdb2/build/gdb/testsuite/outputs/gdb.base/startup-with-shell/*.unique-extension

Since the run_args arguments are already shown in the test prefix, we
can change the "set args" test name to literally "set args $run_args".
I.e., after this commit we'll show:

  PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = *.unique-extension: set args $run_args
  PASS: gdb.base/startup-with-shell.exp: startup_with_shell = off; run_args = *.unique-extension: set args $run_args
  PASS: gdb.base/startup-with-shell.exp: startup_with_shell = on; run_args = $TEST: set args $run_args
  PASS: gdb.base/startup-with-shell.exp: startup_with_shell = off; run_args = $TEST: set args $run_args

gdb/testsuite/ChangeLog:
2017-10-24  Pedro Alves  <palves@redhat.com>

* gdb.base/startup-with-shell.exp ('touch $unique_file'): Don't
include the unstable output directory name in the test's name.
(initial_setup_simple) <'set args'>: Use custom test name.

7 years agoFix unstable test names in gdb.arch/arc-tdesc-cpu.exp
Pedro Alves [Tue, 24 Oct 2017 09:43:33 +0000 (10:43 +0100)] 
Fix unstable test names in gdb.arch/arc-tdesc-cpu.exp

Currently if you diff testsuite/gdb.sum of two builds built from
different source trees you see this spurious hunk:

  -PASS: gdb.arch/arc-tdesc-cpu.exp: set tdesc filename /home/pedro/gdb1/src/gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml
  +PASS: gdb.arch/arc-tdesc-cpu.exp: set tdesc filename /home/pedro/gdb2/src/gdb/testsuite/gdb.arch/arc-tdesc-cpu.xml

After this commit we'll show this instead in gdb.sum:
  PASS: gdb.arch/arc-tdesc-cpu.exp: set tdesc filename $srcdir/gdb.arch/arc-tdesc-cpu.xml

gdb/testsuite/ChangeLog:
2017-10-24  Pedro Alves  <palves@redhat.com>

* gdb.arch/arc-tdesc-cpu.exp ('set tdesc filename'): Use gdb_test
with explicit test name.

7 years agoRISC-V: Don't emit 2-byte NOPs if the C extension is disabled
Palmer Dabbelt [Fri, 6 Oct 2017 19:06:45 +0000 (12:06 -0700)] 
RISC-V: Don't emit 2-byte NOPs if the C extension is disabled

Systems without the C extension mandate 4-byte alignment for
instructions, so there is no reason to allow for 2-byte alignment.  This
change avoids emitting lots of unimplemented instructions into object
files on non-C targets, which users keep reporting as a bug.  While this
isn't actually a bug (as none of the offsets in object files are
relevant until RISC-V), it is ugly.

gas/ChangeLog

2017-10-23  Palmer Dabbelt  <palmer@dabbelt.com>

        * config/tc-riscv.c (riscv_frag_align_code): Align code by 4
        bytes on non-RVC systems.

7 years agoAutomatic date update in version.in
GDB Administrator [Tue, 24 Oct 2017 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoi386: Don't add elf32_x86_64 to supported emulations
H.J. Lu [Mon, 23 Oct 2017 21:44:04 +0000 (14:44 -0700)] 
i386: Don't add elf32_x86_64 to supported emulations

For 32-bit BFD, since elf64-x86-64.o isn't compiled in, "-m elf32_x86_64"
never worked.  Don't add elf32_x86_64 to supported emulations with 32-bit
BFD.

* configure.tgt (i[3-7]86-*-linux-*): Move elf32_x86_64 from
targ_extra_libpath to targ64_extra_libpath.

7 years agoAdd missing ChangeLog entries
Igor Tsimbalist [Mon, 23 Oct 2017 20:09:26 +0000 (13:09 -0700)] 
Add missing ChangeLog entries

7 years agoMake sure that undefined symbols added to the linker command line via the -u option...
Nick Clifton [Mon, 23 Oct 2017 17:16:49 +0000 (18:16 +0100)] 
Make sure that undefined symbols added to the linker command line via the -u option appear in the output executable, if they have not been resolved.

PR 22319
bfd * elflink.c (elf_link_output_extsym): Keep global undefined
symbols if they have been marked as needed.

ld * testsuite/ld-elf/pr22310.s: New test source file.
* testsuite/ld-elf/pr22310.d: New test driver.
* testsuite/ld-mmix/undef-3.d: Update expected output from readelf.

7 years agoFix the master due to bad regenerated files
Igor Tsimbalist [Mon, 23 Oct 2017 16:28:46 +0000 (19:28 +0300)] 
Fix the master due to bad regenerated files

* i386-init.h: Regenerate
* i386-tbl.h: Likewise

7 years agoMIPS: Preset EF_MIPS_ABI2 with n32 ELF objects
Maciej W. Rozycki [Mon, 23 Oct 2017 14:39:46 +0000 (15:39 +0100)] 
MIPS: Preset EF_MIPS_ABI2 with n32 ELF objects

Fix a bug in MIPS n32 ELF object file generation and make such objects
consistent with the n32 BFD requested, by presetting the EF_MIPS_ABI2
flag in the `e_flags' member of the newly created ELF file header, as it
is this flag that tells n32 objects apart from o32 objects.

This flag will then stay set through to output file generation for
writers such as GAS or GDB's `generate-core-file' command.  Readers will
overwrite the whole of `e_flags' along with the rest of the ELF file
header in `elf_swap_ehdr_in' and then verify in `mips_elf_n32_object_p'
that the flag is still set before accepting an input file as an n32
object.

The issue was discovered with GDB's `generate-core-file' command making
o32 core files out of n32 debuggees.

bfd/
* elfn32-mips.c (mips_elf_n32_mkobject): New prototype and
function.
(bfd_elf32_mkobject): Use `mips_elf_n32_mkobject' rather than
`_bfd_mips_elf_mkobject'.

gas/
* config/tc-mips.c (mips_elf_final_processing): Don't set
EF_MIPS_ABI2 in `e_flags'.

7 years agoEnable Intel AVX512_BITALG instructions.
Igor Tsimbalist [Fri, 20 Oct 2017 20:56:30 +0000 (23:56 +0300)] 
Enable Intel AVX512_BITALG instructions.

Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

gas/

* config/tc-i386.c (cpu_arch): Add .avx512_bitalg.
(cpu_noarch): noavx512_bitalg.
* doc/c-i386.texi: Document .avx512_bitalg, noavx512_bitalg.
* testsuite/gas/i386/i386.exp: Add AVX512_BITALG tests.
* testsuite/gas/i386/avx512f_bitalg-intel.d: New test.
* testsuite/gas/i386/avx512f_bitalg.d: Likewise.
* testsuite/gas/i386/avx512f_bitalg.s: Likewise.
* testsuite/gas/i386/avx512vl_bitalg-intel.d: Likewise.
* testsuite/gas/i386/avx512vl_bitalg.d: Likewise.
* testsuite/gas/i386/avx512vl_bitalg.s: Likewise.
* testsuite/gas/i386/x86-64-avx512f_bitalg-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512f_bitalg.d: Likewise.
* testsuite/gas/i386/x86-64-avx512f_bitalg.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_bitalg-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_bitalg.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_bitalg.s: Likewise.

opcodes/

* i386-dis.c (enum): Add PREFIX_EVEX_0F3854, PREFIX_EVEX_0F388F.
(enum): Add EVEX_W_0F3854_P_2.
* i386-dis-evex.h (evex_table): Updated.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_BITALG,
CPU_ANY_AVX512_BITALG_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
(cpu_flags): Add CpuAVX512_BITALG.
* i386-opc.h (enum): Add CpuAVX512_BITALG.
(i386_cpu_flags): Add cpuavx512_bitalg..
* i386-opc.tbl: Add Intel AVX512_BITALG instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.

7 years agoEnable Intel AVX512_VNNI instructions.
Igor Tsimbalist [Fri, 20 Oct 2017 20:52:52 +0000 (23:52 +0300)] 
Enable Intel AVX512_VNNI instructions.

Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

gas/

* config/tc-i386.c (cpu_arch): Add .avx512_vnni.
(cpu_noarch): Add noavx512_vnni.
* doc/c-i386.texi: Document .avx512_vnni.
* testsuite/gas/i386/i386.exp: Add AVX512_VNNI tests.
* testsuite/gas/i386/avx512vnni-intel.d: New test.
* testsuite/gas/i386/avx512vnni.d: Likewise.
* testsuite/gas/i386/avx512vnni.s: Likewise.
* testsuite/gas/i386/avx512vnni_vl-intel.d: Likewise.
* testsuite/gas/i386/avx512vnni_vl.d: Likewise.
* testsuite/gas/i386/avx512vnni_vl.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni_vl-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni_vl.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vnni_vl.s: Likewise.

opcodes/

* i386-dis.c (enum): Add PREFIX_EVEX_0F3850, PREFIX_EVEX_0F3851.
* i386-dis-evex.h (evex_table): Updated.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_VNNI,
CPU_ANY_AVX512_VNNI_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
(cpu_flags): Add CpuAVX512_VNNI.
* i386-opc.h (enum): Add CpuAVX512_VNNI.
(i386_cpu_flags): Add cpuavx512_vnni.
* i386-opc.tbl Add Intel AVX512_VNNI instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.

7 years agoEnable Intel VPCLMULQDQ instruction.
Igor Tsimbalist [Fri, 20 Oct 2017 20:42:40 +0000 (23:42 +0300)] 
Enable Intel VPCLMULQDQ instruction.

Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

gas/

* config/tc-i386.c (cpu_arch): Add VPCLMULQDQ.
* doc/c-i386.texi: Document VPCLMULQDQ.
* testsuite/gas/i386/i386.exp: Run VPCLMULQDQ tests.
* testsuite/gas/i386/avx512f_vpclmulqdq-intel.d: New test.
* testsuite/gas/i386/avx512f_vpclmulqdq-wig.s: Ditto.
* testsuite/gas/i386/avx512f_vpclmulqdq-wig1-intel.d: Ditto.
* testsuite/gas/i386/avx512f_vpclmulqdq-wig1.d: Ditto.
* testsuite/gas/i386/avx512f_vpclmulqdq.d: Ditto.
* testsuite/gas/i386/avx512f_vpclmulqdq.s: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq-wig.s: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq-wig1-intel.d: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq-wig1.d: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq.d: Ditto.
* testsuite/gas/i386/avx512vl_vpclmulqdq.s: Ditto.
* testsuite/gas/i386/vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/vpclmulqdq.d: Ditto.
* testsuite/gas/i386/vpclmulqdq.s: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq-wig.s: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq-wig1-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq-wig1.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vpclmulqdq.s: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq-wig.s: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq-wig1-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq-wig1.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vpclmulqdq.s: Ditto.
* testsuite/gas/i386/x86-64-vpclmulqdq-intel.d: Ditto.
* testsuite/gas/i386/x86-64-vpclmulqdq.d: Ditto.
* testsuite/gas/i386/x86-64-vpclmulqdq.s: Ditto.

opcodes/

* i386-dis.c (enum): Add PREFIX_EVEX_0F3A44.
(enum): Remove VEX_LEN_0F3A44_P_2.
(vex_len_table): Ditto.
(enum): Remove VEX_W_0F3A44_P_2.
(vew_w_table): Ditto.
(prefix_table): Adjust instructions (see prefixes above).
* i386-dis-evex.h (evex_table):
Add new instructions (see prefixes above).
* i386-gen.c (cpu_flag_init): Add VPCLMULQDQ.
(bitfield_cpu_flags): Ditto.
* i386-opc.h (enum): Ditto.
(i386_cpu_flags): Ditto.
(CpuUnused): Comment out to avoid zero-width field problem.
* i386-opc.tbl (vpclmulqdq): New instruction.
* i386-init.h: Regenerate.
* i386-tbl.h: Ditto.

7 years agoEnable Intel VAES instructions.
Igor Tsimbalist [Fri, 20 Oct 2017 20:35:45 +0000 (23:35 +0300)] 
Enable Intel VAES instructions.

Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

gas/

* config/tc-i386.c (cpu_arch): Add VAES.
* doc/c-i386.texi: Document VAES.
* testsuite/gas/i386/i386.exp: Run VAES tests.
* testsuite/gas/i386/avx512f_vaes-intel.d: New test.
* testsuite/gas/i386/avx512f_vaes-wig.s: Ditto.
* testsuite/gas/i386/avx512f_vaes-wig1-intel.d: Ditto.
* testsuite/gas/i386/avx512f_vaes-wig1.d: Ditto.
* testsuite/gas/i386/avx512f_vaes.d: Ditto.
* testsuite/gas/i386/avx512f_vaes.s: Ditto.
* testsuite/gas/i386/avx512vl_vaes-intel.d: Ditto.
* testsuite/gas/i386/avx512vl_vaes-wig.s: Ditto.
* testsuite/gas/i386/avx512vl_vaes-wig1-intel.d: Ditto.
* testsuite/gas/i386/avx512vl_vaes-wig1.d: Ditto.
* testsuite/gas/i386/avx512vl_vaes.d: Ditto.
* testsuite/gas/i386/avx512vl_vaes.s: Ditto.
* testsuite/gas/i386/vaes-intel.d: Ditto.
* testsuite/gas/i386/vaes.d: Ditto.
* testsuite/gas/i386/vaes.s: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes-wig.s: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes-wig1-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes-wig1.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes.d: Ditto.
* testsuite/gas/i386/x86-64-avx512f_vaes.s: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes-wig.s: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes-wig1-intel.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes-wig1.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes.d: Ditto.
* testsuite/gas/i386/x86-64-avx512vl_vaes.s: Ditto.
* testsuite/gas/i386/x86-64-vaes-intel.d: Ditto.
* testsuite/gas/i386/x86-64-vaes.d: Ditto.
* testsuite/gas/i386/x86-64-vaes.s: Ditto.

opcodes/

* i386-dis.c (enum): Add PREFIX_EVEX_0F38DC, PREFIX_EVEX_0F38DD,
PREFIX_EVEX_0F38DE, PREFIX_EVEX_0F38DF.
(enum): Remove VEX_LEN_0F38DC_P_2, VEX_LEN_0F38DD_P_2,
VEX_LEN_0F38DE_P_2, VEX_LEN_0F38DF_P_2.
(vex_len_table): Ditto.
(enum): Remove VEX_W_0F38DC_P_2, VEX_W_0F38DD_P_2,
VEX_W_0F38DE_P_2, VEX_W_0F38DF_P_2.
(vew_w_table): Ditto.
(prefix_table): Adjust instructions (see prefixes above).
* i386-dis-evex.h (evex_table):
Add new instructions (see prefixes above).
* i386-gen.c (cpu_flag_init): Add VAES.
(bitfield_cpu_flags): Ditto.
* i386-opc.h (enum): Ditto.
(i386_cpu_flags): Ditto.
* i386-opc.tbl (vaes{enc,dec}{last,}): New instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Ditto.

7 years agoEnable Intel GFNI instructions.
Igor Tsimbalist [Fri, 20 Oct 2017 20:26:11 +0000 (23:26 +0300)] 
Enable Intel GFNI instructions.

Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

gas/

* config/tc-i386.c (cpu_arch): Add .gfni.
* doc/c-i386.texi: Document .gfni.
* testsuite/gas/i386/i386.exp: Add GFNI tests.
* testsuite/gas/i386/avx.s: New GFNI test.
* testsuite/gas/i386/x86-64-avx.s: Likewise.
* testsuite/gas/i386/avx.d: Adjust.
* testsuite/gas/i386/avx-intel.d: Likewise
* testsuite/gas/i386/ilp32/x86-64-avx-intel.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-avx.d: Likewise.
* testsuite/gas/i386/avx512f_gfni-intel.d: New test.
* testsuite/gas/i386/avx512f_gfni.d: Likewise.
* testsuite/gas/i386/avx512f_gfni.s: Likewise.
* testsuite/gas/i386/avx512vl_gfni-intel.d: Likewise.
* testsuite/gas/i386/avx512vl_gfni.d: Likewise.
* testsuite/gas/i386/avx512vl_gfni.s: Likewise.
* testsuite/gas/i386/gfni-intel.d: Likewise.
* testsuite/gas/i386/gfni.d: Likewise.
* testsuite/gas/i386/gfni.s: Likewise.
* testsuite/gas/i386/x86-64-avx512f_gfni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512f_gfni.d: Likewise.
* testsuite/gas/i386/x86-64-avx512f_gfni.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_gfni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_gfni.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vl_gfni.s: Likewise.
* testsuite/gas/i386/x86-64-avx_gfni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx_gfni.d: Likewise.
* testsuite/gas/i386/x86-64-avx_gfni.s: Likewise.
* testsuite/gas/i386/x86-64-gfni-intel.d: Likewise.
* testsuite/gas/i386/x86-64-gfni.d: Likewise.
* testsuite/gas/i386/x86-64-gfni.s: Likewise.

opcodes/

* i386-dis.c (enum): Add PREFIX_0F38CF, PREFIX_0F3ACE, PREFIX_0F3ACF,
PREFIX_VEX_0F38CF, PREFIX_VEX_0F3ACE, PREFIX_VEX_0F3ACF,
PREFIX_EVEX_0F38CF, PREFIX_EVEX_0F3ACE, PREFIX_EVEX_0F3ACF.
(enum): Add VEX_W_0F38CF_P_2, VEX_W_0F3ACE_P_2, VEX_W_0F3ACF_P_2,
EVEX_W_0F3ACE_P_2, EVEX_W_0F3ACF_P_2.
(prefix_table): Updated (see prefixes above).
(three_byte_table): Likewise.
(vex_w_table): Likewise.
* i386-dis-evex.h: Likewise.
* i386-gen.c (cpu_flag_init): Add CPU_GFNI_FLAGS, CpuGFNI.
(cpu_flags): Add CpuGFNI.
* i386-opc.h (enum): Add CpuGFNI.
(i386_cpu_flags): Add cpugfni.
* i386-opc.tbl: Add Intel GFNI instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.

7 years agoEnable Intel AVX512_VBMI2 instructions.
Igor Tsimbalist [Fri, 20 Oct 2017 19:52:59 +0000 (22:52 +0300)] 
Enable Intel AVX512_VBMI2 instructions.

Intel has disclosed a set of new instructions. The spec is
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

gas/

* config/tc-i386.c (cpu_arch): Add .avx512_vbmi2.
(cpu_noarch): noavx512_vbmi2.
* doc/c-i386.texi: Document .avx512_vbmi2, noavx512_vbmi2.
* testsuite/gas/i386/i386.exp: Add AVX512_VBMI2 tests.
* testsuite/gas/i386/avx512vbmi2-intel.d: New test.
* testsuite/gas/i386/avx512vbmi2.d: Likewise.
* testsuite/gas/i386/avx512vbmi2.s: Likewise.
* testsuite/gas/i386/avx512vbmi2_vl-intel.d: Likewise.
* testsuite/gas/i386/avx512vbmi2_vl.d: Likewise.
* testsuite/gas/i386/avx512vbmi2_vl.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2.s: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2_vl-intel.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2_vl.d: Likewise.
* testsuite/gas/i386/x86-64-avx512vbmi2_vl.s: Likewise.

opcodes/

* i386-dis.c (enum): Add b_scalar_mode, w_scalar_mode.
Define EXbScalar and EXwScalar for OP_EX.
(enum): Add PREFIX_EVEX_0F3862, PREFIX_EVEX_0F3863,
PREFIX_EVEX_0F3870, PREFIX_EVEX_0F3871, PREFIX_EVEX_0F3872,
PREFIX_EVEX_0F3873, PREFIX_EVEX_0F3A70, PREFIX_EVEX_0F3A71,
PREFIX_EVEX_0F3A72, PREFIX_EVEX_0F3A73.
(enum): Add EVEX_W_0F3862_P_2, EVEX_W_0F3863_P_2,
EVEX_W_0F3870_P_2, EVEX_W_0F3871_P_2, EVEX_W_0F3872_P_2,
EVEX_W_0F3873_P_2, EVEX_W_0F3A70_P_2, EVEX_W_0F3A71_P_2,
EVEX_W_0F3A72_P_2, EVEX_W_0F3A73_P_2.
(intel_operand_size): Handle b_scalar_mode and w_scalar_mode.
(OP_E_memory): Likewise.
* i386-dis-evex.h: Updated.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512_VBMI2,
CPU_ANY_AVX512_VBMI2_FLAGS. Update CPU_ANY_AVX512F_FLAGS.
(cpu_flags): Add CpuAVX512_VBMI2.
* i386-opc.h (enum): Add CpuAVX512_VBMI2.
(i386_cpu_flags): Add cpuavx512_vbmi2.
* i386-opc.tbl: Add Intel AVX512_VBMI2 instructions.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.

7 years agoAutomatic date update in version.in
GDB Administrator [Mon, 23 Oct 2017 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoFix spurious left-over quotes from last edit.
Hans-Peter Nilsson [Sun, 22 Oct 2017 11:32:44 +0000 (13:32 +0200)] 
Fix spurious left-over quotes from last edit.

With a 32-bit bfd (default on an ILP32 system) the previous markings
on tests *were* correct.  There, the results have been consistent
since they were added.  The tests would appear to "spuriously" xpass
"only" on LP64 hosts, which were not the norm in 2000.  (But, now CRIS
requires a 64-bit BFD.)

7 years agoFix gas/22304 by forcing a 64-bit bfd for cris*-*.
Hans-Peter Nilsson [Sun, 22 Oct 2017 11:05:07 +0000 (13:05 +0200)] 
Fix gas/22304 by forcing a 64-bit bfd for cris*-*.

PR gas/22304
* config.bfd (cris-*-* | crisv32-*-*): Require a 64-bit BFD.

7 years agoAutomatic date update in version.in
GDB Administrator [Sun, 22 Oct 2017 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoPR ld/21233
Hans-Peter Nilsson [Sat, 21 Oct 2017 17:46:22 +0000 (19:46 +0200)] 
PR ld/21233

* testsuite/ld-elf/shared.exp: Remove kfails.

The test-cases started passing with 5c3261b0e834647c,
"ELF: Call check_relocs after opening all inputs".

The lists could now be re-concatenated (see other run_ld_link_tests
calls in shared.exp), but are for now left separate to simplify future
kfail/xfailing.

7 years agoAdd overloads of for_each_thread/find_thread that filter on pid
Simon Marchi [Sat, 21 Oct 2017 16:20:21 +0000 (12:20 -0400)] 
Add overloads of for_each_thread/find_thread that filter on pid

It happens often that we want to iterate or find threads restricted to a
given pid.  I think it's worth having an overload to help with this.
Right now there is a single user of each of the find_thread and
for_each_thread overload, but as we replace the usages of find_inferior
with for_each_thread/find_thread, more usages will pop up.

gdb/gdbserver/ChangeLog:

* gdbthread.h (find_thread, for_each_thread): New functions.
* inferiors.c (thread_of_pid): Remove.
(find_any_thread_of_pid): Use find_thread.
* linux-low.c (num_lwps): Use for_each_thread.

7 years agoGet rid of VEC (mem_region)
Simon Marchi [Sat, 21 Oct 2017 16:06:42 +0000 (12:06 -0400)] 
Get rid of VEC (mem_region)

This patch removes VEC (mem_region).  Doing so requires touching a lot
of little things here and there.

The fields in mem_attrib are now initialized during construction.  The
values match those that were in default_mem_attrib (now removed).
unknown_mem_attrib is also removed, and replaced with a static method
(mem_attrib::unknown) that returns the equivalent.

mem_region is initialized in a way similar to mem_region_init (now
removed) did.

I found the organization of mem_region_list and target_mem_region_list a
bit confusing.  Sometimes mem_region_list points to the same vector as
target_mem_region_list (and therefore does not own it), and sometimes
(when the user manually edits the mem regions) points to another vector,
and in this case owns it.  To avoid this ambiguity, I think it is
simpler to have two vectors, one for target-defined regions and one for
user-defined regions, and have mem_region_list point to one or the
other.  There are now no vector objects dynamically allocated, both are
static.

The make-target-delegates script does not generate valid code when a
target method returns a type with a parameter list.  For this reason, I
created a typedef (mem_region_vector) that's only used in the target_ops
structure.  If you speak perl, you are welcome to improve the script!

Regtested on the buildbot.

gdb/ChangeLog:

* memattr.h: Don't include vec.h.
(struct mem_attrib): Initialize fields.
<unknown>: New static method.
(struct mem_region): Add constructors, operator<, initialize
fields.
* memattr.c: Include algorithm.
(default_mem_attrib, unknown_mem_attrib): Remove.
(user_mem_region_list): New global.
(target_mem_region_list, mem_region_list): Change type to
std::vector<mem_region>.
(mem_use_target): Now a function.
(target_mem_regions_valid): Change type to bool.
(mem_region_lessthan, mem_region_cmp, mem_region_init): Remove.
(require_user_regions): Adjust.
(require_target_regions): Adjust.
(create_mem_region): Adjust.
(lookup_mem_region): Adjust.
(invalidate_target_mem_regions): Adjust.
(mem_clear): Rename to...
(user_mem_clear): ... this, and adjust.
(mem_command): Adjust.
(info_mem_command): Adjust.
(mem_enable, enable_mem_command, mem_disable,
disable_mem_command): Adjust.
(mem_delete): Adjust.
(delete_mem_command): Adjust.
* memory-map.h (parse_memory_map): Return an std::vector.
* memory-map.c (parse_memory_map): Likewise.
(struct memory_map_parsing_data): Add constructor.
<memory_map>: Point to std::vector.
(memory_map_start_memory): Adjust.
(memory_map_end_memory): Adjust.
(memory_map_end_property): Adjust.
(clear_result): Remove.
* remote.c (remote_memory_map): Return an std::vector.
* target-debug.h (target_debug_print_VEC_mem_region_s__p):
Remove.
(target_debug_print_mem_region_vector): New.
* target-delegates.c: Regenerate.
* target.h (mem_region_vector): New typedef.
(to_memory_map): Return mem_region_vector.
(target_memory_map): Return an std::vector.
* target.c (target_memory_map): Return an std::vector.
(flash_erase_command): Adjust.

7 years agoUse std::string in memory_map_parsing_data
Simon Marchi [Sat, 21 Oct 2017 16:06:22 +0000 (12:06 -0400)] 
Use std::string in memory_map_parsing_data

Replace the fixed-size array with a string.

gdb/ChangeLog:

* memory-map.c (struct memory_map_parsing_data) <property_name>:
Change type to std::string.
(memory_map_start_property): Adjust.
(memory_map_end_property): Adjust.

7 years agoCreate a displaced_step_closure class hierarchy
Simon Marchi [Sat, 21 Oct 2017 15:27:52 +0000 (11:27 -0400)] 
Create a displaced_step_closure class hierarchy

displaced_step_closure is a type defined in multiple -tdep.c files.
Trying to xfree it from the common code (infrun.c) is a problem when we
try to poison xfree for non-POD types.  Because there can be multiple of
these types in the same build, this patch makes a hierarchy of classes
with a virtual destructor.  When the common code deletes the object
through a displaced_step_closure pointer, it will invoke the right
destructor.

The amd64 used a last-member array with a variable size.  That doesn't
work with new, so I changed it for an std::vector.  Other architectures
which used a simple byte buffer as a closure now use a shared
buf_displaced_step_closure, a closure type that only contains a
gdb::byte_vector.

Reg-tested on the buildbot.

gdb/ChangeLog:

* infrun.h: Include common/byte-vector.h.
(struct displaced_step_closure): New struct.
(struct buf_displaced_step_closure): New struct.
* infrun.c (displaced_step_closure::~displaced_step_closure):
Provide default implementation.
(displaced_step_clear): Deallocate step closure with delete.
* aarch64-tdep.c (displaced_step_closure): Rename to ...
(aarch64_displaced_step_closure): ... this, extend
displaced_step_closure.
(aarch64_displaced_step_data) <dsc>: Change type to
aarch64_displaced_step_closure.
(aarch64_displaced_step_copy_insn): Adjust to type change, use
unique_ptr.
(aarch64_displaced_step_fixup): Add cast for displaced step
closure.
* amd64-tdep.c (displaced_step_closure): Rename to ...
(amd64_displaced_step_closure): ... this, extend
displaced_step_closure.
<insn_buf>: Change type to std::vector<gdb_byte>.
<max_len>: Remove.
(fixup_riprel): Change type of DSC parameter, adjust to type
change of insn_buf.
(fixup_displaced_copy): Change type of DSC parameter.
(amd64_displaced_step_copy_insn): Instantiate
amd64_displaced_step_closure.
(amd64_displaced_step_fixup): Add cast for closure type, adjust
to type change of insn_buf.
* arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of
parameter DSC.
(arm_linux_copy_svc): Likewise.
(cleanup_kernel_helper_return): Likewise.
(arm_catch_kernel_helper_return): Likewise.
(arm_linux_displaced_step_copy_insn): Instantiate
arm_displaced_step_closure.
* arm-tdep.c (arm_pc_is_thumb): Add cast for closure.
(displaced_read_reg): Change type of parameter DSC.
(branch_write_pc): Likewise.
(load_write_pc): Likewise.
(alu_write_pc): Likewise.
(displaced_write_reg): Likewise.
(arm_copy_unmodified): Likewise.
(thumb_copy_unmodified_32bit): Likewise.
(thumb_copy_unmodified_16bit): Likewise.
(cleanup_preload): Likewise.
(install_preload): Likewise.
(arm_copy_preload): Likewise.
(thumb2_copy_preload): Likewise.
(install_preload_reg): Likewise.
(arm_copy_preload_reg): Likewise.
(cleanup_copro_load_store): Likewise.
(install_copro_load_store): Likewise.
(arm_copy_copro_load_store) Likewise.
(thumb2_copy_copro_load_store): Likewise.
(cleanup_branch): Likewise.
(install_b_bl_blx): Likewise.
(arm_copy_b_bl_blx): Likewise.
(thumb2_copy_b_bl_blx): Likewise.
(thumb_copy_b): Likewise.
(install_bx_blx_reg): Likewise.
(arm_copy_bx_blx_reg): Likewise.
(thumb_copy_bx_blx_reg): Likewise.
(cleanup_alu_imm): Likewise.
(arm_copy_alu_imm): Likewise.
(thumb2_copy_alu_imm): Likewise.
(cleanup_alu_reg): Likewise.
(install_alu_reg): Likewise.
(arm_copy_alu_reg): Likewise.
(thumb_copy_alu_reg): Likewise.
(cleanup_alu_shifted_reg): Likewise.
(install_alu_shifted_reg): Likewise.
(arm_copy_alu_shifted_reg): Likewise.
(cleanup_load): Likewise.
(cleanup_store): Likewise.
(arm_copy_extra_ld_st): Likewise.
(install_load_store): Likewise.
(thumb2_copy_load_literal): Likewise.
(thumb2_copy_load_reg_imm): Likewise.
(arm_copy_ldr_str_ldrb_strb): Likewise.
(cleanup_block_load_all): Likewise.
(cleanup_block_store_pc): Likewise.
(cleanup_block_load_pc): Likewise.
(arm_copy_block_xfer): Likewise.
(thumb2_copy_block_xfer): Likewise.
(cleanup_svc): Likewise.
(install_svc): Likewise.
(arm_copy_svc): Likewise.
(thumb_copy_svc): Likewise.
(arm_copy_undef): Likewise.
(thumb_32bit_copy_undef): Likewise.
(arm_copy_unpred): Likewise.
(arm_decode_misc_memhint_neon): Likewise.
(arm_decode_unconditional): Likewise.
(arm_decode_miscellaneous): Likewise.
(arm_decode_dp_misc): Likewise.
(arm_decode_ld_st_word_ubyte): Likewise.
(arm_decode_media): Likewise.
(arm_decode_b_bl_ldmstm): Likewise.
(arm_decode_ext_reg_ld_st): Likewise.
(thumb2_decode_dp_shift_reg): Likewise.
(thumb2_decode_ext_reg_ld_st): Likewise.
(arm_decode_svc_copro): Likewise.
(thumb2_decode_svc_copro): Likewise.
(install_pc_relative): Likewise.
(thumb_copy_pc_relative_16bit): Likewise.
(thumb_decode_pc_relative_16bit): Likewise.
(thumb_copy_pc_relative_32bit): Likewise.
(thumb_copy_16bit_ldr_literal): Likewise.
(thumb_copy_cbnz_cbz): Likewise.
(thumb2_copy_table_branch): Likewise.
(cleanup_pop_pc_16bit_all): Likewise.
(thumb_copy_pop_pc_16bit): Likewise.
(thumb_process_displaced_16bit_insn): Likewise.
(decode_thumb_32bit_ld_mem_hints): Likewise.
(thumb_process_displaced_32bit_insn): Likewise.
(thumb_process_displaced_insn): Likewise.
(arm_process_displaced_insn): Likewise.
(arm_displaced_init_closure): Likewise.
(arm_displaced_step_fixup): Add cast for closure.
* arm-tdep.h: Include infrun.h.
(displaced_step_closure): Rename to ...
(arm_displaced_step_closure): ... this, extend
displaced_step_closure.
<u::svc::copy_svc_os>: Change type of parameter DSC.
<cleanup>: Likewise.
(arm_process_displaced_insn): Likewise.
(arm_displaced_init_closure): Likewise.
(displaced_read_reg): Likewise.
(displaced_write_reg): Likewise.
* i386-linux-tdep.c (i386_linux_displaced_step_copy_insn):
Adjust.
* i386-tdep.h: Include infrun.h.
(i386_displaced_step_closure): New typedef.
* i386-tdep.c (i386_displaced_step_copy_insn): Use
i386_displaced_step_closure.
(i386_displaced_step_fixup): Adjust.
* rs6000-tdep.c (ppc_displaced_step_closure): New typedef.
(ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure
and unique_ptr.
(ppc_displaced_step_fixup): Adjust.
* s390-linux-tdep.c (s390_displaced_step_closure): New typedef.
(s390_displaced_step_copy_insn): Use s390_displaced_step_closure
and unique_ptr.
(s390_displaced_step_fixup): Adjust.

7 years agoRemove leftover declarations in interps.h
Simon Marchi [Sat, 21 Oct 2017 14:15:48 +0000 (10:15 -0400)] 
Remove leftover declarations in interps.h

The corresponding definitions have already been removed.

gdb/ChangeLog:

* interps.h (interp_resume, interp_suspend, interp_set_temp):
Remove declarations.

7 years agoAutomatic date update in version.in
GDB Administrator [Sat, 21 Oct 2017 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoFix ChangeLog entry.
Sriraman Tallam [Fri, 20 Oct 2017 18:21:45 +0000 (11:21 -0700)] 
Fix ChangeLog entry.

7 years agoNew gold linker option -z,text-unlikely-segment.
Sriraman Tallam [Fri, 20 Oct 2017 18:00:28 +0000 (11:00 -0700)] 
New gold linker option -z,text-unlikely-segment.

2017-10-04  Sriraman Tallam  <tmsriram@google.com>

* options.h (-z,text_unlikely_segment): New option.
* layout.cc (Layout::layout): Create new output section
for .text.unlikely sections with the new option.
(Layout::segment_precedes): Check for the new option
when segment flags match.
* testsuite/text_unlikely_segment.cc: New test source.
* testsuite/text_unlikely_segment.sh: New test script.
* testsuite/Makefile.am (text_unlikely_segment): New test.
* testsuite/Makefile.in: Regenerate.

7 years agoAdd a compile-time test for PR ld/22269
H.J. Lu [Fri, 20 Oct 2017 16:47:08 +0000 (09:47 -0700)] 
Add a compile-time test for PR ld/22269

This compile-time test requires a target C compiler to run.  It fails
on many targets where ELF backend linkers fail to check undefined weak
symbol in static PIE via UNDEFWEAK_NO_DYNAMIC_RELOC.

PR ld/22269
* testsuite/ld-elf/pr22269-1.rd: New file.
* testsuite/ld-elf/pr22269-1.c: Likewise.
* testsuite/ld-elf/shared.exp: Run pr22269-1.

7 years agoUse std::vector in gdb_bfd_data
Tom Tromey [Sun, 15 Oct 2017 17:31:46 +0000 (11:31 -0600)] 
Use std::vector in gdb_bfd_data

This changes gdb_bfd_data to use std::vector rather than VEC.

ChangeLog
2017-10-20  Tom Tromey  <tom@tromey.com>

* gdb_bfd.c (struct gdb_bfd_data) <included_bfds>: Now a
std::vector.
(gdb_bfd_record_inclusion): Update.
(bfdp): Remove typedef.

7 years agoUse "new" to allocate gdb_bfd_data
Tom Tromey [Sun, 15 Oct 2017 17:23:22 +0000 (11:23 -0600)] 
Use "new" to allocate gdb_bfd_data

This changes gdb_bfd_data to be allocated with new and destroyed with
delete.

ChangeLog
2017-10-20  Tom Tromey  <tom@tromey.com>

* gdb_bfd.c (gdb_bfd_ref): Use new.
(struct gdb_bfd_data): Add constructor, destructor, and member
initializers.
(gdb_bfd_unref): Use delete.

7 years agoIntroduce new_bfd_ref
Tom Tromey [Sun, 15 Oct 2017 17:13:29 +0000 (11:13 -0600)] 
Introduce new_bfd_ref

This introduces a helper function, new_bfd_ref, that calls gdb_bfd_ref
and returns a gdb_bfd_ref_ptr.  Then it updates several places to use
this.

ChangeLog
2017-10-20  Tom Tromey  <tom@tromey.com>

* exec.c (exec_file_attach): Use new_bfd_ref.
* symfile-mem.c (symbol_file_add_from_memory): Use new_bfd_ref.
* gdb_bfd.c (gdb_bfd_open, gdb_bfd_fopen, gdb_bfd_openr)
(gdb_bfd_openw, gdb_bfd_openr_iovec, gdb_bfd_fdopenr): Use
new_bfd_ref.
* gdb_bfd.h (new_bfd_ref): New function.

7 years agoFix 'gdb.base/quit.exp hangs forever' if the test fails
Pedro Alves [Fri, 20 Oct 2017 14:33:57 +0000 (15:33 +0100)] 
Fix 'gdb.base/quit.exp hangs forever' if the test fails

The [wait -i $gdb_spawn_id] in the test is dangerous in the sense that
it won't be subject to timeout logic.  So if GDB fails quiting, this
testcase hangs forever, hanging the test run with it.  See:
  https://sourceware.org/ml/gdb-patches/2016-10/msg00728.html

Instead of 'wait'ing directly, use gdb_test_multiple and expect 'eof'.

Tested that the testcase no longer hangs by hacking the test to send
"info threads" instead of "quit".

Tested with
  --target_board={unix, native-gdbserver,native-extended-gdbserver}
and tested with
  --host_board=local-remote-host
as well.

gdb/testsuite/ChangeLog:
2017-10-20  Pedro Alves  <palves@redhat.com>

* gdb.base/quit.exp: Use gdb_test_multiple and expect 'eof' before
'wait -i'.  Use gdb_assert and remote_close.

7 years agoFix gdb.gdb/ selftest tests when testing optimized GDB builds
Pedro Alves [Fri, 20 Oct 2017 13:47:24 +0000 (14:47 +0100)] 
Fix gdb.gdb/ selftest tests when testing optimized GDB builds

After commit bf4692711232 ("Eliminate catch_errors"), GCC started
inlining captured_command_loop in captured_main.  And setting a
breakpoint on captured_command_loop makes the inferior GDB stop in
captured_main, _after_ captured_command_loop's call to
interp_pre_command_loop, which prints the inferior GDB's prompt, has
already executed, confusing the gdb.gdb/ selftest tests:

  (gdb) FAIL: gdb.gdb/complaints.exp: run until breakpoint at captured_command_loop
  WARNING: Couldn't test self

Debugging GDB with GDB manually, we see:

  (top-gdb) b captured_command_loop
  Breakpoint 1 at 0x71ee60: file src/gdb/main.c, line 324.
  (top-gdb) r
  [....]
  (gdb)                  <<<<<< PROMPT HERE
  Thread 1 "gdb" hit Breakpoint 1, captured_main (data=<optimized out>) at src/gdb/main.c:1147
  1147              captured_command_loop ();
  (top-gdb)

Note the stop at 'captured_main', and the "PROMPT HERE" line.  That
prompt does not show up when debugging a non-optimized build of GDB.

Fix this by preventing inlining of captured_command_loop.

Ref: https://sourceware.org/ml/gdb-patches/2017-10/msg00522.html

gdb/ChangeLog:
2017-10-20  Pedro Alves  <palves@redhat.com>

* main.c (captured_command_loop): Add attribute noinline.

7 years agoImprove handling of REPT pseudo op with a negative count.
Nick Clifton [Fri, 20 Oct 2017 10:45:19 +0000 (11:45 +0100)] 
Improve handling of REPT pseudo op with a negative count.

PR 22324
* read.c (s_rept): Use size_t type for count parameter.
(do_repeat): Change type of count parameter to size_t.
Issue an error is the count parameter is negative.
(do_repeat_with_expression): Likewise.
* read.h: Update prototypes for do_repeat and
do_repeat_with_expression.
* doc/as.texinfo (Rept): Document that a zero count is allowed but
negative counts are not.
* config/tc-rx.c (rx_rept): Use size_t type for count parameter.
* config/tc-tic54x.c (tic54x_loop): Cast count parameter to size_t
type.
* testsuite/gas/macros/end.s: Add a test using a negative repeat
count.
* testsuite/gas/macros/end.l: Add expected error message.

7 years agoImplement BE8 support for ARM.
Umesh Kalappa [Fri, 20 Oct 2017 03:53:14 +0000 (20:53 -0700)] 
Implement BE8 support for ARM.

gold/
* arm.cc (Stub::do_fixed_endian_write):Far call stubs support for arm
in the be8 mode.
* testsuite/Makefile.am: New test cases.
* testsuite/Makefile.in: Regenerate.
* testsuite/arm_farcall_arm_arm_be8.sh: New script for arm to arm far
call stubs.
* testsuite/arm_farcall_thumb_thumb_be8.sh: New script for thumb to
thumb far call stubs.

7 years agoGet rid of VEC(interp_factory_p)
Simon Marchi [Fri, 20 Oct 2017 02:07:15 +0000 (22:07 -0400)] 
Get rid of VEC(interp_factory_p)

Replace it with an std::vector.

gdb/ChangeLog:

* interps.c (struct interp_factory): Add constructor.
(interp_factory_p): Remove typedef.
(DEF_VEC_P(interp_factory_p)): Remove.
(interpreter_factories): Change type to std::vector.
(interp_factory_register): Adjust.
(interp_lookup): Adjust.
(interpreter_completer): Adjust.

7 years agoAutomatic date update in version.in
GDB Administrator [Fri, 20 Oct 2017 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agoRemove cleanups from break-catch-syscall.c
Tom Tromey [Mon, 16 Oct 2017 23:36:32 +0000 (17:36 -0600)] 
Remove cleanups from break-catch-syscall.c

This removes the remaining cleanups from break-catch-syscall.c by
storing temporary strings in a vector.

ChangeLog
2017-10-19  Tom Tromey  <tom@tromey.com>

* break-catch-syscall.c (catch_syscall_completer): Use
std::string, gdb::unique_xmalloc_ptr.

7 years agoRemove cleanup from call_function_by_hand_dummy
Tom Tromey [Mon, 16 Oct 2017 23:27:21 +0000 (17:27 -0600)] 
Remove cleanup from call_function_by_hand_dummy

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

ChangeLog
2017-10-19  Tom Tromey  <tom@tromey.com>

* infcall.c (call_function_by_hand_dummy): Use std::string.

7 years agoRemove cleanups from prepare_execute_command
Tom Tromey [Mon, 16 Oct 2017 23:26:09 +0000 (17:26 -0600)] 
Remove cleanups from prepare_execute_command

This changes prepare_execute_command to return a scoped_value_mark
rather than a cleanup.

ChangeLog
2017-10-19  Tom Tromey  <tom@tromey.com>

* mi/mi-main.c (mi_cmd_execute): Update.
* top.h (prepare_execute_command): Return scoped_value_mark.
* value.h (class scoped_value_mark): Use DISABLE_COPY_AND_ASSIGN.
Add move constructor.
* top.c (prepare_execute_command): Return scoped_value_mark.
(execute_command): Update.

7 years agogdb: Remove hard-coded line number from test
Andrew Burgess [Fri, 13 Oct 2017 14:22:17 +0000 (15:22 +0100)] 
gdb: Remove hard-coded line number from test

Removes the use of a hard-coded line number from a test.

gdb/testsuite/ChangeLog:

* gdb.linespec/ls-errs.exp (do_test): Update comment, use line
number from variable rather than hard-coded.

7 years agoFix build breakage in gdb/xml-support.c
Pedro Alves [Thu, 19 Oct 2017 17:12:03 +0000 (18:12 +0100)] 
Fix build breakage in gdb/xml-support.c

The buildbots are showing that the previous change to
xml_fetch_content_from_file causes __wur warnings/errors:

  ../../binutils-gdb/gdb/xml-support.c: In function gdb::unique_xmalloc_ptr<char> xml_fetch_content_from_file(const char*, void*):
  ../../binutils-gdb/gdb/xml-support.c:1028:43: error: ignoring return value of size_t fread(void*, size_t, size_t, FILE*), declared with attribute warn_unused_result [-Werror=unused-result]
     fread (text.get (), 1, len, file.get ());
     ^

This commit fixes it.

gdb/ChangeLog:
2017-10-19  Pedro Alves  <palves@redhat.com>

* xml-support.c (xml_fetch_content_from_file): Check fread's
return.

7 years agoRISC-V: Relax RISCV_PCREL_* to RISCV_GPREL_*
Palmer Dabbelt [Fri, 19 May 2017 01:13:09 +0000 (18:13 -0700)] 
RISC-V: Relax RISCV_PCREL_* to RISCV_GPREL_*

In the medany code model the compiler generates PCREL_HI20+PCREL_LO12
relocation pairs against local symbols because HI20+LO12 relocations
can't reach high addresses.  We relax HI20+LO12 pairs to GPREL
relocations when possible, which is an important optimization for
Dhrystone.  Without this commit we are unable to relax
PCREL_HI20+PCREL_LO12 pairs to GPREL when possible, causing a 10%
permormance hit on Dhrystone on Rocket.

Note that we'll now relax

  la gp, __global_pointer$

to

  mv gp, gp

which probably isn't what you want in your entry code.  Users who want
gp-relative symbols to continue to resolve should add ".option norelax"
accordingly.  Due to this, the assembler now pairs PCREL relocations
with RELAX relocations when they're expected to be relaxed just like
every other relaxable relocation.

bfd/ChangeLog

2017-10-19  Palmer Dabbelt  <palmer@dabbelt.com>

        * elfnn-riscv.c (riscv_pcgp_hi_reloc): New structure.
        (riscv_pcgp_lo_reloc): Likewise.
        (riscv_pcgp_relocs): Likewise.
        (riscv_init_pcgp_relocs): New function.
        (riscv_free_pcgp_relocs): Likewise.
        (riscv_record_pcgp_hi_reloc): Likewise.
        (riscv_record_pcgp_lo_reloc): Likewise.
        (riscv_delete_pcgp_hi_reloc): Likewise.
        (riscv_use_pcgp_hi_reloc): Likewise.
        (riscv_record_pcgp_lo_reloc): Likewise.
        (riscv_find_pcgp_lo_reloc): Likewise.
        (riscv_delete_pcgp_lo_reloc): Likewise.
        (_bfd_riscv_relax_pc): Likewise.
        (_bfd_riscv_relax_section): Handle R_RISCV_PCREL_* relocations
        via the new functions above.

gas/ChangeLog

2017-10-19  Palmer Dabbelt  <palmer@dabbelt.com>

        * config/tc-riscv.c (md_apply_fix): Mark
        BFD_RELOC_RISCV_PCREL_HI20 as relaxable when relaxations are
        enabled.

7 years agoRISC-V: Add R_RISCV_DELETE, which marks bytes for deletion
Palmer Dabbelt [Fri, 19 May 2017 01:08:25 +0000 (18:08 -0700)] 
RISC-V: Add R_RISCV_DELETE, which marks bytes for deletion

We currently delete bytes by shifting an entire BFD backwards to
overwrite the bytes we no longer need.  The result is that relaxing a
BFD is quadratic time.

This patch adds an additional relocation that specifies a byte range
that will be deleted from the final object file, and adds a relaxation
pass (between the existing passes that delete bytes and the alignment
pass) that actually deletes the bytes.  Note that deletion is still
quadratic time, and nothing uses R_RISCV_DELETE yet.

I've been meaning to go convert all the other relaxations to use
R_RISCV_DELETE and then make it faster, but this patch has been sitting
around for months so it looks like that won't happen for a bit.  The
PCREL->GPREL relaxation that comes next uses this, and since we've been
using these two patches out of tree since I wrote them months ago I
figure it's better to just get them in now.  I (or someone else :)) can
convert all the relocations later...

R_RISCV_DELETE will never be emitted into ELF objects, so therefor isn't
exposed to the rest of binutils.  As such, we're not considering this as
part of the ABI.

bfd/ChangeLog

2017-10-19  Palmer Dabbelt  <palmer@dabbelt.com>

        * elfnn-riscv (R_RISCV_DELETE): New define.
        (_bfd_riscv_relax_delete): New function.
        (perform_relocation): Handle R_RISCV_DELETE.
        (_bfd_riscv_relax_section): Likewise.

ld/ChangeLog

2017-10-19  Palmer Dabbelt  <palmer@dabbelt.com>

        * emultempl/riscvelf.em (riscv_elf_before_allocation): Add a
        third relaxation pass.

7 years agoFix the AVR assembler so that it will correctly issue warnings about skipped instruct...
Nick Clifton [Thu, 19 Oct 2017 15:21:51 +0000 (16:21 +0100)] 
Fix the AVR assembler so that it will correctly issue warnings about skipped instructions even if subsections are used.

PR 21621
* config/tc-avr.h (struct avr_frag_data): Add prev_opcode field.
(TC_FRAG_INIT): Define.
(avr_frag_init): Add prototype.
* config/tc-avr.c (avr_frag_init): New function.
(avr_operands): Replace static local 'prev' variable with
prev_opcode field in current frag.
* testsuite/gas/avr/pr21621.s: New test source file.
* testsuite/gas/avr/pr21621.d: New test driver file.
* testsuite/gas/avr/pr21621.s: New test error output file.

7 years agoFix inferior deadlock with "target remote | CMD"
Pedro Alves [Thu, 19 Oct 2017 15:00:21 +0000 (16:00 +0100)] 
Fix inferior deadlock with "target remote | CMD"

Comparing test results between

  --target_board=native-gdbserver
  --target_board=native-stdio-gdbserver

I noticed that gdb.base/bigcore.exp is failing with native-stdio-gdbserver:

  Running src/gdb/testsuite/gdb.base/bigcore.exp ...
  FAIL: gdb.base/bigcore.exp: continue (timeout)
  ...

The problem is that:

  1. When debugging with "target remote | CMD", the inferior's
     stdout/stderr streams are connected to a pipe.

  2. The bigcore.c program prints a lot to the screen before it
     reaches the breakpoint location that the "continue" shown above
     wants to reach.

  3. GDB is not flushing the inferior's output pipe while the inferior
     is running.

  4. The pipe becomes full.

  5. The inferior thus deadlocks.

The bug is #3 above, which is what this commit fixes.  A new test is
added, that specifically exercises this scenario.  The test fails
before the fix, and passes after, and gdb.base/bigcore.exp also starts
passing.

gdb/ChangeLog:
2017-10-19  Pedro Alves  <palves@redhat.com>

* ser-base.c (ser_base_read_error_fd): Delete the file handler if
async.
(handle_error_fd): New function.
(ser_base_async): Add/delete an event loop file handler for
error_fd.

gdb/testsuite/ChangeLog:
2017-10-19  Pedro Alves  <palves@redhat.com>

* gdb.base/long-inferior-output.c: New file.
* gdb.base/long-inferior-output.exp: New file.

7 years agoxml_fetch_content_from_file: Read in whole file in one go
Pedro Alves [Thu, 19 Oct 2017 14:25:59 +0000 (15:25 +0100)] 
xml_fetch_content_from_file: Read in whole file in one go

There doesn't seem to be a good reason we're reading the file one
chunk at a time.

gdb/ChangeLog:
2017-10-19  Pedro Alves  <palves@redhat.com>

* xml-support.c (xml_fetch_content_from_file): Don't read in
chunks.  Instead use fseek to determine the file's size, and read
it in one go.

7 years agotilegx: Check bfd_link_executable for TLS check
H.J. Lu [Thu, 19 Oct 2017 12:22:23 +0000 (05:22 -0700)] 
tilegx: Check bfd_link_executable for TLS check

Copied from x86, check bfd_link_executable, instead of bfd_link_pic,
for TLS transition check.  Not sure if it works correctly.  All usages
of bfd_link_pic should be audited.

PR ld/22263
* elfxx-tilegx.c (tilegx_elf_tls_transition): Replace
bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
bfd_link_executable for TLS check.
(tilegx_elf_check_relocs): Likewise.
(allocate_dynrelocs): Likewise.
(tilegx_elf_relocate_section): Likewise.

7 years agotilepro: Check bfd_link_executable for TLS check
H.J. Lu [Thu, 19 Oct 2017 12:20:44 +0000 (05:20 -0700)] 
tilepro: Check bfd_link_executable for TLS check

Copied from x86, check bfd_link_executable, instead of bfd_link_pic,
for TLS transition check.  Not sure if it works correctly.  All usages
of bfd_link_pic should be audited.

PR ld/22263
* elf32-tilepro.c (tilepro_elf_tls_transition): Replace
bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
bfd_link_executable for TLS check.
(tilepro_elf_check_relocs): Likewise.
(allocate_dynrelocs): Likewise.
(tilepro_elf_relocate_section): Likewise.

7 years agosparc: Check bfd_link_executable for TLS check
H.J. Lu [Thu, 19 Oct 2017 12:18:07 +0000 (05:18 -0700)] 
sparc: Check bfd_link_executable for TLS check

Copied from x86, check bfd_link_executable, instead of bfd_link_pic,
for TLS transition check.  Not sure if it works correctly.  All usages
of bfd_link_pic should be audited.

PR ld/22263
* elfxx-sparc.c (sparc_elf_tls_transition): Replace
bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
bfd_link_executable for TLS check.
(_bfd_sparc_elf_check_relocs): Likewise.
(allocate_dynrelocs): Likewise.
(_bfd_sparc_elf_relocate_section): Likewise.

7 years agoFix fill-1 testcase
Andreas Krebbel [Thu, 19 Oct 2017 07:02:15 +0000 (09:02 +0200)] 
Fix fill-1 testcase

This fixes various issues with the fill-1 testcase causing fails on a
couple of targets.

gas/ChangeLog:

2017-10-19  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* testsuite/gas/all/fill-1.s: Use normal labels.  Change .text to
.data. Pick different values.  Use .dc.w instead of .word.
* testsuite/gas/all/fill-1.d: New objdump output check.
* testsuite/gas/all/gas.exp: Use run_dump_test to execute fill-1
testcase.

7 years agoAutomatic date update in version.in
GDB Administrator [Thu, 19 Oct 2017 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years agotile: Mark __tls_get_addr in gc_mark_hook
H.J. Lu [Wed, 18 Oct 2017 22:46:57 +0000 (15:46 -0700)] 
tile: Mark __tls_get_addr in gc_mark_hook

TLS_GD_CALL relocations implicitly reference __tls_get_addr.  Since
elf_gc_mark_hook is called before check_relocs now, we need to call
_bfd_generic_link_add_one_symbol to mark __tls_get_addr for garbage
collection.

* elf32-tilepro.c (tilepro_elf_gc_mark_hook): Call
_bfd_generic_link_add_one_symbol to mark __tls_get_addr.
* elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise.

7 years agoRISC-V: Mark unsupported gas testcases
Palmer Dabbelt [Tue, 17 Oct 2017 17:51:38 +0000 (10:51 -0700)] 
RISC-V: Mark unsupported gas testcases

There are individual comments that explain why each test isn't
supported, but the vast majority of them are due to RISC-V's aggressive
linker relaxation.  The SLEB test cases should eventually be supported,
but the remaining ones probably won't ever be.

2017-10-18  Palmer Dabbelt  <palmer@dabbelt.com>

        * testsuite/gas/all/align.d: Mark as unsupported on RISC-V.
        testsuite/gas/all/relax.d: Likewise.
        testsuite/gas/all/sleb128-2.d: Likewise.
        testsuite/gas/all/sleb128-4.d: Likewise.
        testsuite/gas/all/sleb128-5.d: Likewise.
        testsuite/gas/all/sleb128-7.d: Likewise.
        testsuite/gas/elf/section11.d: Likewise.
        testsuite/gas/all/gas.exp (diff1.s): Likewise.

7 years agoCanonicalize conversion operators
Keith Seitz [Wed, 18 Oct 2017 18:05:45 +0000 (11:05 -0700)] 
Canonicalize conversion operators

Consider a conversion operator such as:

operator foo const* const* ();

There are two small parser problems, highlighted by this test:

(gdb) p operator foo const* const*
There is no field named operatorfoo const* const *

GDB is looking up the symbol "operatorfoo const* const*" -- it is missing a
space between the keyword "operator" and the type name "foo const* const*".

Additionally, this input of the user-defined type needs to be canonicalized
so that different "spellings" of the type are recognized:

(gdb) p operator const foo* const *
There is no field named operator const foo* const *

gdb/ChangeLog:

* c-exp.y (oper): Canonicalize conversion operators of user-defined
types.
Add whitespace to front of type name.

gdb/testsuite/ChangeLog:

* gdb.cp/cpexprs.cc (base) <operator fluff const* const*>: New
method.
(main): Call it.
* gdb.cp/cpexprs.exp: Add new conversion operator to test matrix.
Add additional user-defined conversion operator tests.

7 years agoIssue complaint instead of assert for invalid/unhandled DW_AT_accessibility
Keith Seitz [Tue, 17 Oct 2017 21:15:36 +0000 (14:15 -0700)] 
Issue complaint instead of assert for invalid/unhandled DW_AT_accessibility

A previous patch called gdb_assert_not_reached whenever reading
the accessibility of a nested typedef definition. Wisely, Pedro has asked me
not do this.

This patch changes the previous one so that it issues a complaint instead.

gdb/ChangeLog:

* dwarf2read.c (dwarf2_add_typedef): Issue a complaint on unhandled
DW_AT_accessibility.

7 years ago[Visium] Disassemble the operands of the stop instruction.
Eric Botcazou [Wed, 18 Oct 2017 14:30:24 +0000 (16:30 +0200)] 
[Visium] Disassemble the operands of the stop instruction.

binutils/
        * MAINTAINERS: Add myself as Visium maintainer.
opcodes/
        * visium-dis.c (disassem_class1) <case 0>: Print the operands.

7 years agoUpdate Cris assembler tests for checks that now pass where they used to fail.
Nick Clifton [Wed, 18 Oct 2017 14:07:36 +0000 (15:07 +0100)] 
Update Cris assembler tests for checks that now pass where they used to fail.

PR gas/22304
* testsuite/gas/cris/range-err-1.s: Remove spurious xfails.
* testsuite/gas/cris/cris.exp: Expect the shexpr-1 test to pass.

7 years agoUpdate the Swedish translation in the GAS subdirectory.
Nick Clifton [Wed, 18 Oct 2017 13:50:49 +0000 (14:50 +0100)] 
Update the Swedish translation in the GAS subdirectory.

* po/sv.po: Updated Swedish translation.

7 years agoAdd a warning to the how-to-make-a-release notes to check the permissions on the...
Nick Clifton [Wed, 18 Oct 2017 13:40:06 +0000 (14:40 +0100)] 
Add a warning to the how-to-make-a-release notes to check the permissions on the files in the tarball.

* README-how-to-make-a-release: A note about checking file and
directory permissions.

7 years agoMove Svein Seldal to Past Maintainers section.
Nick Clifton [Wed, 18 Oct 2017 13:36:48 +0000 (14:36 +0100)] 
Move Svein Seldal to Past Maintainers section.

* MAINTAINERS: Move Svein Seldal to Past Maintainers section.

7 years agoRemove features/tic6x-c62x-linux.c
Yao Qi [Wed, 18 Oct 2017 11:48:12 +0000 (12:48 +0100)] 
Remove features/tic6x-c62x-linux.c

c40c7bf (Remove features/tic6x-*.c files) doesn't remove
features/tic6x-c62x-linux.c.  This patch removes it.

gdb:

2017-10-18  Yao Qi  <yao.qi@linaro.org>

* features/tic6x-c62x-linux.c: Remove.

7 years agoPR22303, print_core_note out of bounds read
Alan Modra [Wed, 18 Oct 2017 01:35:39 +0000 (12:05 +1030)] 
PR22303, print_core_note out of bounds read

The print_core_note change here fixes the PR, the rest is making
readelf a little more bombproof against maliciously crafted binaries.

PR 22303
* readelf.c (print_core_note): Ensure "count" sanity check
calculation doesn't overflow.
(process_notes_at): Perform note namesz and descsz checks
using unsigned comparisons against data remaining.  Catch
alignment overflow of namesz and descsz too.  Don't allocate a
temp for terminating "name" when there is space available
before descdata.

7 years agomicroblaze: Check for indirect and warning symbols
H.J. Lu [Wed, 18 Oct 2017 00:15:02 +0000 (17:15 -0700)] 
microblaze: Check for indirect and warning symbols

Relocations against indirect and warning symbols should be applied to real
symbols.

* elf32-microblaze.c (microblaze_elf_check_relocs): Check for
indirect and warning symbols.

7 years agoAutomatic date update in version.in
GDB Administrator [Wed, 18 Oct 2017 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 years ago[GOLD] Fix powerpc64 optimization of TOC accesses
Alan Modra [Tue, 17 Oct 2017 14:03:05 +0000 (00:33 +1030)] 
[GOLD] Fix powerpc64 optimization of TOC accesses

Fixes a thinko.  Given code that puts variables into the TOC (a bad
idea, but some see the TOC as a small data section) this bug could
result in an attempt to optimize a sequence that should not be
optimized.

* powerpc.cc (Target_powerpc::Scan::local): Correct dst_off
calculation for TOC16 relocs.
(Target_powerpc::Scan::global): Likewise.

7 years agoReally make the native-stdio-gdbserver board non-remote
Pedro Alves [Tue, 17 Oct 2017 18:45:35 +0000 (19:45 +0100)] 
Really make the native-stdio-gdbserver board non-remote

I've noticed now that due to a last-minute change, commit 739b3f1d8ff7
("Make native gdbserver boards no longer be "remote" (in DejaGnu
terms)") managed to miss loading "local-board" in the
native-stdio-gdbserver board...

gdb/testsuite/ChangeLog:
2017-10-17  Pedro Alves  <palves@redhat.com>

* boards/native-stdio-gdbserver.exp: Load "local-board".

7 years agoAdd myself as dwarf-mode.el maintainer
Tom Tromey [Tue, 17 Oct 2017 15:37:33 +0000 (09:37 -0600)] 
Add myself as dwarf-mode.el maintainer

In https://sourceware.org/ml/binutils/2017-10/msg00160.html, Nick said I
should update MAINTAINERS to mention that I'm the dwarf-mode.el
maintainer.  So, I'm checking this in.

2017-10-17  Tom Tromey  <tom@tromey.com>

* MAINTAINERS: Add myself as dwarf-mode.el maintainer.

7 years agoAdd several "quit with live inferior" tests
Pedro Alves [Tue, 17 Oct 2017 13:58:54 +0000 (14:58 +0100)] 
Add several "quit with live inferior" tests

In my multi-target branch, I had managed to break GDB exiting
successfuly in response to "quit" or SIGHUP/SIGTERM when:

 - you're debugging with "target extended-remote",
 - have more than one inferior loaded in gdb, some running, and at
   least one not running, and,
 - quit gdb with the inferior that is not running yet selected.

The testsuite still passed cleanly anyway.  I only noticed because I
was left with a bunch of core dumps in the gdb/testsuite/ directory --
the testsuite infrastructure closes GDB's pty after running each
testcase, which results in GDB getting a SIGHUP and should make GDB
exit gracefully.  If GDB crashes at that point though, there's no
indication about it in gdb.sum/gdb.log.

This commit adds a multitude of tests exercising quitting GDB with
live inferiors, some of which would have caught the problem.

gdb/testsuite/ChangeLog:
2017-10-17  Pedro Alves  <palves@redhat.com>

* gdb.base/quit-live.c: New file.
* gdb.base/quit-live.exp: New file.

7 years agoRemove cleanups from disasm.c
Tom Tromey [Thu, 12 Oct 2017 21:07:35 +0000 (15:07 -0600)] 
Remove cleanups from disasm.c

This changes the remaining spots in disasm.c to use the RAII ui-out
emitters, removing a few cleanups.  This also fixes a regression that
Simon pointed out.

2017-10-17  Tom Tromey  <tom@tromey.com>

* disasm.c (do_mixed_source_and_assembly_deprecated): Use
gdb::optional, ui_out_emit_list, ui_out_emit_tuple.
(do_mixed_source_and_assembly): Likewise.

7 years agoRemove obsolete assertion from regcache.c
Tom Tromey [Tue, 17 Oct 2017 12:40:22 +0000 (06:40 -0600)] 
Remove obsolete assertion from regcache.c

When building I got:

../../binutils-gdb/gdb/regcache.c:935:24: error: the address of ‘ssize_t read(int, void*, size_t)’ will never be NULL [-Werror=address]

This happens because "read" used to be a parameter to this function,
which was then removed; but the assertion wasn't updated.

I don't think the assertion is relevant any more, to this removes it.
I'm checking it in as obvious.

2017-10-17  Tom Tromey  <tom@tromey.com>

* regcache.c (regcache::xfer_part): Remove assertion.

7 years agoPR22307, Heap out of bounds read in _bfd_elf_parse_gnu_properties
Alan Modra [Tue, 17 Oct 2017 11:27:29 +0000 (21:57 +1030)] 
PR22307, Heap out of bounds read in _bfd_elf_parse_gnu_properties

When adding an unbounded increment to a pointer, you can't just check
against the end of the buffer but also must check that overflow
doesn't result in "negative" pointer movement.  Pointer comparisons
are signed.  Better, check the increment against the space left using
an unsigned comparison.

PR 22307
* elf-properties.c (_bfd_elf_parse_gnu_properties): Compare datasz
against size left rather than comparing pointers.  Reorganise loop.

7 years agoFix double-free corruption
Pedro Alves [Tue, 17 Oct 2017 11:41:00 +0000 (12:41 +0100)] 
Fix double-free corruption

Fixes a double-free regression introduced by commit b7b030adc405
("Return unique_xmalloc_ptr from target_read_stralloc"):

gdb.sum:
  Running src/gdb/testsuite/gdb.base/catch-syscall.exp ...
  ERROR: Process no longer exists

Valgrind shows:

  (gdb) catch syscall
  ==3687== Thread 1:
  ==3687== Invalid free() / delete / delete[] / realloc()
  ==3687==    at 0x4C29CF0: free (vg_replace_malloc.c:530)
  ==3687==    by 0x610862: xfree(void*) (common-utils.c:101)
  ==3687==    by 0x440D5D: gdb::xfree_deleter<char>::operator()(char*) const (gdb_unique_ptr.h:34)
  ==3687==    by 0x446CC6: std::unique_ptr<char, gdb::xfree_deleter<char> >::reset(char*) (unique_ptr.h:344)
  ==3687==    by 0x81BE50: xml_fetch_content_from_file(char const*, void*) (xml-support.c:1042)
  ==3687==    by 0x81DA86: xml_init_syscalls_info(char const*) (xml-syscall.c:366)
  ==3687==    by 0x81DBDD: init_syscalls_info(gdbarch*) (xml-syscall.c:398)
  ==3687==    by 0x81E131: get_syscall_by_number(gdbarch*, int, syscall*) (xml-syscall.c:599)
  ==3687==    by 0x5BE86F: catch_syscall_command_1(char*, int, cmd_list_element*) (break-catch-syscall.c:481)
  ==3687==    by 0x4B46B1: do_sfunc(cmd_list_element*, char*, int) (cli-decode.c:138)
  ==3687==    by 0x4B76B8: cmd_func(cmd_list_element*, char*, int) (cli-decode.c:1952)
  ==3687==    by 0x7E91C7: execute_command(char*, int) (top.c:615)
  ==3687==  Address 0x14332ae0 is 0 bytes inside a block of size 4,096 free'd
  ==3687==    at 0x4C2AB8B: realloc (vg_replace_malloc.c:785)
  ==3687==    by 0x610792: xrealloc (common-utils.c:62)
  ==3687==    by 0x81BE3E: xml_fetch_content_from_file(char const*, void*) (xml-support.c:1042)
  ==3687==    by 0x81DA86: xml_init_syscalls_info(char const*) (xml-syscall.c:366)
  ==3687==    by 0x81DBDD: init_syscalls_info(gdbarch*) (xml-syscall.c:398)
  ==3687==    by 0x81E131: get_syscall_by_number(gdbarch*, int, syscall*) (xml-syscall.c:599)
  ==3687==    by 0x5BE86F: catch_syscall_command_1(char*, int, cmd_list_element*) (break-catch-syscall.c:481)
  ==3687==    by 0x4B46B1: do_sfunc(cmd_list_element*, char*, int) (cli-decode.c:138)
  ==3687==    by 0x4B76B8: cmd_func(cmd_list_element*, char*, int) (cli-decode.c:1952)
  ==3687==    by 0x7E91C7: execute_command(char*, int) (top.c:615)
  ==3687==    by 0x6A422D: command_handler(char*) (event-top.c:583)
  ==3687==    by 0x6A45F2: command_line_handler(char*) (event-top.c:773)
  [...]

The problem is that if xrealloc decides it needs a new memory block,
it frees the previous block/pointer, and then text.reset() frees it
again.

gdb/ChangeLog:
2017-10-17  Pedro Alves  <palves@redhat.com>

* xml-support.c (xml_fetch_content_from_file): Call
unique_ptr::release() instead unique_ptr::get() when passing
through xrealloc.

7 years agoSimplify regcache::xfer_part
Yao Qi [Tue, 17 Oct 2017 11:29:26 +0000 (12:29 +0100)] 
Simplify regcache::xfer_part

Since xfer_part is already a class method, and only
{raw,cooked}_{read,write} are passed to it.  We can remove these two
arguments, but add a bool argument is_raw, indicating raw registers or
cooked registers are accessed.

gdb:

2017-10-17  Yao Qi  <yao.qi@linaro.org>

* regcache.c (regcache::xfer_part): Remove parameters read and
write, add parameter is_raw.  All callers are updated.

7 years ago[GDBserver] Move aarch64-insn.o to arch/ and remove one Makefile rule
Yao Qi [Tue, 17 Oct 2017 11:12:04 +0000 (12:12 +0100)] 
[GDBserver] Move aarch64-insn.o to arch/ and remove one Makefile rule

gdb/gdbserver:

2017-10-17  Yao Qi  <yao.qi@linaro.org>

* Makefile.in: Remove one rule.
* configure.srv: Rename aarch64-insn.o with arch/aarch64-insn.o.

7 years ago[GDBserver] Move arm-linux.o and arm-get-next-pcs.o to arch/
Yao Qi [Tue, 17 Oct 2017 11:12:04 +0000 (12:12 +0100)] 
[GDBserver] Move arm-linux.o and arm-get-next-pcs.o to arch/

gdb/gdbserver:

2017-10-17  Yao Qi  <yao.qi@linaro.org>

* configure.srv: Rename arm-linux.o with arch/arm-linux.o.
Rename arm-get-next-pcs.o with arch/arm-get-next-pcs.o.

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