binutils-gdb.git
4 years agoUse read_memory in ada_exception_message_1
Tom Tromey [Wed, 8 Jul 2020 13:16:59 +0000 (07:16 -0600)]
Use read_memory in ada_exception_message_1

Testing using the internal AdaCore test suite showed a regression from
the target string reading changes.  In particular, now
ada_exception_message_1 can get the wrong answer in some cases.  In
particular, when an Ada exception catchpoint is hit, sometimes the
exception name will be incorrect.  The case I was seeing changed from
the correct:

    Catchpoint 2, CONSTRAINT_ERROR (catch C_E) at [...]

to:

    Catchpoint 2, CONSTRAINT_ERROR (catch C_EE) at [...]

I was not able to reproduce this failure with the Fedora gnat.
Perhaps it is related to some local change to gnat; I do not know.

Meanwhile, because ada_exception_message_1 knows the length of the
string to read, we can use read_memory here.  This fixes the bug.

I've updated the test suite to at least exercise this code path.
However, as mentioned above, the new test does not actually provoke
the failure.

gdb/ChangeLog
2020-07-08  Tom Tromey  <tromey@adacore.com>

* ada-lang.c (ada_exception_message_1): Use read_memory.

gdb/testsuite/ChangeLog
2020-07-08  Tom Tromey  <tromey@adacore.com>

* gdb.ada/catch_ex/foo.adb: Pass string to raise.
* gdb.ada/catch_ex.exp: Examine catchpoint text.

4 years agoCommit: Fix GOLD testsuite failures for 2.35 branch.
Nick Clifton [Wed, 8 Jul 2020 10:08:05 +0000 (11:08 +0100)]
Commit: Fix GOLD testsuite failures for 2.35 branch.

* testsuite/script_test_7.sh: Adjust expected address of the .bss
section.
* testsuite/script_test_9.sh: Do not expect the .init section to
immediately follow the .text section in the mapping of sections to
segments.

4 years agox86: various XOP insns lack L and/or W bit decoding
Jan Beulich [Wed, 8 Jul 2020 09:20:09 +0000 (11:20 +0200)]
x86: various XOP insns lack L and/or W bit decoding

While some insns support both XOP.W based operand swapping and 256-bit
operation (XOP.L=1), many others don't support one or both.

For {L,S}LWPCB also fix the so far not decoded ModRM.mod == 3
restriction.

Take the opportunity and replace the custom OP_LWP_E() and OP_LWPCB_E()
routines by suitable other, non-custom operanbd specifiers.

4 years agox86: FMA4 scalar insns ignore VEX.L
Jan Beulich [Wed, 8 Jul 2020 09:19:26 +0000 (11:19 +0200)]
x86: FMA4 scalar insns ignore VEX.L

Just like other VEX-encoded scalar insns do.

Besides a testcase for this behavior also introduce one to verify that
XOP scalar insns don't honor -mavxscalar=256, as they don't ignore
XOP.L.

4 years agox86: re-work operand swapping for XOP shift/rotate insns
Jan Beulich [Wed, 8 Jul 2020 09:03:07 +0000 (11:03 +0200)]
x86: re-work operand swapping for XOP shift/rotate insns

There's no need for custom operand handling here, except for the VEX.W
controlled operand swapping.

4 years agox86: re-work operand handling for 5-operand XOP insns
Jan Beulich [Wed, 8 Jul 2020 09:02:40 +0000 (11:02 +0200)]
x86: re-work operand handling for 5-operand XOP insns

There's no need for custom operand handling here, except for the VEX.W
controlled operand swapping and the printing of the remaining 4-bit
immediate. VEX.W can be handled just like 4-operand insns.

Also take the opportunity and drop the stray indirection through
vex_w_table[].

4 years agox86: re-work operand swapping for FMA4 and 4-operand XOP insns
Jan Beulich [Wed, 8 Jul 2020 09:02:08 +0000 (11:02 +0200)]
x86: re-work operand swapping for FMA4 and 4-operand XOP insns

There's no need for custom operand handling here, except for the VEX.W
controlled operand swapping. The latter can be easily integrated into
OP_REG_VexI4().

4 years agopowerpc-aix5.2 tests
Alan Modra [Wed, 8 Jul 2020 05:41:24 +0000 (15:11 +0930)]
powerpc-aix5.2 tests

git commit bbd0c8e20472 broke many of these tests, and there have been
other changes that caused failures too.

* testsuite/lib/ld-lib.exp (ar_simple_create): Pass options before
ar command.
* testsuite/ld-powerpc/aix52.exp: Run for rs6000-aix5.2.  Update
match files.
* testsuite/ld-powerpc/aix-abs-branch-1.dd: Update.
* testsuite/ld-powerpc/aix-core-sec-1.hd: Update.
* testsuite/ld-powerpc/aix-gc-1-32.dd: Update.
* testsuite/ld-powerpc/aix-gc-1-64.dd: Update.
* testsuite/ld-powerpc/aix-glink-1-32.dd: Update.
* testsuite/ld-powerpc/aix-glink-1-64.dd: Update.
* testsuite/ld-powerpc/aix-glink-2-32.dd: Update.
* testsuite/ld-powerpc/aix-glink-2-64.dd: Update.
* testsuite/ld-powerpc/aix-no-dup-syms-1-rel.rd: Update.
* testsuite/ld-powerpc/aix-ref-1-32.od: Update.
* testsuite/ld-powerpc/aix-ref-1-64.od: Update.
* testsuite/ld-powerpc/aix-toc-1-32.dd: Update.
* testsuite/ld-powerpc/aix-toc-1-64.dd: Update.
* testsuite/ld-powerpc/aix-weak-3-32.dd: Update.
* testsuite/ld-powerpc/aix-weak-3-64.dd: Update.
* testsuite/ld-powerpc/aix-abs-branch-1.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-abs-branch-1-32.nd,
* testsuite/ld-powerpc/aix-abs-branch-1-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-abs-reloc-1.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-abs-reloc-1-32.nd,
* testsuite/ld-powerpc/aix-abs-reloc-1-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-abs-reloc-1.od: Delete, replace with..
* testsuite/ld-powerpc/aix-abs-reloc-1-32.od,
* testsuite/ld-powerpc/aix-abs-reloc-1-64.od: ..these new files.
* testsuite/ld-powerpc/aix-export-1-all.dd: Delete, replace with..
* testsuite/ld-powerpc/aix-export-1-all-32.dd,
* testsuite/ld-powerpc/aix-export-1-all-64.dd: ..these new files.
* testsuite/ld-powerpc/aix-export-1-full.dd: Delete, replace with..
* testsuite/ld-powerpc/aix-export-1-full-32.dd,
* testsuite/ld-powerpc/aix-export-1-full-64.dd: ..these new files.
* testsuite/ld-powerpc/aix-export-2.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-export-2-32.nd,
* testsuite/ld-powerpc/aix-export-2-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-gc-1.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-gc-1-32.nd,
* testsuite/ld-powerpc/aix-gc-1-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-glink-3.dd: Delete, replace with..
* testsuite/ld-powerpc/aix-glink-3-32.dd,
* testsuite/ld-powerpc/aix-glink-3-64.dd: ..these new files.
* testsuite/ld-powerpc/aix-lineno-1a.dd: Delete, replace with..
* testsuite/ld-powerpc/aix-lineno-1a-32.dd,
* testsuite/ld-powerpc/aix-lineno-1a-64.dd: ..these new files.
* testsuite/ld-powerpc/aix-lineno-1a.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-lineno-1a-32.nd,
* testsuite/ld-powerpc/aix-lineno-1a-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-lineno-1b.dd: Delete, replace with..
* testsuite/ld-powerpc/aix-lineno-1b-32.dd,
* testsuite/ld-powerpc/aix-lineno-1b-64.dd: ..these new files.
* testsuite/ld-powerpc/aix-lineno-1b.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-lineno-1b-32.nd,
* testsuite/ld-powerpc/aix-lineno-1b-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso.dnd: Delete, replace with..
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso-32.dnd,
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso-64.dnd: ..these new files.
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso.drd: Delete, replace with..
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso-32.drd,
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso-64.drd: ..these new files.
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso-32.nd,
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso.rd: Delete, replace with..
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso-32.rd,
* testsuite/ld-powerpc/aix-no-dup-syms-1-dso-64.rd: ..these new files.
* testsuite/ld-powerpc/aix-weak-1-dso.dnd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-1-dso-32.dnd,
* testsuite/ld-powerpc/aix-weak-1-dso-64.dnd: ..these new files.
* testsuite/ld-powerpc/aix-weak-1-dso.hd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-1-dso-32.hd,
* testsuite/ld-powerpc/aix-weak-1-dso-64.hd: ..these new files.
* testsuite/ld-powerpc/aix-weak-1-dso.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-1-dso-32.nd,
* testsuite/ld-powerpc/aix-weak-1-dso-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-weak-1-gcdso.dnd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-1-gcdso-32.dnd,
* testsuite/ld-powerpc/aix-weak-1-gcdso-64.dnd: ..these new files.
* testsuite/ld-powerpc/aix-weak-1-gcdso.hd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-1-gcdso-32.hd,
* testsuite/ld-powerpc/aix-weak-1-gcdso-64.hd: ..these new files.
* testsuite/ld-powerpc/aix-weak-1-gcdso.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-1-gcdso-32.nd,
* testsuite/ld-powerpc/aix-weak-1-gcdso-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-weak-2a.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-2a-32.nd,
* testsuite/ld-powerpc/aix-weak-2a-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-weak-2b.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-2b-32.nd,
* testsuite/ld-powerpc/aix-weak-2b-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-weak-2c.nd: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-2c-32.nd,
* testsuite/ld-powerpc/aix-weak-2c-64.nd: ..these new files.
* testsuite/ld-powerpc/aix-weak-2c.od: Delete, replace with..
* testsuite/ld-powerpc/aix-weak-2c-32.od,
* testsuite/ld-powerpc/aix-weak-2c-64.od: ..these new files.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 8 Jul 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoarc: Improve error messages when assembling
Claudiu Zissulescu [Tue, 7 Jul 2020 13:01:48 +0000 (16:01 +0300)]
arc: Improve error messages when assembling

gas/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (find_opcode_match): Add error messages.
* testsuite/gas/arc/add_s-err.s: Update test.
* testsuite/gas/arc/asm-errors.err: Likewise.
* testsuite/gas/arc/cpu-em-err.s: Likewise.
* testsuite/gas/arc/hregs-err.s: Likewise.
* testsuite/gas/arc/warn.s: Likewise.

4 years agoarc: Update vector instructions.
Claudiu Zissulescu [Tue, 7 Jul 2020 13:01:48 +0000 (16:01 +0300)]
arc: Update vector instructions.

Update vadd2, vadd4h, vmac2h, vmpy2h, vsub4h vector instructions
arguments to discriminate between double/single register operands.

opcodes/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

* arc-opc.c (insert_rbd): New function.
(RBD): Define.
(RBDdup): Likewise.
* arc-tbl.h (vadd2, vadd4h, vmac2h, vmpy2h, vsub4h): Update
instructions.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
4 years agoRe: Use is_xcoff_format in ld testsuite
Alan Modra [Tue, 7 Jul 2020 12:23:03 +0000 (21:53 +0930)]
Re: Use is_xcoff_format in ld testsuite

git commit 7193487fa8 took h8300 out of the notarget list, resulting in
h8300-elf  +FAIL: ld-scripts/section-match-1
h8300-linux  +FAIL: ld-scripts/section-match-1

* testsuite/ld-scripts/section-match-1.d: xfail h8300.

4 years agox86: Remove an incorrect AVX2 entry
H.J. Lu [Tue, 7 Jul 2020 12:06:38 +0000 (05:06 -0700)]
x86: Remove an incorrect AVX2 entry

The upper 16 vector registers were added by AVX512.

PR gas/26212
* doc/c-i386.texi: Remove an incorrect AVX2 entry.

4 years agoXCOFF ld testsuite fixes
Alan Modra [Mon, 6 Jul 2020 06:45:35 +0000 (16:15 +0930)]
XCOFF ld testsuite fixes

* testsuite/ld-scripts/align.exp: Don't exclude xcoff.  Pass
-bnogc ld option for xcoff.
* testsuite/ld-scripts/provide.exp: Likewise.
* testsuite/ld-scripts/data.exp: Pass -bnogc ld option for xcoff.
* testsuite/ld-scripts/default-script.exp: Likewise.
* testsuite/ld-scripts/defined.exp: Likewise.
* testsuite/ld-scripts/empty-address.exp: Likewise.
* testsuite/ld-scripts/expr.exp: Likewise.
* testsuite/ld-scripts/include.exp: Likewise.
* testsuite/ld-scripts/script.exp: Likewise.
* testsuite/ld-scripts/assign-loc.d: Don't exclude xcoff.
* testsuite/ld-scripts/defined3.d: Likewise.
* testsuite/ld-scripts/defined4.d: Likewise.
* testsuite/ld-scripts/pr18963.d: Likewise.
* testsuite/ld-scripts/sane1.d: Likewise.
* testsuite/ld-scripts/segment-start.d: Likewise.
* testsuite/ld-scripts/include-1.d: Likewise, and relax text vma.
* testsuite/ld-scripts/defined5.d: Update xfail and comment.
* testsuite/ld-scripts/defined5.s: Tweak "defined" to be at
non-zero section offset.
* testsuite/ld-scripts/fill16.d: xfail for xcoff.
* testsuite/ld-scripts/provide-2.d: Accept more symbols.
* testsuite/ld-scripts/provide-4.d: Likewise.
* testsuite/ld-scripts/provide-5.d: Likewise.
* testsuite/ld-scripts/provide-6.d: Likewise.
* testsuite/ld-scripts/provide-7.d: Likewise.
* testsuite/ld-scripts/align.t: Accept xcoff mapped .text and .data.
* testsuite/ld-scripts/defined3.t: Likewise.
* testsuite/ld-scripts/defined4.t: Likewise.
* testsuite/ld-scripts/defined5.t: Likewise.
* testsuite/ld-scripts/fill.t: Likewise.
* testsuite/ld-scripts/include-subdata.t: Likewise.
* testsuite/ld-scripts/provide-1.t: Likewise.
* testsuite/ld-scripts/provide-2.t: Likewise.
* testsuite/ld-scripts/provide-3.t: Likewise.
* testsuite/ld-scripts/provide-4.t: Likewise.
* testsuite/ld-scripts/provide-5.t: Likewise.
* testsuite/ld-scripts/provide-6.t: Likewise.
* testsuite/ld-scripts/provide-7.t: Likewise.
* testsuite/ld-scripts/provide-8.t: Likewise.
* testsuite/ld-scripts/assign-loc.t: Add required xcoff sections.
* testsuite/ld-scripts/sizeof.t: Likewise.
* testsuite/ld-scripts/align2.t: Likewise, and mapped sections.
* testsuite/ld-scripts/align5.t: Likewise.
* testsuite/ld-scripts/default-script.t: Likewise.
* testsuite/ld-scripts/empty-address-1.t: Likewise.
* testsuite/ld-scripts/empty-address-2a.t: Likewise.
* testsuite/ld-scripts/empty-address-2b.t: Likewise.
* testsuite/ld-scripts/empty-address-3a.t: Likewise.
* testsuite/ld-scripts/empty-address-3b.t: Likewise.
* testsuite/ld-scripts/empty-address-3c.t: Likewise.
* testsuite/ld-scripts/include-sections.t: Likewise.
* testsuite/ld-scripts/pr14962.t: Likewise.
* testsuite/ld-scripts/sane1.t: Likewise.

4 years agoUse is_pecoff_format in ld testsuite
Alan Modra [Tue, 7 Jul 2020 03:28:12 +0000 (12:58 +0930)]
Use is_pecoff_format in ld testsuite

--image-base 0 is not just for x86_64 mingw.  This patch fixes that,
and a case where a changed LDFLAGS leaked out of one script to the next.

* testsuite/ld-scripts/align.exp: Use is_pecoff_format.
* testsuite/ld-scripts/defined.exp: Likewise.
* testsuite/ld-scripts/provide.exp: Likewise.
* testsuite/ld-scripts/weak.exp: Likewise.
* testsuite/ld-scripts/empty-address.exp: Likewise.  Reset LDFLAGS
on exit.
* testsuite/ld-scripts/expr.exp: Set LDFLAGS earlier, and with
--image-base for PE.
* testsuite/ld-scripts/include.exp: Set LDFLAGS for PE.
* testsuite/ld-scripts/script.exp: Use is_pecoff_format, and
set LDFLAGS as well as flags.

4 years agoUse is_xcoff_format in ld testsuite
Alan Modra [Tue, 7 Jul 2020 03:11:55 +0000 (12:41 +0930)]
Use is_xcoff_format in ld testsuite

* testsuite/ld-checks/checks.exp: Use is_xcoff_format.
* testsuite/ld-powerpc/powerpc.exp: Likewise.
* testsuite/ld-scripts/print-memory-usage.exp: Likewise.
* testsuite/ld-srec/srec.exp: Likewise.
* testsuite/ld-undefined/require-defined.exp: Likewise.
* testsuite/ld-scripts/expr2.d: Likewise.
* testsuite/ld-scripts/section-match-1.d: Only run for ELF.
* testsuite/ld-elfvers/vers.exp: Delete dead code.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.

4 years agoUse is_xcoff_format in gas testsuite
Alan Modra [Tue, 7 Jul 2020 02:20:52 +0000 (11:50 +0930)]
Use is_xcoff_format in gas testsuite

* testsuite/gas/all/gas.exp: Use is_xcoff_format.
* testsuite/gas/ppc/ppc.exp: Likewise.
* testsuite/gas/all/weakref1l.d: Likewise.

4 years agoUse is_xcoff_format in binutils testsuite
Alan Modra [Tue, 7 Jul 2020 02:00:12 +0000 (11:30 +0930)]
Use is_xcoff_format in binutils testsuite

and restrict some other tests using is_*_format.

* testsuite/binutils-all/ar.exp: Use is_xcoff_format.
* testsuite/binutils-all/nm.exp: Likewise.
* testsuite/binutils-all/copy-2.d: Run only for elf and pe targets.
* testsuite/binutils-all/copy-3.d: Run only for elf targets.
* testsuite/binutils-all/set-section-alignment.d: Likewise.
* testsuite/binutils-all/copy-4.d: Don't run for xcoff.

4 years agoXCOFF binutils testsuite fix
Alan Modra [Tue, 7 Jul 2020 00:53:06 +0000 (10:23 +0930)]
XCOFF binutils testsuite fix

Avoid an UNRESOLVED test due to "Error: the XCOFF file format does not
support arbitrary sections".

* testsuite/lib/binutils-common.exp (is_xcoff_format): New.
* testsuite/binutils-all/objcopy.exp (pr25662): Exclude xcoff.

4 years agoXCOFF linker script PROVIDE support
Alan Modra [Tue, 7 Jul 2020 00:47:21 +0000 (10:17 +0930)]
XCOFF linker script PROVIDE support

Fixes bit rot from git commit b46a87b1606.

* emultempl/aix.em (gld${EMULATION_NAME}_find_exp_assignment): Handle
etree_provided.

4 years agoXCOFF ld segfaults when running ld testsuite
Alan Modra [Tue, 7 Jul 2020 00:28:10 +0000 (09:58 +0930)]
XCOFF ld segfaults when running ld testsuite

The binutils XCOFF support doesn't handle random linker scripts very
well at all.  These tweaks to final_link fix segfaults when some
linker created sections are discarded due to "/DISCARD/ : { *(.*) }"
in scripts.  The xcoff_mark change is necessary to not segfault on
symbols defined in scripts, which may be bfd_link_hash_defined yet
have u.def.section set to bfd_und_section_ptr.  (Which might seem odd,
but occurs during early stages of linking before input sections are
mapped.)

* xcofflink.c (xcoff_mark): Don't mark const sections.
(bfd_xcoff_record_link_assignment): Add FIXME.
(_bfd_xcoff_bfd_final_link): Don't segfault on assorted magic
sections being discarded by linker script.

4 years agoXCOFF deterministic archives
Alan Modra [Tue, 7 Jul 2020 00:22:21 +0000 (09:52 +0930)]
XCOFF deterministic archives

Adds support for "ar -D".

* coff-rs6000.c (xcoff_write_archive_contents_old): Set default
time, uid, gid and mode for deterministic archive.
(xcoff_write_archive_contents_big): Likewise.

4 years agoXCOFF C_HIDEXT and C_AIX_WEAKEXT classification
Alan Modra [Mon, 6 Jul 2020 23:57:17 +0000 (09:27 +0930)]
XCOFF C_HIDEXT and C_AIX_WEAKEXT classification

If C_HIDEXT and C_AIX_WEAKEXT symbols aren't handled as globals by
coff_classify_symbol then we run into "warning: .. local symbol `some
garbage name' has no section".  These are of course both global
symbols, but C_HIDEXT is like a local in some respects and returning
COFF_SYMBOL_LOCAL for C_HIDEXT keeps nm output looking the same.
Fixes these fails on rs6000-aix5.1:

-FAIL: weakref tests, relocations
-FAIL: weakref tests, global syms
-FAIL: weakref tests, strong undefined syms
-FAIL: weakref tests, weak undefined syms

* coffcode.h (coff_classify_symbol): Handle C_HIDEXT and
C_AIX_WEAKEXT.

4 years agosh vxworks tests
Alan Modra [Mon, 6 Jul 2020 23:55:38 +0000 (09:25 +0930)]
sh vxworks tests

These tests were failing only due to not being updated for readelf
output changes.

* testsuite/ld-sh/vxworks1-lib.rd: Update expected output.
* testsuite/ld-sh/vxworks4.d: Likewise.

4 years agoStop the GOLD linker from complaining about relocations from .gnu.build.attributes...
Nick Clifton [Tue, 7 Jul 2020 08:54:09 +0000 (09:54 +0100)]
Stop the GOLD linker from complaining about relocations from .gnu.build.attributes sections to discarded code sections.

* target-reloc.h (Default_comdat_behaviour:get): Ignore discarded
relocs that refer to the .gnu.build.attributes section.

4 years agoFix recent failures in the ARM assembler testsuite due to the correction of a spellin...
Nick Clifton [Tue, 7 Jul 2020 08:37:38 +0000 (09:37 +0100)]
Fix recent failures in the ARM assembler testsuite due to the correction of a spelling mistake.

* testsuite/gas/arm/cde-missing-fp.l: Fix spelling mistake in
expected output.

4 years agox86: introduce %BW to avoid going through vex_w_table[]
Jan Beulich [Tue, 7 Jul 2020 06:08:09 +0000 (08:08 +0200)]
x86: introduce %BW to avoid going through vex_w_table[]

This parallels %LW and %XW.

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 7 Jul 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agogdb: Python unwinders, inline frames, and tail-call frames
Andrew Burgess [Mon, 8 Jun 2020 10:36:13 +0000 (11:36 +0100)]
gdb: Python unwinders, inline frames, and tail-call frames

This started with me running into the bug described in python/22748,
in summary, if the frame sniffing code accessed any registers within
an inline frame then GDB would crash with this error:

  gdb/frame.c:579: internal-error: frame_id get_frame_id(frame_info*): Assertion `fi->level == 0' failed.

The problem is that, when in the Python unwinder I write this:

  pending_frame.read_register ("register-name")

This is translated internally into a call to `value_of_register',
which in turn becomes a call to `value_of_register_lazy'.

Usually this isn't a problem, `value_of_register_lazy' requires the
next frame (more inner) to have a valid frame_id, which will be the
case (if we're sniffing frame #1, then frame #0 will have had its
frame-id figured out).

Unfortunately if frame #0 is inline within frame #1, then the frame-id
for frame #0 can't be computed until we have the frame-id for #1.  As
a result we can't create a lazy register for frame #1 when frame #0 is
inline.

Initially I proposed a solution inline with that proposed in bugzilla,
changing value_of_register to avoid creating a lazy register value.
However, when this was discussed on the mailing list I got this reply:

  https://sourceware.org/pipermail/gdb-patches/2020-June/169633.html

Which led me to look at these two patches:

  [1] https://sourceware.org/pipermail/gdb-patches/2020-April/167612.html
  [2] https://sourceware.org/pipermail/gdb-patches/2020-April/167930.html

When I considered patches [1] and [2] I saw that all of the issues
being addressed here were related, and that there was a single
solution that could address all of these issues.

First I wrote the new test gdb.opt/inline-frame-tailcall.exp, which
shows that [1] and [2] regress the inline tail-call unwinder, the
reason for this is that these two patches replace a call to
gdbarch_unwind_pc with a call to get_frame_register, however, this is
not correct.  The previous call to gdbarch_unwind_pc takes THIS_FRAME
and returns the $pc value in the previous frame.  In contrast
get_frame_register takes THIS_FRAME and returns the value of the $pc
in THIS_FRAME; these calls are not equivalent.

The reason these patches appear (or do) fix the regressions listed in
[1] is that the tail call sniffer depends on identifying the address
of a caller and a callee, GDB then looks for a tail-call sequence that
takes us from the caller address to the callee, if such a series is
found then tail-call frames are added.

The bug that was being hit, and which was address in patch [1] is that
in order to find the address of the caller, GDB ended up creating a
lazy register value for an inline frame with to frame-id.  The
solution in patch [1] is to instead take the address of the callee and
treat this as the address of the caller.  Getting the address of the
callee works, but we then end up looking for a tail-call series from
the callee to the callee, which obviously doesn't return any sane
results, so we don't insert any tail call frames.

The original patch [1] did cause some breakage, so patch [2] undid
patch [1] in all cases except those where we had an inline frame with
no frame-id.  It just so happens that there were no tests that fitted
this description _and_ which required tail-call frames to be
successfully spotted, as a result patch [2] appeared to work.

The new test inline-frame-tailcall.exp, exposes the flaw in patch [2].

This commit undoes patch [1] and [2], and replaces them with a new
solution, which is also different to the solution proposed in the
python/22748 bug report.

In this solution I propose that we introduce some special case logic
to value_of_register_lazy.  To understand what this logic is we must
first look at how inline frames unwind registers, this is very simple,
they do this:

  static struct value *
  inline_frame_prev_register (struct frame_info *this_frame,
                              void **this_cache, int regnum)
  {
    return get_frame_register_value (this_frame, regnum);
  }

And remember:

  struct value *
  get_frame_register_value (struct frame_info *frame, int regnum)
  {
    return frame_unwind_register_value (frame->next, regnum);
  }

So in all cases, unwinding a register in an inline frame just asks the
next frame to unwind the register, this makes sense, as an inline
frame doesn't really exist, when we unwind a register in an inline
frame, we're really just asking the next frame for the value of the
register in the previous, non-inline frame.

So, if we assume that we only get into the missing frame-id situation
when we try to unwind a register from an inline frame during the frame
sniffing process, then we can change value_of_register_lazy to not
create lazy register values for an inline frame.

Imagine this stack setup, where #1 is inline within #2.

  #3 -> #2 -> #1 -> #0
        \______/
         inline

Now when trying to figure out the frame-id for #1, we need to compute
the frame-id for #2.  If the frame sniffer for #2 causes a lazy
register read in #2, either due to a Python Unwinder, or for the
tail-call sniffer, then we call value_of_register_lazy passing in
frame #2.

In value_of_register_lazy, we grab the next frame, which is #1, and we
used to then ask for the frame-id of #1, which was not computed, and
this was our bug.

Now, I propose we spot that #1 is an inline frame, and so lookup the
next frame of #1, which is #0.  As #0 is not inline it will have a
valid frame-id, and so we create a lazy register value using #0 as the
next-frame-id.  This will give us the exact same result we had
previously (thanks to the code we inspected above).

Encoding into value_of_register_lazy the knowledge that reading an
inline frame register will always just forward to the next frame
feels.... not ideal, but this seems like the cleanest solution to this
recursive frame-id computation/sniffing issue that appears to crop
up.

The following two commits are fully reverted with this commit, these
correspond to patches [1] and [2] respectively:

  commit 5939967b355ba6a940887d19847b7893a4506067
  Date:   Tue Apr 14 17:26:22 2020 -0300

      Fix inline frame unwinding breakage

  commit 991a3e2e9944a4b3a27bd989ac03c18285bd545d
  Date:   Sat Apr 25 00:32:44 2020 -0300

      Fix remaining inline/tailcall unwinding breakage for x86_64

gdb/ChangeLog:

PR python/22748
* dwarf2/frame-tailcall.c (dwarf2_tailcall_sniffer_first): Remove
special handling for inline frames.
* findvar.c (value_of_register_lazy): Skip inline frames when
creating lazy register values.
* frame.c (frame_id_computed_p): Delete definition.
* frame.h (frame_id_computed_p): Delete declaration.

gdb/testsuite/ChangeLog:

PR python/22748
* gdb.opt/inline-frame-tailcall.c: New file.
* gdb.opt/inline-frame-tailcall.exp: New file.
* gdb.python/py-unwind-inline.c: New file.
* gdb.python/py-unwind-inline.exp: New file.
* gdb.python/py-unwind-inline.py: New file.

4 years agogdb/python: New method to access list of register groups
Andrew Burgess [Sun, 7 Jun 2020 09:08:01 +0000 (10:08 +0100)]
gdb/python: New method to access list of register groups

Add a new method gdb.Architecture.register_groups which returns a new
object of type gdb.RegisterGroupsIterator.  This new iterator then
returns objects of type gdb.RegisterGroup.

Each gdb.RegisterGroup object just wraps a single reggroup pointer,
and (currently) has just one read-only property 'name' that is a
string, the name of the register group.

As with the previous commit (adding gdb.RegisterDescriptor) I made
gdb.RegisterGroup an object rather than just a string in case we want
to add additional properties in the future.

gdb/ChangeLog:

* NEWS: Mention additions to Python API.
* python/py-arch.c (archpy_register_groups): New function.
(arch_object_methods): Add 'register_groups' method.
* python/py-registers.c (reggroup_iterator_object): New struct.
(reggroup_object): New struct.
(gdbpy_new_reggroup): New function.
(gdbpy_reggroup_to_string): New function.
(gdbpy_reggroup_name): New function.
(gdbpy_reggroup_iter): New function.
(gdbpy_reggroup_iter_next): New function.
(gdbpy_new_reggroup_iterator): New function
(gdbpy_initialize_registers): Register new types.
(reggroup_iterator_object_type): Define new Python type.
(gdbpy_reggroup_getset): New static global.
(reggroup_object_type): Define new Python type.
* python/python-internal.h

gdb/testsuite/ChangeLog:

* gdb.python/py-arch-reg-groups.exp: New file.

gdb/doc/ChangeLog:

* gdb.texi (Registers): Add @anchor for 'info registers
<reggroup>' command.
* python.texi (Architectures In Python): Document new
register_groups method.
(Registers In Python): Document two new object types related to
register groups.

4 years agogdb/python: Add gdb.Architecture.registers method
Andrew Burgess [Fri, 5 Jun 2020 16:52:10 +0000 (17:52 +0100)]
gdb/python: Add gdb.Architecture.registers method

This commit adds a new method gdb.Architecture.registers that returns
an object of the new type gdb.RegisterDescriptorIterator.  This
iterator returns objects of the new type gdb.RegisterDescriptor.

A RegisterDescriptor is not a way to read the value of a register,
this is already covered by Frame.read_register, a RegisterDescriptor
is simply a way to discover from Python, which registers are
available for a given architecture.

I did consider just returning a string, the name of each register,
instead of a RegisterDescriptor, however, I'm aware that it we don't
want to break the existing Python API in any way, so if I return just
a string now, but in the future we want more information about a
register then we would have to add a second API to get that
information.  By going straight to a descriptor object now, it is easy
to add additional properties in the future should we wish to.

Right now the only property of a register that a user can access is
the name of the register.

In future we might want to be able to ask the register about is
register groups, or its type.

gdb/ChangeLog:

* Makefile.in (SUBDIR_PYTHON_SRCS): Add py-registers.c
* python/py-arch.c (archpy_registers): New function.
(arch_object_methods): Add 'registers' method.
* python/py-registers.c: New file.
* python/python-internal.h
(gdbpy_new_register_descriptor_iterator): Declare.
(gdbpy_initialize_registers): Declare.
* python/python.c (do_start_initialization): Call
gdbpy_initialize_registers.
* NEWS: Mention additions to the Python API.

gdb/testsuite/ChangeLog:

* gdb.python/py-arch-reg-names.exp: New file.

gdb/doc/ChangeLog:

* python.texi (Python API): Add new section the menu.
(Frames In Python): Add new @anchor.
(Architectures In Python): Document new registers method.
(Registers In Python): New section.

4 years agogdb/python: Add architecture method to gdb.PendingFrame
Andrew Burgess [Sun, 7 Jun 2020 22:07:52 +0000 (23:07 +0100)]
gdb/python: Add architecture method to gdb.PendingFrame

It could be useful to determine the architecture of a frame being
unwound during the frame unwind process, that is, before we have a
gdb.Frame, but when we only have a gdb.PendingFrame.

The PendingFrame already has a pointer to the gdbarch internally, this
commit just exposes an 'architecture' method to Python, and has this
return a gdb.Architecture object (list gdb.Frame.architecture does).

gdb/ChangeLog:

* NEWS: Mention new Python API method.
* python/py-unwind.c (pending_framepy_architecture): New function.
(pending_frame_object_methods): Add architecture method.

gdb/testsuite/ChangeLog:

* gdb.python/py-unwind.py (TestUnwinder::__call__): Add test for
gdb.PendingFrame.architecture method.

gdb/doc/ChangeLog:

* python.texi (Unwinding Frames in Python): Document
PendingFrame.architecture method.

4 years agogdb: Remove deprecated_set_gdbarch_data
Andrew Burgess [Mon, 8 Jun 2020 13:06:08 +0000 (14:06 +0100)]
gdb: Remove deprecated_set_gdbarch_data

There are currently two remaining uses of deprecated_set_gdbarch_data,
both of which are needed because during gdbarch initialisation we call
gdbarch_data for a data field that is registered using:

  gdbarch_data_register_post_init (....)

However, in both of these cases, the only thing that the call back
needs from the gdbarch struct is its obstack.  Given this there is
nothing stopping us changing the post-init hooks into pre-init hooks.
The pre-init hooks don't get passed the full gdbarch, they only get
passed its obstack.

The IA64 change is completely untested.  The user-regs change has been
tested a little by locally adding some user-regs to the x86-64 target,
and also by running the RISC-V tests, which do use user-regs.

gdb/ChangeLog:

* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (deprecated_set_gdbarch_data): Delete.
(gdbarch_data): Use internal_error for the case where
deprecated_set_gdbarch_data was originally needed.
* ia64-libunwind-tdep.c (libunwind_descr_init): Update parameters,
and use passed in obstack.
(libunwind_frame_set_descr): Should no longer get back NULL from
gdbarch_data.
(_initialize_libunwind_frame): Register as a pre-init gdbarch data
type.
* user-regs.c (user_regs_init): Update parameters, and use passed
in obstack.
(user_reg_add): Should no longer get back NULL from gdbarch_data.
(_initialize_user_regs): Register as a pre-init gdbarch data type.

4 years ago[gdb/symtab] Fix line-table end-of-sequence sorting
Tom de Vries [Mon, 6 Jul 2020 12:28:58 +0000 (14:28 +0200)]
[gdb/symtab] Fix line-table end-of-sequence sorting

Consider test-case gdb.dwarf2/dw2-ranges-base.exp.  It has (ignoring
non-sensical entries that are filtered out by buildsym_compunit::record_line)
a line-table for dw2-ranges-base.c like this:
...
 Line Number Statements:
  [0x0000014e]  Extended opcode 2: set Address to 0x4004ba
  [0x00000159]  Advance Line by 10 to 11
  [0x0000015b]  Copy
  [0x0000015c]  Advance PC by 12 to 0x4004c6
  [0x0000015e]  Extended opcode 1: End of Sequence

  [0x00000161]  Extended opcode 2: set Address to 0x4004ae
  [0x0000016c]  Advance Line by 20 to 21
  [0x0000016e]  Copy
  [0x0000016f]  Advance PC by 12 to 0x4004ba
  [0x00000171]  Extended opcode 1: End of Sequence

  [0x00000174]  Extended opcode 2: set Address to 0x4004a7
  [0x0000017f]  Advance Line by 30 to 31
  [0x00000181]  Copy
  [0x00000182]  Advance PC by 7 to 0x4004ae
  [0x00000184]  Extended opcode 1: End of Sequence
...

If we disable the sorting in buildsym_compunit::end_symtab_with_blockvector,
we have the unsorted line table:
...
INDEX  LINE   ADDRESS            IS-STMT
0      11     0x00000000004004ba Y
1      END    0x00000000004004c6 Y
2      21     0x00000000004004ae Y
3      END    0x00000000004004ba Y
4      31     0x00000000004004a7 Y
5      END    0x00000000004004ae Y
...
It contains 3 sequences, 11/END, 21/END and 31/END.

We want to sort the 3 sequences relative to each other, while sorting on
address, to get:
...
INDEX  LINE   ADDRESS            IS-STMT
0      31     0x00000000004004a7 Y
1      END    0x00000000004004ae Y
2      21     0x00000000004004ae Y
3      END    0x00000000004004ba Y
4      11     0x00000000004004ba Y
5      END    0x00000000004004c6 Y
...

However, if we re-enable the sorting, we have instead:
...
INDEX  LINE   ADDRESS            IS-STMT
0      31     0x00000000004004a7 Y
1      21     0x00000000004004ae Y
2      END    0x00000000004004ae Y
3      11     0x00000000004004ba Y
4      END    0x00000000004004ba Y
5      END    0x00000000004004c6 Y
...

This is a regression since commit 3d92a3e313 "gdb: Don't reorder line table
entries too much when sorting", that introduced sorting on address while
keeping entries with the same address in pre-sort order.

Indeed the entries 1 and 2 are in pre-sort order (they map to entries 2 and 5
in the unsorted line table), but entry 1 does not belong in the sequence
terminated by 2.

Fix this by handling End-Of-Sequence entries in the sorting function, such
that they are sorted before other entries with the same address.

Also, revert the find_pc_sect_line workaround introduced in commit 3d92a3e313,
since that's no longer necessary.

Tested on x86_64-linux.

gdb/ChangeLog:

2020-07-06  Tom de Vries  <tdevries@suse.de>

* buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Handle
End-Of-Sequence in lte_is_less_than.
* symtab.c (find_pc_sect_line): Revert change from commit 3d92a3e313
"gdb: Don't reorder line table entries too much when sorting".

gdb/testsuite/ChangeLog:

2020-07-06  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/dw2-ranges-base.exp: Test line-table order.

4 years agox86: adjust/correct VFRCZ{P,S}{S,D} decoding
Jan Beulich [Mon, 6 Jul 2020 11:44:35 +0000 (13:44 +0200)]
x86: adjust/correct VFRCZ{P,S}{S,D} decoding

The unnecessary XOP.L decoding had caught my eye, together with the not
really expected operand specifiers. Drop this decode step, and instead
make sure XOP.W and XOP.PP don't get ignored. For the latter, do this in
a form applicable to all XOP insns, rather than adding extra table
layers - there are no encodings with the field non-zero. Besides these
two, for the scalar forms XOP.L actually needs to also be zero.

4 years agox86: use %LW / %XW instead of going through vex_w_table[]
Jan Beulich [Mon, 6 Jul 2020 11:44:03 +0000 (13:44 +0200)]
x86: use %LW / %XW instead of going through vex_w_table[]

Since we have these macros, there's no point having unnecessary table
depth.

VFPCLASSP{S,D} are now the first instance of using two %-prefixed
macros, which has pointed out a problem with the implementation. Instead
of using custom code in various case blocks, do the macro accumulation
centralized at the top of the main loop of putop(), and zap the
accumulated macros at the bottom of that loop once it has been
processed.

4 years agox86: most VBROADCAST{F,I}{32,64}x* only accept memory operands
Jan Beulich [Mon, 6 Jul 2020 11:43:34 +0000 (13:43 +0200)]
x86: most VBROADCAST{F,I}{32,64}x* only accept memory operands

VBROADCAST{F,I}32x2 are the only exceptions here.

4 years agox86: adjust/correct V*{F,I}{32x8,64x4}
Jan Beulich [Mon, 6 Jul 2020 11:43:05 +0000 (13:43 +0200)]
x86: adjust/correct V*{F,I}{32x8,64x4}

For all of these only the 512-bit forms are valid, so drop 256-bit ones
from the integer insert/extract variants.

Also replace EXxmmq by the more natural (here) EXymm.

4 years agox86: drop EVEX table entries that can be made served by VEX ones
Jan Beulich [Mon, 6 Jul 2020 11:42:33 +0000 (13:42 +0200)]
x86: drop EVEX table entries that can be made served by VEX ones

By doing the EVEX.W decode first, in various cases VEX table entries can
be re-used.

4 years agox86: AVX512 VPERM{D,Q,PS,PD} insns need to honor EVEX.L'L
Jan Beulich [Mon, 6 Jul 2020 11:41:58 +0000 (13:41 +0200)]
x86: AVX512 VPERM{D,Q,PS,PD} insns need to honor EVEX.L'L

Just like (where they exist) their AVX counterparts do for VEX.L. For
all of them the 128-bit forms are invalid.

4 years agox86: AVX512 extract/insert insns need to honor EVEX.L'L
Jan Beulich [Mon, 6 Jul 2020 11:41:27 +0000 (13:41 +0200)]
x86: AVX512 extract/insert insns need to honor EVEX.L'L

Just like their AVX counterparts do for VEX.L.

At this occasion also make EVEX.W have the same effect as VEX.W on the
printing of VPINSR{B,W}'s operands, bringing them also in sync with
VPEXTR{B,W}.

4 years agox86: honor VEX.W for VCVT{PH2PS,PS2PH}
Jan Beulich [Mon, 6 Jul 2020 11:40:40 +0000 (13:40 +0200)]
x86: honor VEX.W for VCVT{PH2PS,PS2PH}

Unlike for the EVEX-encoded versions, the VEX ones failed to decode
VEX.W. Once the necessary adjustments are done, it becomes obvious that
the EVEX and VEX table entries for VCVTPS2PH are identical and can hence
be folded.

4 years agox86: drop EVEX table entries that can be served by VEX ones
Jan Beulich [Mon, 6 Jul 2020 11:40:13 +0000 (13:40 +0200)]
x86: drop EVEX table entries that can be served by VEX ones

The duplication is not only space inefficient, but also risks entries
going out of sync (some of which that I became aware of while doing this
work will get addressed subsequently). Right here note that for
VGF2P8MULB this also addresses the prior lack of EVEX.W decoding (i.e. a
first example of out of sync entries).

This introduces EXxEVexR to some VEX templates, on the basis that this
operand is benign there and only relevant when EVEX encoding ends up
reaching these entries.

4 years agox86: replace EXqScalarS by EXqVexScalarS
Jan Beulich [Mon, 6 Jul 2020 11:35:38 +0000 (13:35 +0200)]
x86: replace EXqScalarS by EXqVexScalarS

There's only a single user, that that one can do fine with the
alternative, as the "Vex" aspect of the other operand kind is meaningful
only on 3-operand insns.

While doing this I noticed that I didn't need to do the same adjustment
in the EVEX tables, and voilà - there was a bug, which gets fixed at the
same time (see the testsuite changes).

4 years agox86: replace EX{d,q}Scalar by EXxmm_m{d,q}
Jan Beulich [Mon, 6 Jul 2020 11:34:36 +0000 (13:34 +0200)]
x86: replace EX{d,q}Scalar by EXxmm_m{d,q}

Along the lines of 4102be5cf925 ("x86: replace EXxmm_mdq by
EXVexWdqScalar"), but in the opposite direction, replace EXdScalar/
EXqScalar by EXxmm_md/EXxmm_mq respectively, rendering d_scalar_mode and
q_scalar_mode unused. The change is done this way to improve telling
apart operands affected here from ones using EXbScalar/EXwScalar, which
work sufficiently differently. Additionally this increases similarity
between several VEX-encoded insns and their EVEX-encoded counterparts.

4 years agoFix spelling mistakes in some of the binutils sub-directories.
Nick Clifton [Mon, 6 Jul 2020 09:54:36 +0000 (10:54 +0100)]
Fix spelling mistakes in some of the binutils sub-directories.

PR 26204
gas * config/tc-arm.c: Fix spelling mistake.
* config/tc-riscv.c: Likewise.
* config/tc-z80.c: Likewise.
* po/gas.pot: Regenerate.

ld * lexsup.c: Fix spelling mistake.
* po/ld.pot: Regenerate.

opcodes * arc-dis.c: Fix spelling mistake.
* po/opcodes.pot: Regenerate.

4 years agoUpdated translations for various binutils sub-directories
Nick Clifton [Mon, 6 Jul 2020 09:43:35 +0000 (10:43 +0100)]
Updated translations for various binutils sub-directories

4 years ago[gdb/tui,c++17] Fix NULL string_view in tui_partial_win_by_name
Tom de Vries [Mon, 6 Jul 2020 07:54:43 +0000 (09:54 +0200)]
[gdb/tui,c++17] Fix NULL string_view in tui_partial_win_by_name

When building gdb with CFLAGS=-std=gnu17 and CXXFLAGS=-std=gnu++17 and running
test-case gdb.tui/new-layout.exp, we run into:
...
UNRESOLVED: gdb.tui/new-layout.exp: left window box after shrink (ll corner)
FAIL: gdb.tui/new-layout.exp: right window box after shrink (ll corner)
...

In a minimal form, we run into an abort when issuing a winheight command:
...
$ gdb -tui -ex "winheight src - 5"
   <tui stuff>
Aborted (core dumped)
$
...
with this backtrace at the abort:
...
\#0  0x0000000000438db0 in std::char_traits<char>::length (__s=0x0)
     at /usr/include/c++/9/bits/char_traits.h:335
\#1  0x000000000043b72e in std::basic_string_view<char, \
   std::char_traits<char> >::basic_string_view (this=0x7fffffffd4f0, \
   __str=0x0) at /usr/include/c++/9/string_view:124
\#2  0x000000000094971b in tui_partial_win_by_name (name="src")
     at src/gdb/tui/tui-win.c:663
...
due to a NULL comparison which constructs a string_view object from NULL:
...
   657  /* Answer the window represented by name.  */
   658  static struct tui_win_info *
   659  tui_partial_win_by_name (gdb::string_view name)
   660  {
   661    struct tui_win_info *best = nullptr;
   662
   663    if (name != NULL)
...

In gdbsupport/gdb_string_view.h, we either use:
- gdb's copy of libstdc++-v3/include/experimental/string_view, or
- the standard implementation of string_view, when built with C++17 or later
  (which in gcc's case comes from libstdc++-v3/include/std/string_view)

In the first case, there's support for constructing a string_view from a NULL
pointer:
...
      /*constexpr*/ basic_string_view(const _CharT* __str)
      : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
        _M_str{__str}
      { }
...
but in the second case, there's not:
...
      __attribute__((__nonnull__)) constexpr
      basic_string_view(const _CharT* __str) noexcept
      : _M_len{traits_type::length(__str)},
        _M_str{__str}
      { }
...

Fix this by removing the NULL comparison altogether.

Build on x86_64-linux with CFLAGS=-std=gnu17 and CXXFLAGS=-std=gnu++17, and
tested.

gdb/ChangeLog:

2020-07-06  Tom de Vries  <tdevries@suse.de>

PR tui/26205
* tui/tui-win.c (tui_partial_win_by_name): Don't test for NULL name.

4 years agoasan: readelf: stack buffer overflow
Alan Modra [Sun, 5 Jul 2020 23:30:29 +0000 (09:00 +0930)]
asan: readelf: stack buffer overflow

* readelf.c (print_dynamic_symbol): Don't sprintf to buffer to
find string length.

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 6 Jul 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years ago[gdb/build,c++17] Fix use of deprecated std::uncaught_exception
Tom de Vries [Sun, 5 Jul 2020 21:47:20 +0000 (23:47 +0200)]
[gdb/build,c++17] Fix use of deprecated std::uncaught_exception

When compiling gdb with -std=gnu++17, we run into:
...
../../gdb/inferior.h: In member function â€˜void \
  infcall_suspend_state_deleter::operator()(infcall_suspend_state*) const’:
../../gdb/inferior.h:83:12: error: â€˜bool std::uncaught_exception()’ is \
  deprecated [-Werror=deprecated-declarations]
   83 |  if (!std::uncaught_exception ())
...

Fix this by rewriting using std::uncaught_exceptions.

Tested on x86_64-linux with gcc 9.3.1 and -std=gnu17/gnu++17.

Tested with test-case from RFC patch
https://sourceware.org/pipermail/gdb-patches/2020-June/169970.html.

gdb/ChangeLog:

2020-07-05  Tom de Vries  <tdevries@suse.de>

PR build/26187
* inferior.h (struct infcall_suspend_state_deleter): If available, use
std::uncaught_exceptions instead of deprecated
std::uncaught_exception.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 5 Jul 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoTweak version numbers in release-howto
Nick Clifton [Sat, 4 Jul 2020 10:23:17 +0000 (11:23 +0100)]
Tweak version numbers in release-howto

4 years agooops - omitted from previous delta
Nick Clifton [Sat, 4 Jul 2020 09:38:03 +0000 (10:38 +0100)]
oops - omitted from previous delta

4 years agoUpdate version to 2.35.50 and regenerate files
Nick Clifton [Sat, 4 Jul 2020 09:34:23 +0000 (10:34 +0100)]
Update version to 2.35.50 and regenerate files

4 years agoAdd markers for binutils 2.35 branch
Nick Clifton [Sat, 4 Jul 2020 09:16:22 +0000 (10:16 +0100)]
Add markers for binutils 2.35 branch

4 years agogdb: make macro_stringify return a gdb::unique_xmalloc_ptr<char>
Simon Marchi [Fri, 3 Jul 2020 00:38:53 +0000 (20:38 -0400)]
gdb: make macro_stringify return a gdb::unique_xmalloc_ptr<char>

The change to macro_stringify is straightforward.  This allows removing
the manual memory management in fixup_definition.

gdb/ChangeLog:

* macroexp.h (macro_stringify): Return
gdb::unique_xmalloc_ptr<char>.
* macroexp.c (macro_stringify): Likewise.
* macrotab.c (fixup_definition): Update.

Change-Id: Id7db8988bdbd569dd51c4f4655b00eb26db277cb

4 years agogdb: make macro_expand_next return a gdb::unique_xmalloc_ptr<char>
Simon Marchi [Fri, 3 Jul 2020 00:38:47 +0000 (20:38 -0400)]
gdb: make macro_expand_next return a gdb::unique_xmalloc_ptr<char>

For some reason, macro_expand_next does not return a
gdb::unique_xmalloc_ptr<char>, like its counterparts macro_expand and
macro_expand_once.  This patch fixes that.

macro_buffer::release now returns a gdb::unique_xmalloc_ptr<char> too,
which required updating the other callers.  The `.release (). release
()` in macro_stringify looks a bit funny, but it's because one release
is for the macro_buffer, and the other is for the unique ptr.

I removed the ATTRIBUTE_UNUSED_RESULT on macro_buffer::release, I don't
really understand why it's there.  I don't see how this method could be
called without using the result, that would be an obvious memory leak.
The commit that introduced it (4e4a8b932b7 "Add ATTRIBUTE_UNUSED_RESULT
to macro_buffer") doesn't give any details.

gdb/ChangeLog:

* c-exp.y (scan_macro_expansion): Don't free `expansion`.
(lex_one_token): Update.
* macroexp.c (struct macro_buffer) <release>: Return
gdb::unique_xmalloc_ptr<char>.
(macro_stringify): Update.
(macro_expand): Update.
(macro_expand_next): Return gdb::unique_xmalloc_ptr<char>.
* macroexp.h (macro_expand_next): Likewise.

Change-Id: I67a74d0d479d2c20cdc82161ead7c54cea034f56

4 years agogdb: remove callback in macro expand functions
Simon Marchi [Fri, 3 Jul 2020 00:38:25 +0000 (20:38 -0400)]
gdb: remove callback in macro expand functions

I started to look into changing the callbacks in macroexp.h to use
gdb::function_view.  However, I noticed that the passed lookup function
was always `standard_macro_lookup`, which looks up a macro in a
`macro_scope` object.  Since that doesn't look like a very useful
abstraction, it would be simpler to just pass the scope around and have
the various functions call standard_macro_lookup themselves.  This is
what this patch does.

gdb/ChangeLog:

* macroexp.h (macro_lookup_ftype): Remove.
(macro_expand, macro_expand_once, macro_expand_next): Remove
lookup function parameters, add scope parameter.
* macroexp.c (scan, substitute_args, expand, maybe_expand,
macro_expand, macro_expand_once, macro_expand_next): Likewise.
* macroscope.h (standard_macro_lookup): Change parameter type
to macro_scope.
* macroscope.c (standard_macro_lookup): Likewise.
* c-exp.y (lex_one_token): Update.
* macrocmd.c (macro_expand_command): Likewise.
(macro_expand_once_command): Likewise.

Change-Id: Id2431b1489359e1b0274dc2b81e5ea5d225d730c

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 4 Jul 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agosim/igen: Fix linker error with -fno-common
Sebastian Huber [Thu, 2 Jul 2020 16:10:49 +0000 (18:10 +0200)]
sim/igen: Fix linker error with -fno-common

GCC 10 enables -fno-common by default.  This resulted in multiple
definition linker errors since a global variable was declared and
defined in a header file:

  ld: libsim.a(idecode.o):sim/v850/idecode.h:71: multiple definition of
  `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
  here

  ld: libsim.a(engine.o):sim/v850/idecode.h:71: multiple definition of
  `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
  here

  ld: libsim.a(support.o):sim/v850/idecode.h:71: multiple definition of
  `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first defined
  here

  ld: libsim.a(semantics.o):sim/v850/idecode.h:71: multiple definition
  of `idecode_issue'; libsim.a(irun.o):sim/v850/idecode.h:71: first
  defined here

sim/igen

PR sim/26194

* lf.h (lf_get_file_type): Declare.
* lf.c (lf_get_file_type): Define.
* gen-idecode.c (print_idecode_issue_function_header): Use
lf_get_file_type() to issue an extern variable declaration in
case of header files.

4 years agosim/ppc: Fix linker error with -fno-common
Sebastian Huber [Wed, 1 Jul 2020 17:29:55 +0000 (19:29 +0200)]
sim/ppc: Fix linker error with -fno-common

GCC 10 enables -fno-common by default.  This resulted in a multiple
definition linker error since global variables were declared and defined
in a header file:

  ld: ld-insn.o:sim/ppc/ld-insn.h:221: multiple definition of
  `max_model_fields_len'; igen.o:sim/ppc/ld-insn.h:221: first defined here

sim/ppc

* ld-insn.h (last_model, last_model_data, last_model_function,
last_model_internal, last_model_macro, last_model_static):
Delete.
(max_model_fields_len, model_data, model_functions,
model_internal, model_macros, model_static, models): Declare, but do not
define.
* ld-insn.c (last_model, last_model_data, last_model_function,
last_model_internal, last_model_macro, last_model_static,
max_model_fields_len, model_data, model_functions,
model_internal, model_macros, model_static, models): Define.

4 years agoFix gdb.base/structs2.exp with Clang
Pedro Alves [Thu, 2 Jul 2020 18:32:40 +0000 (19:32 +0100)]
Fix gdb.base/structs2.exp with Clang

gdb.base/structs2.exp fails to run with Clang, because of:

 gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:14: warning:
       implicit conversion from 'int' to 'signed char' changes value from 130 to
       -126 [-Wconstant-conversion]
   param_reg (130, 120, 33000, 32000);
   ~~~~~~~~~  ^~~
 /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/structs2.c:16:24: warning:
       implicit conversion from 'int' to 'short' changes value from 33000 to
       -32536 [-Wconstant-conversion]
   param_reg (130, 120, 33000, 32000);
   ~~~~~~~~~            ^~~~~
 2 warnings generated.

 === gdb Summary ===

 # of untested testcases         1

Fix it by passing actual negative numbers.

gdb/testsuite/ChangeLog:

* gdb.base/structs2.c (main): Adjust second parem_reg call to
explicitly write negative numbers.
* gdb.base/structs2.exp: Adjust expected output.

4 years agoFix gdb.base/charset.exp with Clang
Pedro Alves [Thu, 2 Jul 2020 14:54:36 +0000 (15:54 +0100)]
Fix gdb.base/charset.exp with Clang

gdb.base/charset.exp fails to run with Clang, because of:

 gdb compile failed, /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:144:20: warning:
       implicit conversion from 'int' to 'char' changes value from 162 to -94
       [-Wconstant-conversion]
11, 162, 17);
    ^~~
 /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:151:16: warning:
       implicit conversion from 'int' to 'char' changes value from 167 to -89
       [-Wconstant-conversion]
167,
^~~
 /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.base/charset.c:168:16: warning:
       implicit conversion from 'int' to 'char' changes value from 167 to -89
       [-Wconstant-conversion]
167,
^~~
 3 warnings generated.

 === gdb Summary ===

 # of untested testcases         1

Fix it by changing init_string to take unsigned char parameters.

gdb/testsuite/ChangeLog:

* gdb.base/charset.c (init_string): Change all char parameters to
unsigned char parameters.

4 years agoRemove stale -DNO_PROTOTYPES bits from gdb testsuite
Pedro Alves [Fri, 3 Jul 2020 12:34:22 +0000 (13:34 +0100)]
Remove stale -DNO_PROTOTYPES bits from gdb testsuite

The gdb.base/call-sc.exp, gdb.base/structs.exp and
gdb.base/structs2.exp testcases still try compiling the sources with
-DNO_PROTOTYPES, but the corresponding sources don't have any #ifdef
NO_PROTOTYPES any longer.  Those were removed throughout years ago.

OTOH, gdb.base/ovlymgr.h does check for NO_PROTOTYPES, but no .exp
file compiles it with -DNO_PROTOTYPES.

gdb.base/reread.exp and gdb.base/varargs.exp set a 'prototypes'
global, which is a stale bit left behind when the "try-compiling
without and then with -DNO_PROTOTYPES" logic was around.

gdb/testsuite/ChangeLog:

* gdb.base/call-sc.exp (start_scalars_test): Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
* gdb.base/overlays.c: Remove references to PARAMS.
* gdb.base/ovlymgr.h (PARAMS): Delete, and remove all references.
* gdb.base/reread.exp: Don't set 'prototypes' global.
* gdb.base/structs.exp (start_structs_test): Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
* gdb.base/structs2.exp: Don't set 'prototypes' global.  Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
Don't issue "set width 0".  Remove gdb_stop_suppressing_tests
call.
* gdb.base/varargs.exp: Don't set 'prototypes' global.

4 years agoRemove stale overlay testcase bits
Pedro Alves [Fri, 3 Jul 2020 12:34:21 +0000 (13:34 +0100)]
Remove stale overlay testcase bits

D10V support was removed years ago, but the gdb.base/d10vovly.c file
stayed behind.  Looking a bit closer, I can't find anywhere that
references gdb.base/m32rovly.c either.

Both gdb.base/m32rovly.c and gdb.base/d10vovly.c seem to be older
copies of gdb.base/ovlymgr.c, that are exactly the same, except for
some cosmetic differences, and for missing _ovly_debug_event.  Note
that gdb.base/ovlymgr.c has the #ifdef __M32R__ bits too.  Note also
that gdb.base/overlays.exp is currently only supported on m32r, and
that uses ovlymgr.c not gdb.base/m32rovly.c.

gdb/testsuite/ChangeLog:

* gdb.base/d10vovly.c: Delete.
* gdb.base/m32rovly.c: Delete.
* gdb.base/ovlymgr.c: Remove all code guarded by __D10V__.

4 years agoRe: Change readelf's display of symbol names
Alan Modra [Fri, 3 Jul 2020 05:59:13 +0000 (15:29 +0930)]
Re: Change readelf's display of symbol names

Fixes some fallout from git commit 0942c7ab94e5.

PR 26028
gas/
* testsuite/gas/ia64/unwind-ilp32.d: Add -T to readelf options.
gold/
* testsuite/Makefile.am (file_in_many_sections.stdout): Add -W
to readelf options.
* testsuite/Makefile.in: Regenerate.
ld/
* testsuite/ld-arm/arm-elf.exp (vxworks1): Pass --wide to readelf
when dumping relocs.
* testsuite/ld-i386/i386.exp (vxworks1): Likewise.
* testsuite/ld-sh/sh-vxworks.exp (vxworks1): Likewise.
* testsuite/ld-sparc/sparc.exp (vxworks1): Likewise.
* testsuite/ld-arm/vxworks1.rd: Adjust to suit.
* testsuite/ld-i386/vxworks1.rd: Adjust.
* testsuite/ld-sh/vxworks1.rd: Adjust.
* testsuite/ld-sparc/vxworks1.rd: Adjust.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 3 Jul 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agox86: Add SwapSources
H.J. Lu [Thu, 2 Jul 2020 13:30:00 +0000 (06:30 -0700)]
x86: Add SwapSources

We check register-only source operand to decide if two source operands of
VEX encoded instructions should be swapped.  But source operands in AMX
instructions with two source operands swapped are all register-only
operand.  Add SwapSources to indicate two source operands should be
swapped.

gas/

* config/tc-i386.c (build_modrm_byte): Check vexswapsources to
swap two source operands.

opcodes/

* i386-gen.c (opcode_modifiers): Add VexSwapSources.
* i386-opc.h (VexSwapSources): New.
(i386_opcode_modifier): Add vexswapsources.
* i386-opc.tbl: Add VexSwapSources to BMI2 and BMI instructions
with two source operands swapped.
* i386-tbl.h: Regenerated.

4 years agoSkip fill-1 gas test for MeP targets.
Nick Clifton [Thu, 2 Jul 2020 13:08:16 +0000 (14:08 +0100)]
Skip fill-1 gas test for MeP targets.

* testsuite/gas/all/fill-1.d: Skip for MeP targets.

4 years agoaarch64: Fix segfault on unicode symbols
Alex Coplan [Thu, 2 Jul 2020 12:53:07 +0000 (13:53 +0100)]
aarch64: Fix segfault on unicode symbols

This patch fixes a segfault which occurs when the AArch64 backend parses
a symbol operand that begins with a register name and ends with a
unicode byte (byte value > 127).

For example, the following input causes the crash:

x0é: udf x0é

gas/ChangeLog:

2020-07-02  Alex Coplan  <alex.coplan@arm.com>

* config/tc-aarch64.c (reg_name_p): Fix cast so that we don't
segfault on negative chars.
* testsuite/gas/aarch64/reglike-label-unicode-segv.d: New test.
* testsuite/gas/aarch64/reglike-label-unicode-segv.s: Input.

4 years agogdb: remove unused fetch_inferior_event and inferior_event_handler parameters
Simon Marchi [Thu, 2 Jul 2020 12:37:26 +0000 (08:37 -0400)]
gdb: remove unused fetch_inferior_event and inferior_event_handler parameters

I noticed that fetch_inferior_event receives the client_data parameter
from its caller, inferior_event_handler, but doesn't actually need it.
This patch removes it.  In turn, inferior_event_handler doesn't use its
parameter, so remove it too.

The `data` argument used when registering
remote_async_inferior_event_handler is changed to NULL, to avoid
confusion.  It could make people think that the value passed is used
somewhere, when in fact it's not.

gdb/ChangeLog:

* inf-loop.c (inferior_event_handler): Remove client_data param.
* inf-loop.h (inferior_event_handler): Likewise.
* infcmd.c (step_1): Adjust.
* infrun.c (proceed): Adjust.
(fetch_inferior_event): Remove client_data param.
(infrun_async_inferior_event_handler): Adjust.
* infrun.h (fetch_inferior_event): Remove `void *` param.
* linux-nat.c (handle_target_event): Adjust.
* record-btrace.c (record_btrace_handle_async_inferior_event):
Adjust.
* record-full.c (record_full_async_inferior_event_handler):
Adjust.
* remote.c (remote_async_inferior_event_handler): Adjust.

Change-Id: I3c2aa1eb0ea3e0985df096660d2dcd794674f2ea

4 years agoChange readelf's display of symbol names (when not in --wide mode) so that if they...
Nick Clifton [Thu, 2 Jul 2020 10:30:52 +0000 (11:30 +0100)]
Change readelf's display of symbol names (when not in --wide mode) so that if they are going to be truncated then "[...]" is displayed at the end.  Add a comment line option to disable this enhancement and restore the old behaviour.

PR 26028
binutils* readelf.c (print_symbol): Handle truncation of symbol names.
(options): Add -T/--silent-truncation option.
(parse_args): Handle the option.
(print_dynamic_symbol): Correct calculation of width available to
display symbol name.
* doc/binutils.texi: Document the -T option to readelf.
* NEWS: Mention the new feature.

gas * testsuite/gas/ia64/group-2.d: Add -T option to readelf
command line.
* testsuite/gas/ia64/unwind.d: Likewise.
* testsuite/gas/mmix/bspec-1.d: Likewise.
* testsuite/gas/mmix/bspec-2.d: Likewise.
* testsuite/gas/mmix/comment-1.d: Likewise.
* testsuite/gas/tic6x/scomm-directive-4.d: Likewise.

ld * testsuite/ld-powerpc/powerpc.exp: Add -T option to readelf
command line when running some tests.
* testsuite/ld-arm/arm-elf.exp: Likewise.
* testsuite/ld-mips-elf/mips-elf.exp: Likewise.
* testsuite/ld-mmix/local1.d: Likewise.
* testsuite/ld-mmix/local3.d: Likewise.
* testsuite/ld-mmix/local5.d: Likewise.
* testsuite/ld-mmix/local7.d: Likewise.
* testsuite/ld-powerpc/powerpc.exp: Likewise.

4 years agoMake tui_win_info::name pure virtual
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Make tui_win_info::name pure virtual

It seemed cleaner to me for tui_win_info::name to be pure virtual.
This meant adding a name method to the locator window; but this too
seems like an improvement.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-data.h (struct tui_win_info) <name>: Now pure virtual.
* tui/tui-stack.h (struct tui_locator_window) <name>: New method.

4 years agoRemove tui_gen_win_info
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Remove tui_gen_win_info

This merges the tui_gen_win_info base class with tui_win_info;
renaming the resulting class to tui_win_info.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-wingeneral.c (tui_win_info::refresh_window): Move from
tui_gen_win_info.
(tui_win_info::make_window): Merge with
tui_gen_win_info::make_window.
(tui_win_info::make_visible): Move from tui_gen_win_info.
* tui/tui-win.c (tui_win_info::max_width): Move from
tui_gen_win_info.
* tui/tui-layout.h (class tui_layout_window) <m_window>: Change
type.
<window_factory>: Likewise.
* tui/tui-layout.c (tui_win_info::resize): Move from
tui_gen_win_info.
(make_standard_window): Change return type.
(get_locator_window, tui_get_window_by_name): Likewise.
(tui_layout_window::apply): Remove a cast.
* tui/tui-data.h (MIN_WIN_HEIGHT): Move earlier.
(struct tui_win_info): Merge with tui_gen_win_info.
(struct tui_gen_win_info): Remove.

4 years agoDerive tui_locator_window from tui_win_info
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Derive tui_locator_window from tui_win_info

tui_locator_window is the last remaining concrete child class of
tui_gen_win_info.  It seems a bit cleaner to me to flatten the
hierarchy a bit; this patch prepares for that by changing
tui_locator_window to derive from tui_win_info.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.h (struct tui_locator_window): Derive from
tui_win_info.
<do_scroll_horizontal, do_scroll_vertical>: New methods.
<can_box>: New method.

4 years agoRemove body of tui_locator_window constructor
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Remove body of tui_locator_window constructor

The tui_locator_window constructor initializes the first character of
two of its members.  However, this is actually an error, since these
were changed to be std::string.  This removes the erroneous code.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.h (struct tui_locator_window): Remove body.

4 years agoDon't derive tui_data_item_window from tui_gen_win_info
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Don't derive tui_data_item_window from tui_gen_win_info

There's no deep reason that tui_data_item_window should derive from
tui_gen_win_info -- it currently uses a curses window to render, but
that isn't truly needed, and it adds some hacks to other parts of the
TUI.

This patch changes tui_data_item_window so that it doesn't have a base
class, and updates the register window.  This simplifies the code and
enables a subsequent cleanup.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_data_window::display_registers_from)
(tui_data_window::display_registers_from)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows): Update.
(tui_data_window::refresh_window, tui_data_window::no_refresh):
Remove.
(tui_data_window::check_register_values): Update.
(tui_data_item_window::rerender): Add parameters.  Update.
(tui_data_item_window::refresh_window): Remove.
* tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: No longer
virtual.
* tui/tui-regs.h (struct tui_data_item_window): Don't derive from
tui_gen_win_info.
<refresh_window, max_height, min_height>: Remove.
<rerender>: Add parameters.
<x, y, visible>: New members.
(struct tui_data_window) <refresh_window, no_refresh>: Remove.
<m_item_width>: New member.

4 years agoRename tui_data_item_window::item_no
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Rename tui_data_item_window::item_no

tui_data_item_window::item_no is misnamed -- it only can be used for a
register, but it references a "display" number as well.  (Based on
other comments I've seen in the past -- most since deleted -- I think
there were plans at one point to display variables in this window as
well.  However, this was never implemented.)

This patch renames this member to be more correct.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_data_window::show_register_group)
(tui_data_window::check_register_values): Update.
* tui/tui-regs.h (struct tui_data_item_window) <regno>: Rename
from item_no.

4 years agoRemove useless "if' from tui-regs.c
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Remove useless "if' from tui-regs.c

tui_data_window::show_register_group had a useless "if" -- the
condition could never be false.  This patch removes it.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_data_window::show_register_group): Remove
useless "if".

4 years agoRemove tui_data_window::name
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Remove tui_data_window::name

The "name" member of tui_data_window was set, but never used.  This
removes it.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_data_window::show_register_group): Update.
* tui/tui-regs.h (struct tui_data_item_window) <name>: Remove.

4 years agoMove some code out of tui-data.h
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Move some code out of tui-data.h

This moves some code out of tui-data.h, to more closely related
places.  Some unused forward declarations are also removed.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-stack.c (SINGLE_KEY): Move from tui-data.h
* tui/tui-winsource.h (enum tui_line_or_address_kind)
(struct tui_line_or_address): Move from tui-data.h.
* tui/tui-win.c (DEFAULT_TAB_LEN): Move from tui-data.h.
* tui/tui-data.h (DEFAULT_TAB_LEN): Move to tui-win.c.
(tui_cmd_window, tui_source_window_base, tui_source_window)
(tui_disasm_window): Don't declare.
(enum tui_line_or_address_kind, struct tui_line_or_address): Move
to tui-winsource.h.
(SINGLE_KEY): Move to tui-stack.c.

4 years agoRemove tui_expand_tabs
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Remove tui_expand_tabs

tui_expand_tabs only has a single caller.  This patch removes this
function, in favor of a tab-expanding variant of string_file.  This
simplifies the code somewhat.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.h (struct tui_data_item_window) <content>: Now a
std::string.
* tui/tui-regs.c (class tab_expansion_file): New.
(tab_expansion_file::write): New method.
(tui_register_format): Change return type.  Use
tab_expansion_file.
(tui_get_register, tui_data_window::display_registers_from)
(tui_data_item_window::rerender): Update.
* tui/tui-io.h (tui_expand_tabs): Don't declare.
* tui/tui-io.c (tui_expand_tabs): Remove.

4 years agoUse complete_on_enum in tui_reggroup_completer
Tom Tromey [Thu, 2 Jul 2020 03:21:12 +0000 (21:21 -0600)]
Use complete_on_enum in tui_reggroup_completer

tui_reggroup_completer has an "XXXX" comment suggesting the use of
complete_on_enum.  This patch implements this suggestion.

gdb/ChangeLog
2020-07-01  Tom Tromey  <tom@tromey.com>

* tui/tui-regs.c (tui_reggroup_completer): Use complete_on_enum.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 2 Jul 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoRecognize -1 as a tombstone value in .debug_line
Fangrui Song [Wed, 1 Jul 2020 19:31:44 +0000 (12:31 -0700)]
Recognize -1 as a tombstone value in .debug_line

LLD from 11 onwards (https://reviews.llvm.org/D81784) uses -1 to
represent a relocation in .debug_line referencing a discarded symbol.
Recognize -1 to fix gdb.base/break-on-linker-gcd-function.exp when the
linker is a newer LLD.

gdb/ChangeLog:

* dwarf2/read.c (lnp_state_machine::check_line_address): Test -1.

4 years agoPR26188, buff overflow in coff_find_nearest_line_with_names
Alan Modra [Wed, 1 Jul 2020 07:24:50 +0000 (16:54 +0930)]
PR26188, buff overflow in coff_find_nearest_line_with_names

PR 26188
* coffgen.c (coff_find_nearest_line_with_names): Sanity check
raw syment index before dereferencing.

4 years agoAllow reference form for DW_AT_associated and DW_AT_allocated attributes
Alok Kumar Sharma [Wed, 1 Jul 2020 06:23:09 +0000 (11:53 +0530)]
Allow reference form for DW_AT_associated and DW_AT_allocated attributes

Currently, GDB rejects the (die) reference form while it accepts exprloc
form. It is allowed in DWARF standard. "Table 7.5: Attribute encodings"
in DWARF5 standard. Flang compiler assigns (die) reference to
DW_AT_associated and DW_AT_allocated for some cases.

gdb/ChangeLog

* dwarf2/read.c (set_die_type): Removed conditions to restrict
forms for DW_AT_associated and DW_AT_allocated attributes,
which is already checked in function attr_to_dynamic_prop.

4 years agoRe: Remove x86 NaCl target support
Alan Modra [Wed, 1 Jul 2020 07:22:02 +0000 (16:52 +0930)]
Re: Remove x86 NaCl target support

Fixes accidental breakage of vxworks by commit bbd19b19e4.

* elf32-i386.c (elf_backend_object_p): Undef for vxworks.

4 years agoobsolete xc16x
Alan Modra [Tue, 30 Jun 2020 23:45:34 +0000 (09:15 +0930)]
obsolete xc16x

The xc16x md_apply_fix code is just so broken that in my opinion the
target should never have been accepted, and from a quick look at
commit logs for the target it appears that no one has ever contributed
fixes for anything.  This target has just been a 14 year burden on
global binutils and cgen maintainers.  That's not how free software is
supposed to work.

bfd/
* config.bfd: Obsolete xc16x.
gas/
* config/tc-xc16x.c (md_apply_fix): Add FIXME.

4 years agogas eqv-dot test fails
Alan Modra [Tue, 30 Jun 2020 23:44:45 +0000 (09:14 +0930)]
gas eqv-dot test fails

* testsuite/gas/all/eqv-dot.d: xfail targets that set linkrelax
in data sections, and mep.

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 1 Jul 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in

4 years agoUpdate readline/README to mention patchlevel
Tom Tromey [Tue, 30 Jun 2020 21:17:07 +0000 (15:17 -0600)]
Update readline/README to mention patchlevel

This updates readline/README to mention the current patchlevel, and
the "git am" approach to importing new upstream patches.

readline/ChangeLog
2020-06-30  Tom Tromey  <tom@tromey.com>

* README: Update instructions.

4 years agoproblems restoring the history file are not signaled correctly to the calling application
Chet Ramey [Fri, 7 Feb 2020 19:58:55 +0000 (14:58 -0500)]
problems restoring the history file are not signaled correctly to the calling application

4 years agoreading history entries with timestamps can result in joined entries
Chet Ramey [Fri, 7 Feb 2020 19:57:47 +0000 (14:57 -0500)]
reading history entries with timestamps can result in joined entries

4 years agofix problems moving back beyond start of history
Chet Ramey [Fri, 7 Feb 2020 19:56:45 +0000 (14:56 -0500)]
fix problems moving back beyond start of history

4 years agoReadline-8.0 patch 1: fix file descriptor leak with zero-length history file
Chet Ramey [Wed, 14 Aug 2019 15:28:48 +0000 (11:28 -0400)]
Readline-8.0 patch 1: fix file descriptor leak with zero-length history file

4 years agoFix test breakages caused by removal of gdb_py_test_multiple.
Philippe Waroquiers [Tue, 30 Jun 2020 16:40:21 +0000 (18:40 +0200)]
Fix test breakages caused by removal of gdb_py_test_multiple.

Tom de Vries detected that some python tests were broken as
they were still using gdb_py_test_multiple that was replaced
by gdb_test_multiline.  Repair these tests by using the new function.

gdb/testsuite/ChangeLog
2020-06-30  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* gdb.python/py-breakpoint.exp: use gdb_test_multiline instead
of gdb_py_test_multiple.
* gdb.python/py-cmd.exp: Likewise.
* gdb.python/py-events.exp: Likewise.
* gdb.python/py-function.exp: Likewise.
* gdb.python/py-inferior.exp: Likewise.
* gdb.python/py-infthread.exp: Likewise.
* gdb.python/py-linetable.exp: Likewise.
* gdb.python/py-parameter.exp: Likewise.
* gdb.python/py-value.exp: Likewise.

4 years agoRemove x86 NaCl target support
H.J. Lu [Tue, 30 Jun 2020 15:47:02 +0000 (08:47 -0700)]
Remove x86 NaCl target support

NaCl has been deprecated:

https://developer.chrome.com/native-client/migration

and NaCl will completely disappear in 2021:

https://lists.llvm.org/pipermail/llvm-dev/2020-April/141107.html

Remove x86 NaCl target support from bfd, binutils, gas and ld.

bfd/

* archures.c (bfd_mach_i386_nacl): Removed.
(bfd_mach_i386_i386_nacl): Likewise.
(bfd_mach_x86_64_nacl): Likewise.
(bfd_mach_x64_32_nacl): Likewise.
* config.bfd: Remove *-*-nacl* targets.
* configure.ac: Remove x86 NaCl target vectors.
* cpu-i386.c (bfd_arch_i386_onebyte_nop_fill): Removed.
(bfd_x64_32_nacl_arch): Likewise.
(bfd_x86_64_nacl_arch): Likewise.
(bfd_i386_nacl_arch): Likewise.
(bfd_x64_32_arch_intel_syntax): Updated.
* elf32-i386.c: Don't include "elf-nacl.h".
(elf_i386_nacl_plt): Removed.
(elf_i386_nacl_plt0_entry): Likewise.
(elf_i386_nacl_plt_entry): Likewise.
(elf_i386_nacl_pic_plt0_entry): Likewise.
(elf_i386_nacl_pic_plt_entry): Likewise.
(elf_i386_nacl_eh_frame_plt): Likewise.
(elf_i386_nacl_plt): Likewise.
(elf32_i386_nacl_elf_object_p): Likewise.
(elf_i386_get_synthetic_symtab): Updated.
(elf_i386_link_setup_gnu_properties): Likewise.
* elf64-x86-64.c: Don't include "elf-nacl.h".
(elf_x86_64_nacl_plt): Removed.
(elf64_x86_64_nacl_elf_object_p): Likewise.
(elf_x86_64_nacl_plt0_entry): Likewise.
(elf_x86_64_nacl_plt_entry): Likewise.
(elf_x86_64_nacl_eh_frame_plt): Likewise.
(elf_x86_64_nacl_plt): Likewise.
(elf32_x86_64_nacl_elf_object_p): Likewise.
(elf_x86_64_get_synthetic_symtab): Updated.
(elf_x86_64_link_setup_gnu_properties): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
* targets.c: Remove x86 NaCl target vectors.
* bfd-in2.h: Regenerated.
* configure: Likewise.

binutils/

* NEWS: Mention x86 NaCl target support removal.
* dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): Remove
x86 NaCl target support.
* testsuite/binutils-all/elfedit-1.d: Likewise.
* testsuite/binutils-all/i386/i386.exp: Likewise.
* testsuite/binutils-all/x86-64/objects.exp: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
* testsuite/binutils-all/x86-64/x86-64.exp: Likewise.

gas/

* NEWS: Mention x86 NaCl target support removal.
* config/tc-i386.c: Remove x86 NaCl target support.
* config/tc-i386.h: Likewise.
* configure.tgt: Likewise.
* testsuite/gas/i386/i386.exp: Likewise.
* testsuite/gas/i386/iamcu-1.d: Likewise.
* testsuite/gas/i386/iamcu-2.d: Likewise.
* testsuite/gas/i386/iamcu-3.d: Likewise.
* testsuite/gas/i386/iamcu-4.d: Likewise.
* testsuite/gas/i386/iamcu-5.d: Likewise.
* testsuite/gas/i386/k1om.d: Likewise.
* testsuite/gas/i386/l1om.d: Likewise.

ld/

* Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_nacl.c,
eelf32_x86_64_nacl.c, eelf_x86_64_nacl.c.
Remove x86 NaCl dep files.
* NEWS: Mention x86 NaCl target support removal.
* configure.tgt: Remove x86 NaCl target support.
* testsuite/ld-elf/binutils.exp: Likewise.
* testsuite/ld-elf/elf.exp: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-i386/align-branch-1.d: Likewise.
* testsuite/ld-i386/export-class.exp: Likewise.
* testsuite/ld-i386/i386.exp: Likewise.
* testsuite/ld-i386/load1.d: Likewise.
* testsuite/ld-i386/pie1.d: Likewise.
* testsuite/ld-i386/pr12570a.d: Likewise.
* testsuite/ld-i386/pr12570b.d: Likewise.
* testsuite/ld-i386/pr19636-1d.d: Likewise.
* testsuite/ld-i386/pr19636-1l.d: Likewise.
* testsuite/ld-i386/pr19636-2c.d: Likewise.
* testsuite/ld-i386/pr19636-2d.d: Likewise.
* testsuite/ld-i386/pr19636-2e.d: Likewise.
* testsuite/ld-i386/pr20244-1a.d: Likewise.
* testsuite/ld-i386/pr20244-1b.d: Likewise.
* testsuite/ld-i386/pr20244-2a.d: Likewise.
* testsuite/ld-i386/pr20244-2b.d: Likewise.
* testsuite/ld-i386/pr20244-2c.d: Likewise.
* testsuite/ld-i386/pr20244-4a.d: Likewise.
* testsuite/ld-i386/pr20244-4b.d: Likewise.
* testsuite/ld-i386/pr21884.d: Likewise.
* testsuite/ld-ifunc/binutils.exp: Likewise.
* testsuite/ld-ifunc/ifunc-10-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-10-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-11-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-12-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-13-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14c-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14d-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14e-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-14f-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-15-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-17b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-18b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-19b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-5r-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-6b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7a-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-7b-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-8-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-i386.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-x86-64/align-branch-1.d: Likewise.
* testsuite/ld-x86-64/dwarfreloc.exp: Likewise.
* testsuite/ld-x86-64/line.exp: Likewise.
* testsuite/ld-x86-64/load1a.d: Likewise.
* testsuite/ld-x86-64/load1b.d: Likewise.
* testsuite/ld-x86-64/load1c.d: Likewise.
* testsuite/ld-x86-64/load1d.d: Likewise.
* testsuite/ld-x86-64/pie3.d: Likewise.
* testsuite/ld-x86-64/pr18160.d: Likewise.
* testsuite/ld-x86-64/pr19013-x32.d: Likewise.
* testsuite/ld-x86-64/pr19013.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/pr20253-1b.d: Likewise.
* testsuite/ld-x86-64/pr20253-1d.d: Likewise.
* testsuite/ld-x86-64/pr20253-1f.d: Likewise.
* testsuite/ld-x86-64/pr20253-1h.d: Likewise.
* testsuite/ld-x86-64/pr20253-1j.d: Likewise.
* testsuite/ld-x86-64/pr20253-1l.d: Likewise.
* testsuite/ld-x86-64/pr21884.d: Likewise.
* testsuite/ld-x86-64/pr22393-3a.rd: Likewise.
* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
* testsuite/ld-x86-64/tlsgd10.dd: Likewise.
* testsuite/ld-x86-64/tlsgd5.dd: Likewise.
* testsuite/ld-x86-64/tlsgd8.dd: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* emulparams/elf32_x86_64_nacl.sh: Removed.
* emulparams/elf_i386_nacl.sh: Likewise.
* emulparams/elf_x86_64_nacl.sh: Likewise.
* testsuite/ld-i386/emit-relocs-nacl.rd: Likewise.
* testsuite/ld-i386/load1-nacl.d: Likewise.
* testsuite/ld-i386/pie1-nacl.d: Likewise.
* testsuite/ld-i386/plt-nacl.pd: Likewise.
* testsuite/ld-i386/plt-pic-nacl.pd: Likewise.
* testsuite/ld-i386/pr17709-nacl.rd: Likewise.
* testsuite/ld-i386/pr19636-1d-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2c-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2d-nacl.d: Likewise.
* testsuite/ld-i386/pr19636-2e-nacl.d: Likewise.
* testsuite/ld-i386/pr19827-nacl.rd: Likewise.
* testsuite/ld-i386/pr21884-nacl.d: Likewise.
* testsuite/ld-i386/pr21884-nacl.t: Likewise.
* testsuite/ld-i386/tlsbin-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbin2-nacl.rd: Likewise.
* testsuite/ld-i386/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-i386/tlsnopic-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic-nacl.rd: Likewise.
* testsuite/ld-i386/tlspic2-nacl.rd: Likewise.
* testsuite/ld-x86-64/ilp32-4-nacl.d: Likewise.
* testsuite/ld-x86-64/load1a-nacl.d: Likewise.
* testsuite/ld-x86-64/load1b-nacl.d: Likewise.
* testsuite/ld-x86-64/load1c-nacl.d: Likewise.
* testsuite/ld-x86-64/load1d-nacl.d: Likewise.
* testsuite/ld-x86-64/pie3-nacl.d: Likewise.
* testsuite/ld-x86-64/plt-nacl.pd: Likewise.
* testsuite/ld-x86-64/pr17709-nacl.rd: Likewise.
* testsuite/ld-x86-64/pr19013-nacl.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d-nacl.d: Likewise.
* testsuite/ld-x86-64/pr19827-nacl.rd: Likewise.
* testsuite/ld-x86-64/pr21884-nacl.d: Likewise.
* testsuite/ld-x86-64/pr21884-nacl.t: Likewise.
* testsuite/ld-x86-64/split-by-file-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbin2-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.pd: Likewise.
* testsuite/ld-x86-64/tlsdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlsgdesc-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic-nacl.rd: Likewise.
* testsuite/ld-x86-64/tlspic2-nacl.rd: Likewise.
* Makefile.in: Regenerated.
* po/BLD-POTFILES.in: Likewise.

4 years agoFix bug in quirk_rust_enum
Tom Tromey [Tue, 30 Jun 2020 13:57:35 +0000 (07:57 -0600)]
Fix bug in quirk_rust_enum

Tom de Vries pointed out that some Rust tests were failing after the
variant part rewrite.  He sent an executable, which helped track down
this bug.

quirk_rust_enum was passing 1 to alloc_rust_variant in one case.
However, a comment earlier says:

      /* We don't need a range entry for the discriminant, but we do
 need one for every other field, as there is no default
 variant.  */

In this case, we must pass -1 for this parameter.  That is what this
patch implements.

gdb/ChangeLog
2020-06-30  Tom Tromey  <tromey@adacore.com>

* dwarf2/read.c (quirk_rust_enum): Correctly call
alloc_rust_variant for default-less enum.