Jan Beulich [Tue, 14 Nov 2017 07:42:26 +0000 (08:42 +0100)]
x86: add support for AVX-512 VPCMP*{B,W} pseudo-ops
... matching up with VPCMP*{D,Q}.
Jan Beulich [Tue, 14 Nov 2017 07:40:48 +0000 (08:40 +0100)]
x86: string insns don't allow displacements
Remove the misleading indicators from the table.
Alan Modra [Tue, 14 Nov 2017 00:32:57 +0000 (11:02 +1030)]
Inconsistent .eh_frame_hdr on powerpc64
There is code in bfd/elf-eh-frame.c and ld/emultempl/elf32.em that
checks for the presence of eh_frame info by testing for a section
named .eh_frame sized more than 8 bytes. The size test is to exclude
a zero terminator. A similar check in elf64-ppc.c wrongly just tested
for non-zero size before creating the linker generated .eh_frame
describing plt call and other linkage stubs. The intention was to not
generate that info unless there was some user .eh_frame. (No user
.eh_frame implies the user doesn't care about exception handling.)
Because the test in elf64-ppc.c was wrong, ld generated the stub
.eh_frame just on finding a zero .eh_frame terminator in crtend.o, but
didn't generate the corresponding .eh_frame_hdr.
* elf64-ppc.c (ppc64_elf_size_stubs): Correct test for user
.eh_frame info.
Simon Marchi [Tue, 14 Nov 2017 03:06:02 +0000 (22:06 -0500)]
gdb.opt/inline-locals.exp: Remove trailing parentheses in test names
Test names should not end with parentheses, since the buildbot strips
those.
gdb/testsuite/ChangeLog:
* gdb.opt/inline-locals.exp: Remove trailing parentheses from
test names.
GDB Administrator [Tue, 14 Nov 2017 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 13 Nov 2017 16:19:10 +0000 (08:19 -0800)]
ld: Replace exp_dataseg_none with exp_seg_none
* emultempl/ppc32elf.em (ppc_before_allocation): Replace
exp_dataseg_none with exp_seg_none.
* emultempl/ppc64elf.em (prelim_size_sections): Likewise.
* emultempl/spuelf.em (spu_before_allocation): Likewise.
Andreas Schwab [Mon, 13 Nov 2017 14:46:09 +0000 (15:46 +0100)]
Enable hardware single step for m68k in GDBServer
* linux-m68k-low.c (m68k_supports_hardware_single_step): New
function.
(struct linux_target_ops) <supports_hardware_single_step>: Initialize.
Jan Beulich [Mon, 13 Nov 2017 11:27:45 +0000 (12:27 +0100)]
gas/arm64: don't emit stack pointer symbol table entries
Without this change, all of
mov z0.b, p0/m, wsp
mov z0.b, wsp
mov z0.d, p0/m, sp
mov z0.d, sp
insert stray symbols into the symbol table.
Jan Beulich [Mon, 13 Nov 2017 11:26:48 +0000 (12:26 +0100)]
gas/ia64: fix testsuite failures
Commit
dd90581873 ("Place .shstrtab section after .symtab and .strtab,
thus restoring monotonically incre... ") adjusted section numbers, but
forgot to adjust sh_link references from relocation and group section
table entries.
Additionally some other (perhaps subsequent) change appears to have
added .rel.* and .rela.* sections to their respective groups, which
requires some further adjustments to group-2.d. I assume this additional
breakage wasn't noticed because the test was already failing at that
time.
This makes the gas testsuite complete successfully again for me in a
cross build on ix86-linux; there continue to be quite a few ld failures.
Jan Beulich [Mon, 13 Nov 2017 11:26:12 +0000 (12:26 +0100)]
PE: don't corrupt section flags when linking from ELF objects
Linking EFI executables from ELF object files can result in corrupted
COFF section flags if the section's alignment is too high. Issue a
diagnostic in that case, erroring out if this is not a final link, and
make sure only in-range values get written to the output image.
While doing this also make tic80 use the generic alignment macros
instead of custom #ifdef-ary.
No testsuite regressions for the range of COFF/PE targets that actually
cross-build in the first place on x86-64-linux.
Jan Beulich [Mon, 13 Nov 2017 11:22:21 +0000 (12:22 +0100)]
x86: don't default variable shift count insns to 8-bit operand size
Just like %dx in I/O instructions isn't suitable to derive operand size
information, %cl source operands of shift instructions aren't.
Jan Beulich [Mon, 13 Nov 2017 11:21:29 +0000 (12:21 +0100)]
x86: {f,}xsave64 / {f,}xrstor64 / xsaveopt64 should not allow q suffix
Just like is the case for xsave{s,c}64 and xrstors64 already. I wonder
though why xsave{s,c} and xrstors don't allow for the q suffix, other
than the other insns without the "64" suffix do.
Jan Beulich [Mon, 13 Nov 2017 11:20:30 +0000 (12:20 +0100)]
x86/Intel: don't mistake riz/eiz as base register
Just like we make rsp/esp a base register even if it comes second, make
riz/eiz an index register even if it comes first.
Jan Beulich [Mon, 13 Nov 2017 11:19:34 +0000 (12:19 +0100)]
x86-64/Intel: issue diagnostic for out of range displacement
... rather than silently dropping it altogether.
i386_finalize_displacement() expects baseindex to already be set, so
the respective statement needs to be moved up. This then also allows a
subsequent conditional to be simplified.
For this to not regress on 32-bit addressing, break out address size
guessing from i386_index_check(), invoking the new function earlier so
that i386_finalize_displacement() has i.prefix[ADDR_PREFIX] available.
i386_addressing_mode () in turn needs i.base_reg / i.index_reg set
earlier.
H.J. Lu [Sat, 11 Nov 2017 15:02:30 +0000 (07:02 -0800)]
ld: Add ldlang_check_relro_region/update lang_find_relro_sections_1
Extract GNU_RELRO region check into a new funtion and pass a pointer to
seg_align_type to lang_find_relro_sections_1 so that they can also be
used for text-only LOAD segment.
* ldlang.c (lang_size_sections_1): Extract GNU_RELRO region check
into ...
(ldlang_check_relro_region): New function.
(lang_find_relro_sections_1): Add an argument for pointer to
seg_align_type and replace expld.dataseg with the pointer.
(lang_find_relro_sections): Pass address of expld.dataseg to
lang_find_relro_sections_1.
H.J. Lu [Mon, 13 Nov 2017 01:23:22 +0000 (17:23 -0800)]
cl
H.J. Lu [Mon, 13 Nov 2017 01:22:15 +0000 (17:22 -0800)]
ld: Add lang_size_relro_segment
Break lang_size_sections down into separate functions so that they can
also be used for text-only LOAD segment. lang_size_relro_segment will
call lang_size_relro_segment_1 and lang_size_segment for both GNU_RELRO
segment and text-only LOAD segment.
* ldlang.c (lang_size_segment): New function.
(lang_size_relro_segment_1): Likewise.
(lang_size_relro_segment): Likewise.
(lang_size_sections): Rewrite to call lang_size_relro_segment.
H.J. Lu [Mon, 13 Nov 2017 01:20:09 +0000 (17:20 -0800)]
ld: Add fold_segment_align/fold_segment_relro_end/fold_segment_end
Extract DATA_SEGMENT_END/DATA_SEGMENT_ALIGN/DATA_SEGMENT_RELRO_END cases
for GNU_RELRO segment into separate functions so that they can also be
used for text-only LOAD segment.
* ldexp.c (fold_unary): Extract the DATA_SEGMENT_END case to ...
(fold_segment_end): New function.
(fold_binary): Extract the DATA_SEGMENT_ALIGN case to ...
(fold_segment_align): New function.
(fold_binary): Extract the DATA_SEGMENT_RELRO_END case to ...
(fold_segment_relro_end): New function.
H.J. Lu [Mon, 13 Nov 2017 01:17:47 +0000 (17:17 -0800)]
ld: Update phase_enum/relro_enum and add seg_align_type
Update GNU_RELRO date type so that they can also be used for text-only
LOAD segment.
* ldexp.h (phase_enum): Rename exp_dataseg_none,
exp_dataseg_align_seen, exp_dataseg_relro_seen,
exp_dataseg_end_seen, exp_dataseg_relro_adjust,
exp_dataseg_adjust and exp_dataseg_done to exp_seg_none,
exp_seg_align_seen, exp_seg_relro_seen, exp_seg_end_seen,
exp_seg_relro_adjust, exp_seg_adjust and exp_seg_done.
(relro_enum): Rename exp_dataseg_relro_none,
exp_dataseg_relro_start and exp_dataseg_relro_end to
exp_seg_relro_none, exp_seg_relro_start and exp_seg_relro_end.
(seg_align_type): New struct type.
(ldexp_control): Use seg_align_type.
* ldexp.c (fold_unary): Updated.
(fold_binary): Likewise.
* ldlang.c (strip_excluded_output_sections): Likewise.
(lang_size_sections_1): Likewise.
(lang_size_sections): Likewise.
H.J. Lu [Mon, 13 Nov 2017 01:03:50 +0000 (17:03 -0800)]
ld: Remove PF_X from PT_PHDR segment
It was reasonable to mark PT_PHDR segment with PF_X for compatibility
with UnixWare and Solaris linkers 20 years ago. But it is inappropriate
today when the primary OS of GNU ld is Linux. This patch removes PF_X
from PT_PHDR segment as gold does.
Tested natively on Linux/x86 as well as crosss-binutils for alpha-linux,
ia64-linux, powerpc64-linux, powerpc-linux, s390-linux, s390x-linux,
sparc64-linux and sparc-linux.
bfd/
PR ld/22423
* elf.c (_bfd_elf_map_sections_to_segments): Remove PF_X from
PT_PHDR segment.
ld/
PR ld/22423
* testsuite/ld-alpha/tlsbin.rd: Replace "R E " with "R +" for
PT_PHDR segment.
* testsuite/ld-alpha/tlsbinr.rd: Likewise.
* testsuite/ld-ia64/tlsbin.rd: Likewise.
* testsuite/ld-powerpc/tlsexe.r: Likewise.
* testsuite/ld-powerpc/tlsexe32.r: Likewise.
* testsuite/ld-powerpc/tlsexetoc.r: Likewise.
* testsuite/ld-s390/tlsbin.rd: Likewise.
* testsuite/ld-s390/tlsbin_64.rd: Likewise.
* testsuite/ld-sparc/tlssunbin32.rd: Likewise.
* testsuite/ld-sparc/tlssunbin64.rd: Likewise.
* testsuite/ld-elf/pr22423.d: New test.
GDB Administrator [Mon, 13 Nov 2017 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sun, 12 Nov 2017 15:25:26 +0000 (07:25 -0800)]
ld: Add OTHER_PLT_SECTIONS
OTHER_PLT_SECTIONS contains sections which should be placed right after
.plt section.
* emulparams/elf32_x86_64.sh (TINY_READONLY_SECTION): Renamed
to ...
(OTHER_PLT_SECTIONS): This.
* emulparams/elf_i386.sh: Likewise.
* emulparams/elf_iamcu.sh: Likewise.
* emulparams/elf_x86_64.sh: Likewise.
* scripttempl/elf.sc: Place ${OTHER_PLT_SECTIONS} just after
.plt.
Alan Modra [Sun, 12 Nov 2017 03:42:41 +0000 (14:12 +1030)]
weakdef list handling
The existing code allowed common and indirect symbols to pass an
assert, but then read root.u.def which is not valid for anything
besides defined and weakdef symbols. The garbage root.u.def.section
pointer read can't possibly match pointers stored at the same location
for indirect and common symbols, so we would always have left
u.weakdef NULL.
* elflink.c (elf_link_add_object_symbols): Ignore anything but
defined and defweak symbols when setting up weakdefs.
Alan Modra [Sun, 12 Nov 2017 07:14:15 +0000 (17:44 +1030)]
non_got_ref after adjust_dynamic_relocs
This patch was aimed at a FIXME in elf32-hppa.c, the ludicrous and
confusing fact that non_got_ref after adjust_dynamic_relocs in that
backend means precisely the inverse of what it means before
adjust_dynamic_relocs. Before, when non_got_ref is set it means there
are dynamic relocs, after, if non_got_ref is clear it means "keep
dynamic relocs" and later, "has dynamic relocs". There is a reason
why it was done that way.. Some symbols that may have dynamic
relocations pre-allocated in check_relocs turn out to not be dynamic,
and then are not seen by the backend adjust_dynamic_symbols. We want
those symbols to lose their dynamic relocs when non-pic, so it's handy
that non_got_ref means the opposite after adjust_dynamic_relocs. But
it's really confusing.
Most other targets, like ppc32, don't always set non_got_ref on
non-GOT references that have dynamic relocations. This is because the
primary purpose of non_got_ref before adjust_dynamic_relocs is to flag
symbols that might need to be copied to .dynbss, and there are
relocation types that may require dyn_relocs but clearly cannot have
symbols copied into .dynbss, for example, TLS relocations.
Why do we need a flag after adjust_dynamic_relocs to say "keep
dynamic relocations"? Well, you can discard most unwanted dyn_relocs
in the backend adjust_dynamic_relocs, and for those symbols that
aren't seen by the backend adjust_dynamic_relocs, in
allocate_dynrelocs based on a flag set by adjust_dynamic relocs,
dynamic_adjusted. That doesn't solve all our difficulties though.
relocate_section needs to know whether a symbol has dyn_relocs, and
many targets transfer dyn_relocs to a weakdef if the symbol has one.
The transfer means relocate_section can't test dyn_relocs itself and
the weakdef field has been overwritten by that time. So non_got_ref
is used to flag "this symbol has dynamic relocations" for
relocate_section.
Confused still? Well, let's hope the comments I've added help clarify
things.. The patch also fixes a case where we might wrongly emit
dynamic relocations in an executable for common and undefined symbols.
* elf32-hppa.c (elf32_hppa_adjust_dynamic_symbol): Set non_got_ref
to keep dyn_relocs, clear to discard. Comment.
(allocate_dynrelocs): Always clear non_got_ref when clearing
dyn_relocs in non-pic case. Invert non_got_ref test. Also test
dynamic_adjusted and ELF_COMMON_DEF_P. Move code deleting
dyn_relocs on undefined syms to handle for non-pic too.
(elf32_hppa_relocate_section): Simplify test for non-pic dyn relocs.
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Set non_got_ref
to keep dyn_relocs, clear to discard. Comment.
(allocate_dynrelocs): Always clear non_got_ref when clearing
dyn_relocs in non-pic case. Invert non_got_ref test. Also test
dynamic_adjusted and ELF_COMMON_DEF_P. Move code deleting
dyn_relocs on undefined syms to handle for non-pic too.
(ppc_elf_relocate_section): Simplify test for non-pic dyn relocs.
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Discard
dyn_relocs here. Don't bother setting non_got_ref. Comment.
(allocate_dynrelocs): Delete special handling of non-pic ELFv2
ifuncs. Move code deleting dyn_relocs on undefined symbols to
handle for non-pic too. Don't test non_got_ref. Do test
dynamic_adjusted and ELF_COMMON_DEF_P.
GDB Administrator [Sun, 12 Nov 2017 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Sat, 11 Nov 2017 03:24:45 +0000 (19:24 -0800)]
Fix riscv binutils xfail for debug_ranges test.
binutils/
* testsuite/binutils-all/objdump.exp: Expect the debug_ranges test to
pass.
GDB Administrator [Sat, 11 Nov 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 10 Nov 2017 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Thu, 9 Nov 2017 22:44:10 +0000 (22:44 +0000)]
Fix racy output matching in gdb.tui/tui-completion.exp
'make check-read1 TESTS="gdb.tui/tui-completion.exp"' exposes this test race:
(gdb) PASS: gdb.tui/completion.exp: set max-completions unlimited
layout ^G
asm next prev regs split src
(gdb) FAIL: gdb.tui/completion.exp: completion of layout names: tab completion
Quit
(gdb) PASS: gdb.tui/completion.exp: completion of layout names: quit command input
focus ^G
cmd next prev src
(gdb) FAIL: gdb.tui/completion.exp: completion of focus command: tab completion
Quit
This is caused by expecting "$gdb_prompt layout $".
gdb_test_multiple's internal prompt regexp can match first if expect's
internal buffer is filled with partial output. Fix that by splitting
the gdb_test_multiple in question in two. Since the same problem/code
appears twice in the file, factor out a common procedure.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.tui/tui-completion.exp (test_tab_completion): New procedure,
factored out from ...
(top level): ... here, and adjusted to avoid expecting beyond the
prompt in a single gdb_test_multiple.
Pedro Alves [Thu, 9 Nov 2017 22:44:09 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/multi-attach.exp, gdb.server/ext-{attach, restart, ext-run}.exp
This commit fixes this same problem in several places:
(gdb) PASS: gdb.multi/multi-attach.exp: backtrace 2
kill
Kill the program being debugged? (y or n) y
(gdb) FAIL: gdb.multi/multi-attach.exp: kill inferior 2 (got interactive prompt)
This is just another case of the gdb_test_multiple's internal "got
interactive prompt" pattern matching because the testcase misses
matching enough.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.multi/multi-attach.exp ("kill" test): Match the whole query
output.
* gdb.server/ext-attach.exp ("kill" test): Likewise.
* gdb.server/ext-restart.exp ("kill" test): Likewise.
* gdb.server/ext-run.exp ("kill" test): Likewise.
* gdb.server/ext-wrapper.exp ("kill" test): Likewise.
Pedro Alves [Thu, 9 Nov 2017 22:44:09 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/cpcompletion.exp
With:
$ make check-read1 TESTS="gdb.cp/cpcompletion.exp"
we get (from gdb.log):
(gdb) complete break Foo::
break Foo::Foo()
break Foo::Foofoo()
break Foo::get_foo()
break Foo::set_foo(int)
break Foo::~Foo()
(gdb) FAIL: gdb.cp/cpcompletion.exp: complete class methods (Foo not found)
The problem is that the
"break ${class}::\[A-Za-z0-9_~\]+"
regexp patches partial input, like:
break Foo::F
break Foo::Fo
break Foo::Foo
etc.
Fix that by expecting each whole line.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.cp/cpcompletion.exp (test_class_complete): Tighten regex to
match till end of line.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/memattr.exp
Testing with:
$ make check-read1 TESTS="gdb.base/memattr.exp"
Exposes a testcase bug that can result in racy fails:
info mem
Using user-defined memory regions.
Num Enb Low Addr High Addr Attrs
1 y 0x0000000000601060 0x0000000000601160 wo nocache
2 y 0x0000000000601180 0x0000000000601280 ro nocache
4 y 0x0000000000601280 0x0000000000601380 rw nocache
3 y 0x0000000000601380 0x0000000000601480 rw nocache
5 y 0x0000000000601480 0x0000000000601580 rw nocache
(gdb) FAIL: gdb.base/memattr.exp: info mem (1)
The problem is that:
"Attrs\[^\n\r]*.."
matches:
"Attrs \r"
when the output buffer is filled with partial output like this:
"info mem\r\nUsing user-defined memory regions.\r\nNum Enb Low Addr High Addr Attrs \r"
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.base/memattr.exp: Tighten regexes to match the end line.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.base/completion.exp
Testing with:
$ make check-read1 TESTS="gdb.base/completion.exp"
Exposes a testcase bug that can result in racy fails:
FAIL: gdb.base/completion.exp: command-name completion limiting using tab character
ERROR: Undefined command "".
FAIL: gdb.base/completion.exp: symbol-name completion limiting using tab character
FAIL: gdb.base/completion.exp: symbol-name completion limiting using complete command
testsuite/gdb.log shows:
(gdb) PASS: gdb.base/completion.exp: set max-completions 5
p^G
passcount path print print-object printf
*** List may be truncated, max-completions reached. ***
(gdb) FAIL: gdb.base/completion.exp: command-name completion limiting using tab character
pcomplete p
Undefined command: "pcomplete". Try "help".
(gdb) ERROR: Undefined command "".
The problem is that the expect buffer can get filled with partial
output that ends in the gdb prompt, and so the default FAIL inside
gdb_test_multiple matches.
Fix that by splitting the gdb_test_multiple in two stages. Since that
is done in more than one place in the testcase, move the otherwise
duplicate code to helper procedures.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.base/completion.exp (ignore_and_resync, test_tab_complete):
New procedures, factored out from ...
(top level): ... here, and adjusted to avoid expecting beyond the
prompt in one go.
Pedro Alves [Thu, 9 Nov 2017 22:44:08 +0000 (22:44 +0000)]
Fix racy output matching in gdb.asm/asm-source.exp
Testing with:
$ make check-read1 TESTS="gdb.asm/asm-source.exp"
Exposes a testcase bug that can result in racy fails:
(gdb) PASS: gdb.asm/asm-source.exp: next over foo3
return
Make selected stack frame return now? (y or n) y
n
#0 main () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.asm/asmsrc1.s:53
53 gdbasm_exit0
(gdb) FAIL: gdb.asm/asm-source.exp: return from foo2 (got interactive prompt)
n
The problem is that the "return now\?.*" regex can match partial
output like this:
"Make selected stack frame return no"
and then we send the 'y' too early, and then the next time around we
hit gdb_test_multiple's internal "got interactive prompt" regex.
Also, note we match "return no" instead of "return now" because the
regex is missing one quote level.
gdb/testsuite/ChangeLog:
2017-11-09 Pedro Alves <palves@redhat.com>
* gdb.asm/asm-source.exp ("kill" test): Match the whole query
output. Fix '?' match.
H.J. Lu [Thu, 9 Nov 2017 22:36:51 +0000 (14:36 -0800)]
ld: Reformat emultempl/elf32.em
Reformat emultempl/elf32.em to generate consistent codes.
* emultempl/elf32.em (gld${EMULATION_NAME}_get_script): Reformat
to generate consistent codes.
Joel Brobecker [Thu, 9 Nov 2017 19:58:37 +0000 (11:58 -0800)]
fix typos in ada-lang.c comment
gdb/ChangeLog:
* ada-lang.c: Fix some typos in the general command documenting
how Ada expressions are being evaluated and how their result
is printed.
Jim Wilson [Thu, 9 Nov 2017 17:43:59 +0000 (09:43 -0800)]
Fix riscv dwarf2-10 gas testsuite failure.
gas/
* testsuite/gas/elf/dwarf2-10.l: Accept optional line number in error.
Tamar Christina [Thu, 9 Nov 2017 15:50:56 +0000 (15:50 +0000)]
Enable the Dot Product extension by default for Armv8.4-a.
include/
* opcode/aarch64.h (AARCH64_ARCH_V8_4): Enable DOTPROD.
gas/testsuite
* gas/aarch64/dotproduct_armv8_4.s: New.
* gas/aarch64/dotproduct_armv8_4.d: New.
Tamar Christina [Thu, 9 Nov 2017 15:48:43 +0000 (15:48 +0000)]
Add assembler and disassembler support for the new Armv8.4-a registers for AArch64.
Some of these instructions have been back-ported as optional extensions to
Armv8.2-a and higher, but others are only available for Armv8.4-a.
opcodes/
* aarch64-opc.c (aarch64_sys_regs): Add ARMv8.4-a registers;
dit, vstcr_el2, vsttbr_el2, cnthvs_tval_el2, cnthvs_cval_el2,
cnthvs_ctl_el2, cnthps_tval_el2, cnthps_cval_el2, cnthps_ctl_el2,
sder32_el2, vncr_el2.
(aarch64_sys_reg_supported_p): Likewise.
(aarch64_pstatefields): Add dit register.
(aarch64_pstatefield_supported_p): Likewise.
(aarch64_sys_regs_tlbi): Add vmalle1os, vae1os, aside1os, vaae1os,
vale1os, vaale1os, ipas2e1os, ipas2le1os, vae2os, vale2os, vmalls12e1os,
vae3os, vale3os, alle2os, alle1os, alle3os, rvae1, rvaae1, rvale1,
rvaale1, rvae1is, rvaae1is, rvale1is, rvaale1is, rvae1os, rvaae1os,
rvale1os, rvaale1os, ripas2e1is, ripas2le1is, ripas2e1, ripas2le1,
ripas2e1os, ripas2le1os, rvae2, rvale2, rvae2is, rvale2is, rvae2os,
rvale2os, rvae3, rvale3, rvae3is, rvale3is, rvae3os, rvale3os.
gas/testsuite
* gas/aarch64/armv8_4-a-registers-illegal.d: New.
* gas/aarch64/armv8_4-a-registers-illegal.l: New.
* gas/aarch64/armv8_4-a-registers-illegal.s: New.
* gas/aarch64/armv8_4-a-registers.d: New.
* gas/aarch64/armv8_4-a-registers.s: New.
Tamar Christina [Thu, 9 Nov 2017 15:45:00 +0000 (15:45 +0000)]
Add the operand encoding types for the new Armv8.2-a back-ported instructions. These are to be used later when the new instructions are added.
opcodes/
* aarch64-tbl.h (QL_SHA512UPT, QL_V2SAME2D, QL_V3SAME2D): New.
(QL_V4SAME16B, QL_V4SAME4S, QL_XAR, QL_SM3TT, QL_V3FML2S): New.
(QL_V3FML4S, QL_V2FML2S, QL_V2FML4S, QL_RMIF, QL_SETF): New.
(QL_STLW, QL_STLX): New.
Tamar Christina [Thu, 9 Nov 2017 15:22:30 +0000 (15:22 +0000)]
Adds the new Fields and Operand types for the new instructions in Armv8.4-a.
gas/
* config/tc-aarch64.c (process_omitted_operand):
Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2
and AARCH64_OPND_IMM_2.
(parse_operands): Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2,
AARCH64_OPND_IMM_2, AARCH64_OPND_MASK
and AARCH64_OPND_ADDR_OFFSET.
include/
* opcode/aarch64.h:
(aarch64_opnd): Add AARCH64_OPND_Va, AARCH64_OPND_MASK,
AARCH64_OPND_IMM_2, AARCH64_OPND_ADDR_OFFSET
and AARCH64_OPND_SM3_IMM2.
(aarch64_insn_class): Add cryptosm3 and cryptosm4.
(arch64_feature_set): Make uint64_t.
opcodes/
* aarch64-asm.h (ins_addr_offset): New.
* aarch64-asm.c (aarch64_ins_reglane): Add cryptosm3.
(aarch64_ins_addr_offset): New.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis.h (ext_addr_offset): New.
* aarch64-dis.c (aarch64_ext_reglane): Add cryptosm3.
(aarch64_ext_addr_offset): New.
* aarch64-dis-2.c: Regenerate.
* aarch64-opc.h (aarch64_field_kind): Add FLD_imm6_2,
FLD_imm4_2 and FLD_SM3_imm2.
* aarch64-opc.c (fields): Add FLD_imm6_2,
FLD_imm4_2 and FLD_SM3_imm2.
(operand_general_constraint_met_p): Add AARCH64_OPND_ADDR_OFFSET.
(aarch64_print_operand): Add AARCH64_OPND_Va, AARCH64_OPND_SM3_IMM2,
AARCH64_OPND_MASK, AARCH64_OPND_IMM_2 and AARCH64_OPND_ADDR_OFFSET.
* aarch64-opc-2.c (Va, MASK, IMM_2, ADDR_OFFSET, SM3_IMM2): New.
* aarch64-tbl.h
(aarch64_opcode_table): Add Va, MASK, IMM_2, ADDR_OFFSET, SM3_IMM2.
Tom Tromey [Thu, 2 Nov 2017 18:48:44 +0000 (12:48 -0600)]
Simplify the psymbol hash function
This patch simplifies the psymbol_hash function, by changing it not to
examine the contents of the symbol's name. This change just mirrors
what psymbol_compare already does -- it is checking for name equality,
which is ok because symbol names are interned in symbol_set_names.
This change speeds up psymbol reading. "gdb -nx -batch gdb"
previously took ~1.8 seconds on my machine, and with this patch it now
takes ~1.7 seconds.
gdb/ChangeLog
2017-11-09 Tom Tromey <tom@tromey.com>
* psymtab.c (psymbol_hash): Do not hash string contents.
(psymbol_compare): Add comment.
Tom Tromey [Wed, 1 Nov 2017 17:15:06 +0000 (11:15 -0600)]
Speed up dict_hash
This speeds up dict_hash a bit, by moving the "TKB" check into the
switch in the loop.
For "gdb -nx -readnow -batch gdb", this improves the time from ~9.8s
before to ~8.5s afterward.
gdb/ChangeLog
2017-11-09 Tom Tromey <tom@tromey.com>
* dictionary.c (dict_hash): Move "TKB" check into the "switch".
Tamar Christina [Thu, 9 Nov 2017 11:21:31 +0000 (11:21 +0000)]
Split the ARM Crypto ISA extensions for AES and SHA1+2 into their own options (+aes and +sha2). The reason for the split is because with the introduction of Armv8.4-a the implementation of AES has explicitly been made independent of the implementation of the other crypto extensions.
gas * config/tc-aarch64.c (aarch64_arch_option_table): Add armv8.4-a.
(aarch64_features): Added SM4 and SHA3.
include * opcode/aarch64.h:
(AARCH64_FEATURE_V8_4, AARCH64_FEATURE_SM4): New.
(AARCH64_ARCH_V8_4, AARCH64_FEATURE_SHA3): New.
opcodes * aarch64-tbl.h
(aarch64_feature_v8_4, aarch64_feature_crypto_v8_2): New.
(aarch64_feature_sm4, aarch64_feature_sha3): New.
(aarch64_feature_fp_16_v8_2): New.
(ARMV8_4, SHA3, SM4, CRYPTO_V8_2, FP_F16_V8_2): New.
(V8_4_INSN, CRYPTO_V8_2_INSN): New.
(SHA3_INSN, SM4_INSN, FP16_V8_2_INSN): New.
Nick Clifton [Thu, 9 Nov 2017 10:28:32 +0000 (10:28 +0000)]
Change the type of the aarch64_feature_set typedef to unsigned long long so that it will work on 32-bit hosts.
* opcode/aarch64.h (aarch64_feature_set): Change type to unsigned
long long.
Joel Brobecker [Fri, 3 Mar 2017 16:31:13 +0000 (17:31 +0100)]
local variable watchpoint not deleted after leaving scope
When debugging an Ada program, and inserting a watchpoint tracking
a local variable, the watchpoint doesn't get automatically deleted
upon leaving that variable's scope. This watchpoint then starts
creating problems later on, when trying to resume the program's
execution from a location outside of the watchpoint's scope:
(gdb) c
Continuing.
Breakpoint 2, foo_p708_025 () at foo_p708_025.adb:7
7 Do_Nothing (Val);
(gdb) n
No frame is currently executing in block pck.get_val.
Command aborted.
(gdb) c
Continuing.
No frame is currently executing in block pck.get_val.
Command aborted.
The expected output is the following:
- The program's execution after the first continue should stop
as soon as we reach the end of the watchpoint's scope, and
the debugger should be deleting it.
- Then we can continue until reaching breakpoint 2 above;
- After which we should be able to do next/continue as usual.
The reason the watchpoint is not automatically deleted at scope exit
is because the watchpoint is not marked as being scope-specific
(b->exp_valid_block is equal NULL), and this is because the
symbol lookup for our local variable failed to set the innermost_block
global variable during the lookup.
More precisely, if we look at watch_command_1, we do the following:
innermost_block = NULL;
[...]
exp = parse_exp_1 (&arg, 0, 0, 0);
[...]
exp_valid_block = innermost_block;
Currently, innermost_block stays NULL after the call to parse_exp_1.
Digging further, this innermost_block is typically set during symbol
lookup when the symbol is considered to have a frame-relative address.
For instance, in c-exp.y, we see some code like the following:
if (symbol_read_needs_frame (sym.symbol))
{
if (innermost_block == 0
|| contained_in (sym.block,
innermost_block))
innermost_block = sym.block;
}
We actually have the exact same mechanism in ada-exp.y, except
that it vhas accidently been turned off. See write_var_from_sym,
where we start with:
if (orig_left_context == NULL && symbol_read_needs_frame (sym))
{
if (innermost_block == 0
|| contained_in (block, innermost_block))
innermost_block = block;
}
In this case, orig_left_context is a parameter, and looking at
the point of call in write_var_or_type, we see:
if (nsyms == 1)
{
write_var_from_sym (par_state, block, syms[0].block,
syms[0].symbol);
In the call above, the paramater we are interested in is "block",
which is a parameter for write_var_or_type as well, except we
explicitly override its value at the beginning when found to be NULL:
if (block == NULL)
block = expression_context_block;
So the block we pass to write_var_from_sym is not NULL, and
we therefore don't set innermost_block, which leads to the watchpoint
no longer being marked as scope-specific.
The handling of orig_left_context in write_var_from_sym was there
to handle the case where a user writes an expression where the symbol
is qualified with a scope (Eg: "function::variable"). But it appears
that handling this is specifically here is no longer necessary,
so this patch simply removes that parameter and the associated check,
and then updates all the points of calls.
Interestingly, this also affects GDB/MI, and in particular varobjs,
because local variables are now properly reported as having a block,
which causes the associated varob to have a "thread-id" field.
This patch also adjusts a couple of Ada/gdb-mi tests.
gdb/ChangeLog:
* ada-exp.y (write_var_from_sym): Remove parameter
"orig_left_context". Update all callers.
gdb/testsuite/ChangeLog:
* gdb.ada/scoped_watch: New testcase.
* gdb.ada/watch_arg.exp: Adjust expected behavior to the behavior
which is actually correct.
* gdb.ada/mi_interface.exp: Add missing thread-id in expected varobj.
* gdb.ada/mi_var_array.exp: Add missing thread-id in expected varobj.
Simon Marchi [Thu, 9 Nov 2017 00:42:08 +0000 (19:42 -0500)]
Make encode_actions_rsp use std::vector
Currently, encode_actions_rsp returns two malloc'ed arrays of malloc'ed
strings (char *) by pointer. Change this to use
std::vector<std::string>. This eliminates some cleanups in remote.c.
Regtested on the buildbot.
gdb/ChangeLog:
* tracepoint.h (class collection_list) <stringify>: Return
std::vector<std::string>.
(encode_actions_rsp): Change parameters to
std::vector<std::string> *.
* tracepoint.c (collection_list::stringify): Return
std::vector<std::string> and adjust accordingly.
(encode_actions_rsp): Changee parameters to
std::vector<std::string> and adjust accordingly.
* remote.c (free_actions_list),
free_actions_list_cleanup_wrapper): Remove.
(remote_download_tracepoint): Adjust to std::vector.
H.J. Lu [Wed, 8 Nov 2017 23:56:54 +0000 (15:56 -0800)]
gold: Ignore def/ref from a dynamic object for special symbols
Since special symbol must be defined in a regular object, definition
from a dynamic object should be ignored. If special symbol has the
hidden or internal visibility, reference from a dynamic object should
also be ignored. Also __start and __stop symbols in a dynamic object
shouldn't be preempted.
PR gold/22291
* layout.cc (Layout::define_section_symbols): Use STV_PROTECTED
for __start and __stop symbols.
* symtab.cc (Symbol_table::define_special_symbol): Add an
argument, visibility. Ignore definition and reference from
a dynamic object, depending on visibility.
(Symbol_table::do_define_in_output_data): Pass visibility to
define_special_symbol.
(Symbol_table::do_define_in_output_segment): Likewise.
(Symbol_table::do_define_as_constant): Likewise.
(Symbol_table::add_undefined_symbol_from_command_line): Pass
STV_DEFAULT to define_special_symbol.
* symtab.h (Symbol_table::define_special_symbol): Add an
argument, visibility.
GDB Administrator [Thu, 9 Nov 2017 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Wed, 8 Nov 2017 23:42:11 +0000 (23:42 +0000)]
Avoid expensive complaint calls when complaints are disabled
Running perf on "gdb -nx -readnow -batch gdb", I'm seeing a lot of
time (24%.75!) spent in gettext, via complaints. 'perf report -g' shows:
- 86.23% 0.00% gdb gdb [.] gdb_main
- gdb_main
- 85.60% catch_command_errors
symbol_file_add_main_adapter
symbol_file_add_main
symbol_file_add_main_1
symbol_file_add
- symbol_file_add_with_addrs
- 84.31% dw2_expand_all_symtabs
- dw2_instantiate_symtab
- 83.79% dw2_do_instantiate_symtab
- 70.85% process_die
- 41.11% dwarf_decode_macros
- 41.09% dwarf_decode_macro_bytes
- 39.74% dwarf_decode_macro_bytes
>>>>>>>>>>>>>>>>>>>>>>> + 24.75% __dcigettext <<<<<<<
+ 7.37% macro_define_object_internal
+ 3.16% macro_define_function
0.77% splay_tree_insert
+ 0.76% savestring
+ 0.58% free
0.53% read_indirect_string_at_offset_from
0.54% macro_define_object_internal
0.51% macro_start_file
+ 25.57% process_die
+ 4.07% dwarf_decode_lines
+ 4.28% compute_delayed_physnames
+ 3.85% end_symtab_from_static_block
+ 3.38% load_cu
+ 1.29% end_symtab_get_static_block
+ 0.52% do_my_cleanups
+ 1.29% read_symbols
+ 0.54% gdb_init
The problem is that we're always computing the arguments to pass to
complaint, including passing the format strings through gettext, even
when complaints are disabled. As seen above, gettext can be quite
expensive.
Fix this by wrapping complaint in a macro that skips the real
complaint call when complaints are disabled.
This improves "gdb -nx -readnow -batch gdb" from
~11.0s => ~7.8s with -O2 -g3, and
~6.0s => ~5.3s with -O2 -g.
w/ gcc 5.3.1, on x86_64, for me.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* complaints.c (stop_whining): Make extern.
(complaint): Rename to ...
(complaint_internal): ... this.
* complaints.h (complaint): Rename to ...
(complaint_internal): ... this.
(complaint): Reimplement as macro around complaint_internal.
gdb/testsuite/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* gdb.gdb/complaints.exp (test_initial_complaints)
(test_serial_complaints, test_short_complaints): Call
complaint_internal instead of complaint.
James Clarke [Wed, 8 Nov 2017 23:13:53 +0000 (15:13 -0800)]
Fix problems with -r.
The fix committed for PR gold/19291 ended up breaking other cases. The
commit added adjustment code to write_local_symbols, but in many cases
compute_final_local_value_internal had already subtracted the output
section's address. To fix this, all other adjustments are now removed, so
only the one in write_local_symbols is left.
gold/
PR gold/22266
* object.cc (Sized_relobj_file::compute_final_local_value_internal):
Drop relocatable parameter and stop adjusting output value based on
it.
(Sized_relobj_file::compute_final_local_value): Stop passing
relocatable to compute_final_local_value_internal.
(Sized_relobj_file::do_finalize_local_symbols): Ditto.
* object.h (Sized_relobj_file::compute_final_local_value_internal):
Drop relocatable parameter.
Eric Christopher [Wed, 8 Nov 2017 22:03:55 +0000 (14:03 -0800)]
Apply:
2017-11-08 Kyle Butt <iteratee@google.com>
* object.cc (do_find_special_sections): Fix a thinko with memmem return
values and check for != NULL rather than == 0.
Djordje Todorovic [Wed, 8 Nov 2017 21:19:05 +0000 (21:19 +0000)]
Add test for fetching TLS from core file
A correct PID is needed by `libthread_db' library supplied with
glibc repository revisions before commit
c579f48edba8 ("Remove
cached PID/TID in clone") or versions before 2.25 release for
GDB to fetch value of TLS variable from core file. On MIPS
platforms it was omitted and fetching value of TLS variable was not
available.
This adds a new test in order to be sure if GDB on native platforms
can successfully fetch value of TLS variable.
gdb/testsuite:
* gdb.threads/tls-core.c: New file.
* gdb.threads/tls-core.exp: Likewise.
Djordje Todorovic [Wed, 8 Nov 2017 21:19:05 +0000 (21:19 +0000)]
BFD: Extract PID from MIPS core dump file
On MIPS o32, n32 and n64 platforms, PID information was not
correctly propagated from core dump file to internal GDB
structures. This patch fixes that behavior.
A correct PID is needed by `libthread_db' library supplied with
glibc repository revisions before commit
c579f48edba8 ("Remove
cached PID/TID in clone") or released versions before 2.25 for
GDB to fetch value of TLS variable from core file.
bfd/ChangeLog:
* elf32-mips.c (elf32_mips_grok_psinfo): Extract core->pid.
* elf64-mips.c (elf64_mips_grok_psinfo): Likewise.
* elfn32-mips.c (elf32_mips_grok_psinfo): Likewise.
Djordje Todorovic [Wed, 8 Nov 2017 21:19:05 +0000 (21:19 +0000)]
BFD: Write Linux core PRSTATUS note into MIPS core file
On MIPS o32, n32 and n64 platforms information such as PID was not
correctly written into core file from GDB.
This fixes that behavior.
bfd/ChangeLog:
* elf32-mips.c (elf32_mips_write_core_note): New function.
(elf_backend_write_core_note): New macro.
* elf64-mips.c (elf64_mips_write_core_note): New function.
(elf_backend_write_core_note): New macro.
* elfn32-mips.c (elf32_mips_write_core_note): New function.
(elf_backend_write_core_note): New macro.
Tom Tromey [Fri, 3 Nov 2017 20:55:39 +0000 (14:55 -0600)]
Remove symbolp vector
This removes the symbolp typedef from dwarf2read.c and converts the
associated VEC uses to std::vector. This fixes a latent possible
memory leak if an exception were thrown, because there were no
cleanups installed for these VECs.
Regression tested on the buildbot.
gdb/ChangeLog
2017-11-08 Tom Tromey <tom@tromey.com>
* dwarf2read.c (symbolp): Remove typedef.
(read_func_scope): Use std::vector.
(process_structure_scope): Use std::vector.
Pedro Alves [Wed, 8 Nov 2017 14:22:34 +0000 (14:22 +0000)]
Make the linespec/location completer ignore data symbols
Currently "b foo[TAB]" offers data symbols as completion candidates.
This doesn't make sense, since you can't set a breakpoint on data
symbols, only on code symbols.
(gdb) b globa[TAB]
(gdb) b global [ENTER]
Function "global" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) info symbol global
global in section .rodata
So this patch makes linespec completion ignore data symbols.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_make_symbol_completion_list): Use
completion_skip_symbol.
* symtab.c (symbol_is_function_or_method(minimal_symbol*)): New.
(symbol_is_function_or_method(symbol*)): New.
(add_symtab_completions): Add complete_symbol_mode parameter. Use
completion_skip_symbol.
(default_collect_symbol_completion_matches_break_on): Use
completion_skip_symbol. Pass down mode.
(collect_file_symbol_completion_matches): Pass down mode.
* symtab.h (symbol_is_function_or_method): New declarations.
(completion_skip_symbol): New template function.
Pedro Alves [Wed, 8 Nov 2017 14:22:34 +0000 (14:22 +0000)]
Use search_domain::FUNCTIONS_DOMAIN when setting breakpoints
While working on C++ support for wild matching, I noticed that
attaching to my system's Firefox (which uses .gdb_index), setting a
break at main and bailing, like:
$ gdb --batch -q -p `pidof firefox` -ex "b main"
would get substancially slower. It'd take around 20s when currently
it takes 3s.
The problem is that gdb would expand more symtabs than currently,
because Firefox has symbols named like "nsHtml5Atoms::main",
"nsGkAtoms::main", etc., which given wild matching, match.
However, these are not function symbols, [they're "(nsIAtom *)"], so
it seems silly that they'd cause expansion in the first place.
The .gdb_index code (dwarf2read.c:dw2_expand_marked_cus) filters out
symbols matches based on search_domain:
case VARIABLES_DOMAIN:
if (symbol_kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
continue;
break;
case FUNCTIONS_DOMAIN:
if (symbol_kind != GDB_INDEX_SYMBOL_KIND_FUNCTION)
continue;
break;
case TYPES_DOMAIN:
if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
continue;
break;
default:
break;
however, we're currently passing down search_domain::ALL_DOMAIN when
we know we're looking for functions, for no good reason. This patch
fixes that.
It seems like search_domain is underutilized throughout, but I'll
leave using it more for another pass.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* linespec.c (iterate_over_all_matching_symtabs): Add
search_domain parameter. Pass it down to expand_symtabs_matching.
(decode_objc): Request FUNCTIONS_DOMAIN symbols only.
(lookup_prefix_sym): Adjust by passing ALL_DOMAIN as
search_domain.
(add_all_symbol_names_from_pspace): Add search_domain parameter.
Pass it down.
(find_method, find_function_symbols): Request FUNCTIONS_DOMAIN
symbols.
(add_matching_symbols_to_info): Add search_domain parameter. Pass
it down.
Pedro Alves [Wed, 8 Nov 2017 14:22:34 +0000 (14:22 +0000)]
Simplify completion_list_add_name | remove sym_text / sym_text_len
sym_text_len existed to strip parameters out of the lookup name. Now
that that's handled by the lookup_name_info objects, the
sym_text/sym_text_len parameters are no longer necessary.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_make_symbol_completion_list): Remove text and
text_len locals and don't pass them down.
* symtab.c (completion_list_add_name): Remove
sym_text/sym_text_len parameters and adjust.
(completion_list_add_symbol, completion_list_add_msymbol)
(completion_list_objc_symbol, completion_list_add_fields)
(add_symtab_completions): Likewise.
(default_collect_symbol_completion_matches_break_on)
(collect_file_symbol_completion_matches): Remove sym_text_len
local and don't pass it down.
* symtab.h (completion_list_add_name): Remove
sym_text/sym_text_len parameters.
Pedro Alves [Wed, 8 Nov 2017 14:49:10 +0000 (14:49 +0000)]
lookup_name_info::make_ignore_params
A few places in the completion code look for a "(" to find a
function's parameter list, in order to strip it, because psymtabs (and
gdb index) don't include parameter info in the symbol names.
See compare_symbol_name and
default_collect_symbol_completion_matches_break_on.
This is too naive. Consider:
ns_overload2_test::([TAB]
We'd want to complete that to:
ns_overload2_test::(anonymous namespace)::struct_overload2_test
Or:
b (anonymous namespace)::[TAB]
That currently completes to:
b (anonymous namespace)
Which is obviously broken. This patch makes that work.
Also, the current compare_symbol_name hack means that while this
works:
"b function([TAB]" -> "b function()"
This does not:
"b function ([TAB]"
This patch fixes that. Whitespace "ignoring" now Just Works, i.e.,
assuming a symbol named "function(int, long)", this:
b function ( int , lon[TAB]
completes to:
b function ( int , long)
To address all of this, this patch builds on top of the rest of the
series, and pushes the responsibility of stripping parameters from a
lookup name to the new lookup_name_info object, where we can apply
per-language rules. Also note that we now only make a version of the
lookup name with parameters stripped out where it's actually required
to do that, in the psymtab and GDB index code.
For C++, the right way to strip parameters is with "cp_remove_params",
which uses a real parser (cp-name-parser.y) to split the name into a
component tree and then discards parameters.
The trouble for completion is that in that case we have an incomplete
name, like "foo::func(int" and thus cp_remove_params throws an error.
This patch sorts that by adding a cp_remove_params_if_any variant of
cp_remove_params that tries removing characters from the end of the
string until cp_remove_params works. So cp_remove_params_if_any
behaves like this:
With a complete name:
"foo::func(int)" => foo::func(int) # cp_remove_params_1 succeeds the first time.
With an incomplete name:
"foo::func(int" => NULL # cp_remove_params fails the first time.
"foo::func(in" => NULL # and again...
"foo::func(i" => NULL # and again...
"foo::func(" => NULL # and again...
"foo::func" => "foo::func" # success!
Note that even if this approach removes significant rightmost
characters, it's still OK, because this parameter stripping is only
necessary for psymtabs and gdb index, where we're determining whether
to expand a symbol table. Say cp_remove_params_if_any returned
"foo::" above for "foo::func(int". That'd cause us to expand more
symtabs than ideal (because we'd expand all symtabs with symbols that
start with "foo::", not just "foo::func"), but then when we actually
look for completion matches, we'd still use the original lookup name,
with parameter information ["foo::func(int"], and thus we'll return no
false positive to the user. Whether the stripping works as intended
and doesn't strip too much is thus covered by a unit test instead of a
testsuite test.
The "if_any" part of the name refers to the fact that while
cp_remove_params returns NULL if the input name has no parameters in
the first place, like:
"foo::func" => NULL # cp_remove_params
cp_remove_params_if_any still returns the function name:
"foo::func" => "foo::func" # cp_remove_params_if_any
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/lookup_name_info-selftests.c.
(SUBDIR_UNITTESTS_OBS): Add lookup_name_info-selftests.o.
* cp-support.c: Include "selftest.h".
(cp_remove_params_1): Rename from cp_remove_params. Add
'require_param' parameter, and handle it.
(cp_remove_params): Reimplement.
(cp_remove_params_if_any): New.
(selftests::quote): New.
(selftests::check_remove_params): New.
(selftests::test_cp_remove_params): New.
(_initialize_cp_support): Install
selftests::test_cp_remove_params.
* cp-support.h (cp_remove_params_if_any): Declare.
* dwarf2read.c :Include "selftest.h".
(dw2_expand_symtabs_matching_symbol): Use
lookup_name_info::make_ignore_params.
(selftests::dw2_expand_symtabs_matching::mock_mapped_index)
(selftests::dw2_expand_symtabs_matching::string_or_null)
(selftests::dw2_expand_symtabs_matching::check_match)
(selftests::dw2_expand_symtabs_matching::test_symbols)
(selftests::dw2_expand_symtabs_matching::run_test): New.
(_initialize_dwarf2_read): Register
selftests::dw2_expand_symtabs_matching::run_test.
* psymtab.c (psym_expand_symtabs_matching): Use
lookup_name_info::make_ignore_params.
* symtab.c (demangle_for_lookup_info::demangle_for_lookup_info):
If the lookup name wants to ignore parameters, strip them.
(compare_symbol_name): Remove sym_text/sym_text_len parameters and
code handling '('.
(completion_list_add_name): Don't pass down sym_text/sym_text_len.
(default_collect_symbol_completion_matches_break_on): Don't try to
strip parameters.
* symtab.h (lookup_name_info::lookup_name_info): Add
'ignore_parameters' parameter.
(lookup_name_info::ignore_parameters)
(lookup_name_info::make_ignore_params): New methods.
(lookup_name_info::m_ignore_parameters): New field.
* unittests/lookup_name_info-selftests.c: New file.
Pedro Alves [Wed, 8 Nov 2017 14:22:32 +0000 (14:22 +0000)]
Reorder/reindent dw2_expand_symtabs_matching & friends
The previous patch had added dw2_expand_symtabs_matching_symbol and
dw2_expand_marked_cus forward declarations and did not reindent
dw2_expand_marked_cus to avoid moving the code around while changing
it at the same time.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* dwarf2read.c (dw2_expand_marked_cus)
(dw2_expand_symtabs_matching_symbol): Remove forward declarations.
(dw2_expand_symtabs_matching): Move further below.
(dw2_expand_marked_cus): Reindent.
Pedro Alves [Wed, 8 Nov 2017 14:22:32 +0000 (14:22 +0000)]
Optimize .gdb_index symbol name searching
As mentioned in the previous patch, .gdb_index name lookup got
significantly slower with the previous patch.
This patch addresses that, and in the process makes .gdb_index name
searching faster than what we had before the previous patch, even.
Using the same test:
$ cat script.cmd
set pagination off
set $count = 0
while $count < 400
complete b string_prin
printf "count = %d\n", $count
set $count = $count + 1
end
$ time gdb --batch -q ./gdb-with-index -ex "source script.cmd"
I got, before the previous patch (-O2, x86-64):
real 0m1.773s
user 0m1.737s
sys 0m0.040s
and after this patch:
real 0m1.361s
user 0m1.315s
sys 0m0.040s
The basic idea here is simple: instead of always iterating over all
the symbol names in the index, we build an accelerator/sorted name
table and binary search names in it.
Later in the series, we'll want to support wild matching for C++ too,
so this mechanism already considers that. For example, say that
you're looking up functions/methods named "func", no matter the
containing namespace/class. If we sorted the table by qualified name,
then we obviously wouldn't be able to find those symbols with a binary
search:
func
ns1::a::b::func
ns1::b::func
ns2::func
(function symbol names in .gdb_index have no parameter info, like psymbols)
To address that out, we put an entry for each name component in the
sorted table. something like this:
Table Entry Actual symbol
---------------------------------
func func
func ns1::a::b::func
b::func ns1::a::b::func
a::b::func ns1::a::b::func
ns1::a::b::func ns1::a::b::func
func ns1::b::func
b::func ns1::b::func
ns1::b::func ns1::b::func
func ns2::func
ns2::func ns2::func
Which sorted results in this:
Table Entry Actual symbol
---------------------------------
a::b::func ns1::a::b::func
b::func ns1::a::b::func
b::func ns1::b::func
func func
func ns1::a::b::func
func ns1::b::func
func ns2::func
ns1::a::b::func ns1::a::b::func
ns1::b::func ns1::b::func
ns2::func ns2::func
And we can binary search this.
Note that a binary search approach works for both completion and
regular lookup, while a name hashing approach only works for normal
symbol looking, since obviously "fun" and "func" have different
hashes.
At first I was a bit wary of these tables potentially growing GDB's
memory significantly. But I did an experiment that convinced it's not
a worry at all. I hacked gdb to count the total number of entries in
all the tables, attached that gdb to my system/Fedora's Firefox
(Fedora's debug packages uses .gdb_index), did "set max-completions
unlimited", and then hit "b [TAB]" to cause everything to expand.
That resulted in
1351355 name_components. Each entry takes 8 bytes,
so that's
10810840 bytes (ignoring std::vector overhead), or ~10.3 MB.
That's IMO too small to worry about, given GDB was using over 7400MB
total at that point. I.e., we're talking about 0.1% increase.
dw2_expand_symtabs_matching unit tests covering this will be added in
a follow up patch.
If the size of this table turns out to be a concern, I have an idea to
reduce the size of the table further at the expense of a bit more code
-- the vast majority of the name offsets are either 0 or fit in
8-bits:
total name_component =
1351355, of which,
name_component::name_offset instances need 0 bits = 679531
name_component::name_offset instances need 8 bits = 669526
name_component::name_offset instances need 16 bits = 2298
name_component::name_offset instances need 32 bits = 0
name_component::idx instances need 0 bits = 51
name_component::idx instances need 8 bits = 8361
name_component::idx instances need 16 bits = 280329
name_component::idx instances need 32 bits =
1062614
so we could have separate tables for 0 name_offset, 8-bit name_offset
and 32-bit name_offset. That'd give us roughly:
679531 * 0 + 669526 * 1 + 2298 * 4 +
1062614 * 4 =
4929174, or ~4.7MB
with only 8-bit and 32-bit tables, that'd be:
1349057 * 1 + 2298 * 4 + 4 *
1351355 =
6763669 bytes, or ~6.5MB.
I don't think we need to bother though.
I also timed:
$ time gdb --batch -q -p `pidof firefox`
$ time gdb --batch -q -p `pidof firefox` -ex "b main"
$ time gdb --batch -q -p `pidof firefox` -ex "set max-completion unlimited" -ex "complete b "
and compared before previous patch vs this patch, and I didn't see a
significant difference, seemingly because time to read debug info
dominates. The "complete b " variant of the test takes ~2min
currently... (I have a follow up series that speeds that up
somewhat.)
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* dwarf2read.c (byte_swap, MAYBE_SWAP): Move higher up in file.
(struct name_component): New.
(mapped_index::name_components): New field.
(mapped_index::symbol_name_at): New method.
(dwarf2_read_index): Call mapped_index ctor.
(dw2_map_matching_symbols): Add comment about name_components
table.
(dw2_expand_symtabs_matching): Factor part to...
(dw2_expand_symtabs_matching_symbol): ... this new function.
Build name components table, and lookup symbols in it before
calling the name matcher.
(dw2_expand_marked_cus): New, factored out from
dw2_expand_symtabs_matching.
(dwarf2_per_objfile_free): Call the mapped_index's dtor.
Pedro Alves [Wed, 8 Nov 2017 14:22:32 +0000 (14:22 +0000)]
Introduce lookup_name_info and generalize Ada's FULL/WILD name matching
Summary:
- This is preparation for supporting wild name matching on C++ too.
- This is also preparation for TAB-completion fixes.
- Makes symbol name matching (think strcmp_iw) be based on a per-language method.
- Merges completion and non-completion name comparison (think
language_ops::la_get_symbol_name_cmp generalized).
- Avoid re-hashing lookup name multiple times
- Centralizes preparing a name for lookup (Ada name encoding / C++ Demangling),
both completion and non-completion.
- Fixes Ada latent bug with verbatim name matches in expressions
- Makes ada-lang.c use common|symtab.c completion code a bit more.
Ada's wild matching basically means that
"(gdb) break foo"
will find all methods named "foo" in all packages. Translating to
C++, it's roughly the same as saying that "break klass::method" sets
breakpoints on all "klass::method" methods of all classes, no matter
the namespace. A following patch will teach GDB about fullname vs
wild matching for C++ too. This patch is preparatory work to get
there.
Another idea here is to do symbol name matching based on the symbol
language's algorithm. I.e., avoid dependency on current language set.
This allows for example doing
(gdb) b foo::bar< int > (<tab>
and having gdb name match the C++ symbols correctly even if the
current language is C or Assembly (or Rust, or Ada, or ...), which can
easily happen if you step into an Assembly/C runtime library frame.
By encapsulating all the information related to a lookup name in a
class, we can also cache hash computation for a given language in the
lookup name object, to avoid recomputing it over and over.
Similarly, because we don't really know upfront which languages the
lookup name will be matched against, for each language we store the
lookup name transformed into a search name. E.g., for C++, that means
demangling the name. But for Ada, it means encoding the name. This
actually forces us to centralize all the different lookup name
encoding in a central place, resulting in clearer code, IMO. See
e.g., the new ada_lookup_name_info class.
The lookup name -> symbol search name computation is also done only
once per language.
The old language->la_get_symbol_name_cmp / symbol_name_cmp_ftype are
generalized to work with both completion, and normal symbol look up.
At some point early on, I had separate completion vs non-completion
language vector entry points, but a single method ends up being better
IMO for simplifying things -- the more we merge the completion /
non-completion name lookup code paths, the less changes for bugs
causing completion vs normal lookup finding different symbols.
The ada-lex.l change is necessary because when doing
(gdb) p <UpperCase>
then the name that is passed to write_ write_var_or_type ->
ada_lookup_symbol_list misses the "<>", i.e., it's just "UpperCase",
and we end up doing a wild match against "UpperCase" lowercased by
ada_lookup_name_info's constructor. I.e., "uppercase" wouldn't ever
match "UpperCase", and the symbol lookup fails.
This wouldn't cause any regression in the testsuite, but I added a new
test that would pass before the patch and fail after, if it weren't
for that fix.
This is latent bug that happens to go unnoticed because that
particular path was inconsistent with the rest of Ada symbol lookup by
not lowercasing the lookup name.
Ada's symbol_completion_add is deleted, replaced by using common
code's completion_list_add_name. To make the latter work for Ada, we
needed to add a new output parameter, because Ada wants to return back
a custom completion candidates that are not the symbol name.
With this patch, minimal symbol demangled name hashing is made
consistent with regular symbol hashing. I.e., it now goes via the
language vector's search_name_hash method too, as I had suggested in a
previous patch.
dw2_expand_symtabs_matching / .gdb_index symbol names were a
challenge. The problem is that we have no way to telling what is the
language of each symbol name found in the index, until we expand the
corresponding full symbol, which is off course what we're trying to
avoid. Language information is simply not considered in the index
format... Since the symbol name hashing and comparison routines are
per-language, we now have a problem. The patch sorts this out by
matching each name against all languages. This is inneficient, and
indeed slows down completion several times. E.g., with:
$ cat script.cmd
set pagination off
set $count = 0
while $count < 400
complete b string_prin
printf "count = %d\n", $count
set $count = $count + 1
end
$ time gdb --batch -q ./gdb-with-index -ex "source script-string_printf.cmd"
I get, before patch (-O2, x86-64):
real 0m1.773s
user 0m1.737s
sys 0m0.040s
While after patch (-O2, x86-64):
real 0m9.843s
user 0m9.482s
sys 0m0.034s
However, the following patch will optimize this, and will actually
make this use case faster compared to the "before patch" above:
real 0m1.321s
user 0m1.285s
sys 0m0.039s
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_encode): Rename to ..
(ada_encode_1): ... this. Add throw_errors parameter and handle
it.
(ada_encode): Reimplement.
(match_name): Delete, folded into full_name.
(resolve_subexp): No longer pass the encoded name to
ada_lookup_symbol_list.
(should_use_wild_match): Delete.
(name_match_type_from_name): New.
(ada_lookup_simple_minsym): Use lookup_name_info and the
language's symbol_name_matcher_ftype.
(add_symbols_from_enclosing_procs, ada_add_local_symbols)
(ada_add_block_renamings): Adjust to use lookup_name_info.
(ada_lookup_name): New.
(add_nonlocal_symbols, ada_add_all_symbols)
(ada_lookup_symbol_list_worker, ada_lookup_symbol_list)
(ada_iterate_over_symbols): Adjust to use lookup_name_info.
(ada_name_for_lookup): Delete.
(ada_lookup_encoded_symbol): Construct a verbatim name.
(wild_match): Reverse sense of return type. Use bool.
(full_match): Reverse sense of return type. Inline bits of old
match_name here.
(ada_add_block_symbols): Adjust to use lookup_name_info.
(symbol_completion_match): Delete, folded into...
(ada_lookup_name_info::matches): ... .this new method.
(symbol_completion_add): Delete.
(ada_collect_symbol_completion_matches): Add name_match_type
parameter. Adjust to use lookup_name_info and
completion_list_add_name.
(get_var_value, ada_add_global_exceptions): Adjust to use
lookup_name_info.
(ada_get_symbol_name_cmp): Delete.
(do_wild_match, do_full_match): New functions.
(ada_lookup_name_info::ada_lookup_name_info): New method.
(ada_symbol_name_matches, ada_get_symbol_name_matcher): New
functions.
(ada_language_defn): Install ada_get_symbol_name_matcher.
* ada-lex.l (processId): If name starts with '<', copy it
verbatim.
* block.c (block_iter_match_step, block_iter_match_first)
(block_iter_match_next, block_lookup_symbol)
(block_lookup_symbol_primary, block_find_symbol): Adjust to use
lookup_name_info.
* block.h (block_iter_match_first, block_iter_match_next)
(ALL_BLOCK_SYMBOLS_WITH_NAME): Adjust to use lookup_name_info.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Adjust comments to
refer to la_get_symbol_name_matcher.
* completer.c (complete_files_symbols)
(collect_explicit_location_matches, symbol_completer): Pass a
symbol_name_match_type down.
* completer.h (class completion_match, completion_match_result):
New classes.
(completion_tracker::reset_completion_match_result): New method.
(completion_tracker::m_completion_match_result): New field.
* cp-support.c (make_symbol_overload_list_block): Adjust to use
lookup_name_info.
(cp_fq_symbol_name_matches, cp_get_symbol_name_matcher): New
functions.
* cp-support.h (cp_get_symbol_name_matcher): New declaration.
* d-lang.c: Adjust comments to refer to
la_get_symbol_name_matcher.
* dictionary.c (dict_vector) <iter_match_first, iter_match_next>:
Adjust to use lookup_name_info.
(dict_iter_match_first, dict_iter_match_next)
(iter_match_first_hashed, iter_match_next_hashed)
(iter_match_first_linear, iter_match_next_linear): Adjust to work
with a lookup_name_info.
* dictionary.h (dict_iter_match_first, dict_iter_match_next):
Likewise.
* dwarf2read.c (dw2_lookup_symbol): Adjust to use lookup_name_info.
(dw2_map_matching_symbols): Adjust to use symbol_name_match_type.
(gdb_index_symbol_name_matcher): New class.
(dw2_expand_symtabs_matching) Adjust to use lookup_name_info and
gdb_index_symbol_name_matcher. Accept a NULL symbol_matcher.
* f-lang.c (f_collect_symbol_completion_matches): Adjust to work
with a symbol_name_match_type.
(f_language_defn): Adjust comments to refer to
la_get_symbol_name_matcher.
* go-lang.c (go_language_defn): Adjust comments to refer to
la_get_symbol_name_matcher.
* language.c (default_symbol_name_matcher)
(language_get_symbol_name_matcher): New functions.
(unknown_language_defn, auto_language_defn): Adjust comments to
refer to la_get_symbol_name_matcher.
* language.h (symbol_name_cmp_ftype): Delete.
(language_defn) <la_collect_symbol_completion_matches>: Add match
type parameter.
<la_get_symbol_name_cmp>: Delete field.
<la_get_symbol_name_matcher>: New field.
<la_iterate_over_symbols>: Adjust to use lookup_name_info.
(default_symbol_name_matcher, language_get_symbol_name_matcher):
Declare.
* linespec.c (iterate_over_all_matching_symtabs)
(iterate_over_file_blocks): Adjust to use lookup_name_info.
(find_methods): Add language parameter, and use lookup_name_info
and the language's symbol_name_matcher_ftype.
(linespec_complete_function): Adjust.
(lookup_prefix_sym): Use lookup_name_info.
(add_all_symbol_names_from_pspace): Adjust.
(find_superclass_methods): Add language parameter and pass it
down.
(find_method): Pass symbol language down.
(find_linespec_symbols): Don't demangle or Ada encode here.
(search_minsyms_for_name): Add lookup_name_info parameter.
(add_matching_symbols_to_info): Add name_match_type parameter.
Use lookup_name_info.
* m2-lang.c (m2_language_defn): Adjust comments to refer to
la_get_symbol_name_matcher.
* minsyms.c: Include <algorithm>.
(add_minsym_to_demangled_hash_table): Remove table parameter and
add objfile parameter. Use search_name_hash, and add language to
demangled languages vector.
(struct found_minimal_symbols): New struct.
(lookup_minimal_symbol_mangled, lookup_minimal_symbol_demangled):
New functions.
(lookup_minimal_symbol): Adjust to use them. Don't canonicalize
input names here. Use lookup_name_info instead. Lookup up
demangled names once for each language in the demangled names
vector.
(iterate_over_minimal_symbols): Use lookup_name_info. Lookup up
demangled names once for each language in the demangled names
vector.
(build_minimal_symbol_hash_tables): Adjust.
* minsyms.h (iterate_over_minimal_symbols): Adjust to pass down a
lookup_name_info.
* objc-lang.c (objc_language_defn): Adjust comment to refer to
la_get_symbol_name_matcher.
* objfiles.h: Include <vector>.
(objfile_per_bfd_storage) <demangled_hash_languages>: New field.
* opencl-lang.c (opencl_language_defn): Adjust comment to refer to
la_get_symbol_name_matcher.
* p-lang.c (pascal_language_defn): Adjust comment to refer to
la_get_symbol_name_matcher.
* psymtab.c (psym_lookup_symbol): Use lookup_name_info.
(match_partial_symbol): Use symbol_name_match_type,
lookup_name_info and psymbol_name_matches.
(lookup_partial_symbol): Use lookup_name_info.
(map_block): Use symbol_name_match_type and lookup_name_info.
(psym_map_matching_symbols): Use symbol_name_match_type.
(psymbol_name_matches): New.
(recursively_search_psymtabs): Use lookup_name_info and
psymbol_name_matches. Rename 'kind' parameter to 'domain'.
(psym_expand_symtabs_matching): Use lookup_name_info. Rename
'kind' parameter to 'domain'.
* rust-lang.c (rust_language_defn): Adjust comment to refer to
la_get_symbol_name_matcher.
* symfile-debug.c (debug_qf_map_matching_symbols)
(debug_qf_map_matching_symbols): Use symbol_name_match_type.
(debug_qf_expand_symtabs_matching): Use lookup_name_info.
* symfile.c (expand_symtabs_matching): Use lookup_name_info.
* symfile.h (quick_symbol_functions) <map_matching_symbols>:
Adjust to use symbol_name_match_type.
<expand_symtabs_matching>: Adjust to use lookup_name_info.
(expand_symtabs_matching): Adjust to use lookup_name_info.
* symmisc.c (maintenance_expand_symtabs): Use
lookup_name_info::match_any ().
* symtab.c (symbol_matches_search_name): New.
(eq_symbol_entry): Adjust to use lookup_name_info and the
language's matcher.
(demangle_for_lookup_info::demangle_for_lookup_info): New.
(lookup_name_info::match_any): New.
(iterate_over_symbols, search_symbols): Use lookup_name_info.
(compare_symbol_name): Add language, lookup_name_info and
completion_match_result parameters, and use them.
(completion_list_add_name): Make extern. Add language and
lookup_name_info parameters. Use them.
(completion_list_add_symbol, completion_list_add_msymbol)
(completion_list_objc_symbol): Add lookup_name_info parameters and
adjust. Pass down language.
(completion_list_add_fields): Add lookup_name_info parameters and
adjust. Pass down language.
(add_symtab_completions): Add lookup_name_info parameters and
adjust.
(default_collect_symbol_completion_matches_break_on): Add
name_match_type parameter, and use it. Use lookup_name_info.
(default_collect_symbol_completion_matches)
(collect_symbol_completion_matches): Add name_match_type
parameter, and pass it down.
(collect_symbol_completion_matches_type): Adjust.
(collect_file_symbol_completion_matches): Add name_match_type
parameter, and use lookup_name_info.
* symtab.h: Include <string> and "common/gdb_optional.h".
(enum class symbol_name_match_type): New.
(class ada_lookup_name_info): New.
(struct demangle_for_lookup_info): New.
(class lookup_name_info): New.
(symbol_name_matcher_ftype): New.
(SYMBOL_MATCHES_SEARCH_NAME): Use symbol_matches_search_name.
(symbol_matches_search_name): Declare.
(MSYMBOL_MATCHES_SEARCH_NAME): Delete.
(default_collect_symbol_completion_matches)
(collect_symbol_completion_matches)
(collect_file_symbol_completion_matches): Add name_match_type
parameter.
(iterate_over_symbols): Use lookup_name_info.
(completion_list_add_name): Declare.
* utils.c (enum class strncmp_iw_mode): Moved to utils.h.
(strncmp_iw_with_mode): Now extern.
* utils.h (enum class strncmp_iw_mode): Moved from utils.c.
(strncmp_iw_with_mode): Declare.
gdb/testsuite/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* gdb.ada/complete.exp (p <Exported_Capitalized>): New test.
(p Exported_Capitalized): New test.
(p exported_capitalized): New test.
Pedro Alves [Wed, 8 Nov 2017 15:07:56 +0000 (15:07 +0000)]
Per-language symbol name hashing algorithm
Currently, we have a mess of symbol name hashing/comparison routines.
There's msymbol_hash for mangled names, and dict_hash and
msymbol_hash_iw for demangled names. Then there's strcmp_iw,
strcmp_iw_ordered and Ada's full_match/wild_match, which all have to
agree with the hashing routines. That's why dict_hash is really about
Ada names. From the inconsistency department, minimal symbol hashing
doesn't go via dict_hash, so Ada's wild matching can't ever work with
minimal symbols.
This patch starts fixing this, by doing two things:
#1 - adds a language vector method to let each language decide how to
compute a symbol name hash.
#2 - makes dictionaries know the language of the symbols they hold,
and then use the dictionaries language to decide which hashing
method to use.
For now, this is just scaffolding, since all languages install the
default method. The series will make C++ install its own hashing
method later on, and will add per-language symbol name comparison
routines too.
This patch was originally based on a patch that Keith wrote for the
libcc1/C++ WIP support.
gdb/ChangeLog:
2017-11-08 Keith Seitz <keiths@redhat.com>
Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_language_defn): Install
default_search_name_hash.
* buildsym.c (struct buildsym_compunit): <language>: New field.
(finish_block_internal): Pass language when creating dictionaries.
(start_buildsym_compunit, start_symtab): New language parameters.
Use them.
(restart_symtab): Pass down compilation unit's language.
* buildsym.h (enum language): Forward declare.
(start_symtab): New 'language' parameter.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Install
default_search_name_hash.
* coffread.c (coff_start_symtab): Adjust.
* d-lang.c (d_language_defn): Install default_search_name_hash.
* dbxread.c (struct symloc): Add 'pst_language' field.
(PST_LANGUAGE): Define.
(start_psymtab, read_ofile_symtab): Use it.
(process_one_symbol): New 'language' parameter. Pass it down.
* dictionary.c (struct dictionary) <language>: New field.
(DICT_LANGUAGE): Define.
(dict_create_hashed, dict_create_hashed_expandable)
(dict_create_linear, dict_create_linear_expandable): New parameter
'language'. Set the dictionary's language.
(iter_match_first_hashed): Adjust to rename.
(insert_symbol_hashed): Assert we don't see mismatching
languages. Adjust to rename.
(dict_hash): Rename to ...
(default_search_name_hash): ... this and make extern.
* dictionary.h (struct language_defn): Forward declare.
(dict_create_hashed): New parameter 'language'.
* dwarf2read.c (dwarf2_start_symtab): Pass down language.
* f-lang.c (f_language_defn): Install default_search_name_hash.
* go-lang.c (go_language_defn): Install default_search_name_hash.
* jit.c (finalize_symtab): Pass compunit's language to dictionary
creation.
* language.c (unknown_language_defn, auto_language_defn):
* language.h (language_defn::la_search_name_hash): New field.
(default_search_name_hash): Declare.
* m2-lang.c (m2_language_defn): Install default_search_name_hash.
* mdebugread.c (new_block): New parameter 'language'.
* mdebugread.c (parse_symbol): Pass symbol language to block
allocation.
(psymtab_to_symtab_1): Pass down language.
(new_symtab): Pass compunit's language to block allocation.
* objc-lang.c (objc_language_defn): Install
default_search_name_hash.
* opencl-lang.c (opencl_language_defn):
* p-lang.c (pascal_language_defn): Install
default_search_name_hash.
* rust-lang.c (rust_language_defn): Install
default_search_name_hash.
* stabsread.h (enum language): Forward declare.
(process_one_symbol): Add 'language' parameter.
* symtab.c (search_name_hash): New function.
* symtab.h (search_name_hash): Declare.
* xcoffread.c (read_xcoff_symtab): Pass language to start_symtab.
Pedro Alves [Wed, 8 Nov 2017 15:20:41 +0000 (15:20 +0000)]
Fix "make test-cp-name-parser"
src/gdb/cp-name-parser.y: In function ‘int main(int, char**)’:
src/gdb/cp-name-parser.y:2132:30: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings]
char *str2, *extra_chars = "", c;
^
Simply don't initialize the variable, it's not necessary.
gdb/ChangeLog:
2017-11-08 Pedro Alves <palves@redhat.com>
* cp-name-parser.y (main): Don't initialize extra_chars.
Nick Clifton [Wed, 8 Nov 2017 14:34:32 +0000 (14:34 +0000)]
Fix typo in changelog
Nick Clifton [Wed, 8 Nov 2017 14:30:53 +0000 (14:30 +0000)]
Split the AArch64 Crypto instructions for AES and SHA1+2 into their own options (+aes and +sha2).
The new options are:
+aes: Enables the AES instructions of Armv8-a,
enabled by default with +crypto.
+sha2: Enables the SHA1 and SHA2 instructions of Armv8-a,
enabled by default with +crypto.
These options have been turned on by default when +crypto
is used, as such no breakage is expected.
The reason for the split is because with the introduction of Armv8.4-a
the implementation of AES has explicitly been made independent of the
implementation of the other crypto extensions. Backporting the split does
not break any of the previous requirements and so is safe to do.
gas * config/tc-aarch64.c
(aarch64_features): Include AES and SHA2 in CRYPTO.
Add SHA2 and AES.
include * opcode/aarch64.h:
(AARCH64_FEATURE_SHA2, AARCH64_FEATURE_AES): New.
opcodes * aarch64-tbl.h (aarch64_feature_crypto): Add AES and SHA2.
(aarch64_feature_sha2, aarch64_feature_aes): New.
(SHA2, AES): New.
(AES_INSN, SHA2_INSN): New.
(pmull, pmull2, aese, aesd, aesmc, aesimc): Change to AES_INS.
(sha1h, sha1su1, sha256su0, sha1c, sha1p,
sha1m, sha1su0, sha256h, sha256h2, sha256su1):
Change to SHA2_INS.
Jiong Wang [Wed, 8 Nov 2017 13:15:12 +0000 (13:15 +0000)]
Adds command line support for Armv8.4-A, via the new command line option -march=armv8.4-a. Add support for "+dotprod" ARM feature (required for ARMv8.4-A). Add assembler and disassembler support for new FP16 instructions introduced in Armv8.4-A
gas * config/tc-arm.c (arm_extensions):
(arm_archs): New entry for "armv8.4-a".
Add FPU_ARCH_DOTPROD_NEON_VFP_ARMV8.
(arm_ext_v8_2): New variable.
(enum arm_reg_type): New enumeration REG_TYPE_NSD.
(reg_expected_msgs): New entry for REG_TYPE_NSD.
(parse_typed_reg_or_scalar): Handle REG_TYPE_NSD.
(parse_scalar): Support REG_TYPE_VFS.
(enum operand_parse_code): New enumerations OP_RNSD and OP_RNSD_RNSC.
(parse_operands): Handle OP_RNSD and OP_RNSD_RNSC.
(NEON_SHAPE_DEF): New entries for DHH and DHS.
(neon_scalar_for_fmac_fp16_long): New function to generate Rm encoding
for new FP16 instructions in ARMv8.2-A.
(do_neon_fmac_maybe_scalar_long): New function to encode new FP16
instructions in ARMv8.2-A.
(do_neon_vfmal): Wrapper function for vfmal.
(do_neon_vfmsl): Wrapper function for vfmsl.
(insns): New entries for vfmal and vfmsl.
* doc/c-arm.texi (-march): Document "armv8.4-a".
* testsuite/gas/arm/dotprod-mandatory.d: New test.
* testsuite/gas/arm/armv8_2-a-fp16.s: New test source.
* testsuite/gas/arm/armv8_2-a-fp16-illegal.s: New test source.
* testsuite/gas/arm/armv8_2-a-fp16.d: New test.
* testsuite/gas/arm/armv8_3-a-fp16.d: New test.
* testsuite/gas/arm/armv8_4-a-fp16.d: New test.
* testsuite/gas/arm/armv8_2-a-fp16-thumb2.d: New test.
* testsuite/gas/arm/armv8_2-a-fp16-illegal.d: New test.
* testsuite/gas/arm/armv8_2-a-fp16-illegal.l: New error file.
opcodes * arm-dis.c (coprocessor_opcodes): New entries for ARMv8.2-A new
FP16 instructions, including vfmal.f16 and vfmsl.f16.
include * opcode/arm.h (ARM_AEXT2_V8_4A): Include Dot Product feature.
(ARM_EXT2_V8_4A): New macro.
(ARM_AEXT2_V8_4A): Likewise.
(ARM_ARCH_V8_4A): Likewise.
Alan Modra [Tue, 7 Nov 2017 06:33:41 +0000 (17:03 +1030)]
xtensa message pluralization
* config/tc-xtensa.c (finish_vinsn): Properly pluralize error message.
GDB Administrator [Wed, 8 Nov 2017 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 15 Oct 2017 14:36:51 +0000 (08:36 -0600)]
Constify execute_command
This constifies execute_command and fixes up the callers.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* event-top.h (command_handler): Constify.
* record-full.c (cmd_record_full_start): Update.
* thread.c (thread_apply_all_command): Update.
* printcmd.c (eval_command): Update.
* mi/mi-main.c (mi_execute_cli_command): Update.
(mi_execute_async_cli_command): Update.
* tui/tui-stack.c (tui_update_command): Update.
* cli/cli-interp.c (safe_execute_command): Constify.
* record.c (record_start): Update.
(record_start, record_stop, cmd_record_start): Update.
* record-btrace.c (cmd_record_btrace_bts_start): Update.
(cmd_record_btrace_pt_start): Update.
(cmd_record_btrace_start): Update.
(cmd_record_btrace_start): Update.
* reverse.c (exec_reverse_once): Update.
* python/python.c (execute_gdb_command): Don't copy the command.
* event-top.c (command_line_handler): Update.
(command_handler): Constify.
* defs.h (deprecated_call_command_hook): Constify.
* cli/cli-script.h (execute_user_command): Constify.
* cli/cli-script.c (execute_user_command): Constify.
(execute_cmd_pre_hook, execute_cmd_post_hook): Constify.
(enum command_control_type): Update.
* main.c (catch_command_errors): Remove non-const overload.
(catch_command_errors_ftype): Remove.
* python/py-cmd.c (cmdpy_function): Constify.
* guile/scm-cmd.c (cmdscm_function): Constify.
* cli/cli-dump.c (call_dump_func): Constify.
* cli/cli-decode.c (do_const_cfunc): Constify.
(do_sfunc): Constify.
(cmd_func): Constify.
* gdbcmd.h (execute_command, execute_command_to_string): Constify.
* top.h (execute_command): Constify.
* top.c (execute_command): Constify.
(execute_command_to_string): Constify.
(deprecated_call_command_hook): Constify.
* command.h (cmd_func): Constify.
* cli/cli-decode.h (struct cmd_list_element) <func>: Constify.
Tom Tromey [Sat, 14 Oct 2017 15:07:00 +0000 (09:07 -0600)]
Constify add_setshow_*
This constifies the add_setshow_* family of functions, and then fixes
up the fallout. The bulk of this patch was written by script.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* ada-lang.c (catch_ada_exception_command): Constify.
(catch_assert_command): Constify.
* break-catch-throw.c (catch_catch_command, catch_throw_command)
(catch_rethrow_command): Constify.
(catch_exception_command_1): Constify.
* breakpoint.h (add_catch_command): Constify.
* break-catch-syscall.c (catch_syscall_command_1): Constify.
(catch_syscall_split_args): Constify.
* break-catch-sig.c (catch_signal_command): Constify.
(catch_signal_split_args): Constify.
* cli/cli-decode.h (struct cmd_list_element) <function>: Use
cmd_const_sfunc_ftype.
* cli/cli-decode.c (add_setshow_cmd_full): Constify.
(add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
(add_setshow_boolean_cmd, add_setshow_filename_cmd)
(add_setshow_string_cmd, struct cmd_list_element)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd):
Constify.
(set_cmd_sfunc): Constify.
(empty_sfunc): Constify.
* command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd)
(add_setshow_boolean_cmd, add_setshow_filename_cmd)
(add_setshow_string_cmd, add_setshow_string_noescape_cmd)
(add_setshow_optional_filename_cmd, add_setshow_integer_cmd)
(add_setshow_uinteger_cmd, add_setshow_zinteger_cmd)
(add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd):
Constify.
(set_cmd_sfunc): Constify.
(cmd_sfunc_ftype): Remove.
* compile/compile.c (set_compile_args): Constify.
* infrun.c (set_disable_randomization): Constify.
* infcmd.c (set_args_command, set_cwd_command): Constify.
* breakpoint.c (set_condition_evaluation_mode): Constify.
(add_catch_command): Constify.
(catch_fork_command_1, catch_exec_command_1)
(catch_load_command_1, catch_unload_command_1): Constify.
(catch_load_or_unload): Constify.
* guile/scm-param.c (pascm_set_func): Constify.
(add_setshow_generic): Constify.
* python/py-param.c (get_set_value): Constify.
* top.h (set_verbose): Constify.
* tui/tui-win.c (tui_set_var_cmd): Constify.
* mi/mi-main.c (set_mi_async_command): Constify.
* cli/cli-logging.c (set_logging_overwrite)
(set_logging_redirect): Constify.
* value.c (set_max_value_size): Constify.
* valprint.c (set_input_radix, set_output_radix): Constify.
* utils.c (set_width_command, set_height_command): Constify.
* typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify.
* tracepoint.c (set_disconnected_tracing)
(set_circular_trace_buffer, set_trace_buffer_size)
(set_trace_user, set_trace_notes, set_trace_stop_notes): Constify.
* top.c (set_history_size_command, set_verbose, set_editing)
(set_gdb_datadir, set_history_filename): Constify.
* target.c (set_targetdebug, maint_set_target_async_command)
(maint_set_target_non_stop_command, set_target_permissions)
(set_write_memory_permission): Constify.
(open_target): Constify.
* target-descriptions.c (set_tdesc_filename_cmd): Constify.
* target-dcache.c (set_stack_cache, set_code_cache): Constify.
* symtab.c (set_symbol_cache_size_handler): Constify.
* symfile.c (set_ext_lang_command): Constify.
* symfile-debug.c (set_debug_symfile): Constify.
* source.c (set_directories_command): Constify.
* solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify.
* serial.c (set_parity): Constify.
* rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify.
* remote.c (set_remote_exec_file, set_remotebreak)
(set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify.
* record.c (set_record_insn_history_size)
(set_record_call_history_size): Constify.
* record-full.c (set_record_full_insn_max_num): Constify.
* proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify.
* osabi.c (set_osabi): Constify.
* mips-tdep.c (set_mips64_transfers_32bit_regs)
(reinit_frame_cache_sfunc, mips_abi_update): Constify.
* maint.c (maintenance_set_profile_cmd): Constify.
* linux-thread-db.c (set_libthread_db_search_path): Constify.
* language.c (set_language_command, set_range_command)
(set_case_command): Constify.
* infrun.c (set_non_stop, set_observer_mode)
(set_stop_on_solib_events, set_schedlock_func)
(set_exec_direction_func): Constify.
* infcmd.c (set_inferior_tty_command): Constify.
* disasm.c (set_disassembler_options_sfunc): Constify.
* demangle.c (set_demangling_command): Constify.
* dcache.c (set_dcache_size, set_dcache_line_size): Constify.
* cris-tdep.c (set_cris_version, set_cris_mode)
(set_cris_dwarf2_cfi): Constify.
* corefile.c (set_gnutarget_command): Constify.
* charset.c (set_host_charset_sfunc, set_target_charset_sfunc)
(set_target_wide_charset_sfunc): Constify.
* breakpoint.c (update_dprintf_commands): Constify.
* auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify.
* arm-tdep.c (set_fp_model_sfunc, arm_set_abi)
(set_disassembly_style_sfunc): Constify.
* arch-utils.c (set_endian, set_architecture): Constify.
* alpha-tdep.c (reinit_frame_cache_sfunc): Constify.
* agent.c (set_can_use_agent): Constify.
Tom Tromey [Sat, 14 Oct 2017 04:58:21 +0000 (22:58 -0600)]
Remove cmd_cfunc_ftype
This removes cmd_cfunc_ftype and the non-const overload of add_cmd;
then fixes up the fallout.
For the most part this patch is straightforward. There are a few
files (go32-nat.c, windows-nat.c, and gnu-nat.c) that I could not
compile; so I made a best effort there.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* go32-nat.c (go32_sysinfo, go32_sldt, go32_sgdt, go32_sidt)
(go32_pde, go32_pte, go32_pte_for_address): Constify.
* gnu-nat.c (_parse_bool_arg, show_thread_default_pause_cmd)
(set_thread_default_pause_cmd, set_thread_default_run_cmd)
(show_thread_default_run_cmd, set_thread_default_detach_sc_cmd)
(parse_int_arg, show_thread_default_detach_sc_cmd)
(set_signals_cmd, show_signals_cmd, set_sig_thread_cmd)
(show_sig_thread_cmd, set_stopped_cmd, show_stopped_cmd)
(set_exceptions_cmd, show_exceptions_cmd, set_task_pause_cmd)
(show_task_pause_cmd, set_task_detach_sc_cmd)
(show_task_detach_sc_cmd, set_task_exc_port_cmd)
(set_noninvasive_cmd, set_thread_pause_cmd)
(show_thread_pause_cmd, set_thread_run_cmd, show_thread_run_cmd)
(set_thread_detach_sc_cmd, show_thread_detach_sc_cmd)
(set_thread_exc_port_cmd, thread_takeover_sc_cmd): Constify.
* windows-nat.c (display_selectors): Constify.
* cli/cli-decode.h (struct cmd_list_element) <function>: Remove
non-const "cfunc".
* cli/cli-decode.c (set_cmd_cfunc): Remove non-const overload.
(cmd_cfunc_eq): Likewise.
(struct cmd_list_element): Likewise.
(do_cfunc): Remove.
(cli_user_command_p): Update.
* command.h (add_cmd): Remove non-const overload.
(cmd_cfunc_ftype): Remove typedef.
(cmd_cfunc_eq): Remove non-const overload.
* value.c (show_values): Constify.
* thread.c (thread_apply_all_command): Constify.
* symfile.c (load_command): Constify.
* source.c (directory_command): Constify.
* maint.c (maintenance_internal_error)
(maintenance_demangler_warning, maintenance_space_display)
(maintenance_print_architecture, maintenance_translate_address)
(maintenance_info_selftests, maintenance_internal_warning):
Constify.
* breakpoint.c (disable_trace_command, enable_trace_command):
Constify.
* auto-load.c (info_auto_load_local_gdbinit, add_auto_load_dir):
Constify.
(add_auto_load_safe_path): Constify.
* guile/scm-auto-load.c (info_auto_load_guile_scripts): Constify.
* top.h (show_commands): Constify.
* linux-thread-db.c (info_auto_load_libthread_db): Constify.
* sparc64-tdep.c (adi_examine_command): Constify.
(adi_assign_command): Constify.
Tom Tromey [Sat, 14 Oct 2017 04:07:26 +0000 (22:07 -0600)]
Constify add_info
This patch constifies add_info and updates all the info commands. The
bulk of this patch was written using a script; and then I did a manual
pass to fix up the remaining compilation errors.
I could not compile every changed file; in particular nto-procfs.c,
gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the
correctness by inspection.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* frame.h (info_locals_command, info_args_command): Constify.
* auto-load.h (auto_load_info_scripts): Constify.
* inferior.h (registers_info): Constify.
* copying.c: Rebuild.
* copying.awk: Constify generated commands.
* auto-load.c (auto_load_info_scripts)
(info_auto_load_gdb_scripts): Constify.
* cli/cli-decode.c (struct cmd_list_element): Take a
cmd_const_cfunc_ftype.
* command.h (add_info): Take a cmd_const_cfunc_ftype.
* tui/tui-win.c (tui_all_windows_info): Constify.
* python/py-auto-load.c (info_auto_load_python_scripts):
Constify.
* cli/cli-cmds.c (show_command): Remove non-const overload.
* tracepoint.c (info_tvariables_command, info_scope_command):
Constify.
(info_static_tracepoint_markers_command): Constify.
* thread.c (info_threads_command): Constify.
(print_thread_info_1): Constify.
* target.c (info_target_command): Constify.
* symtab.c (info_sources_command, info_functions_command)
(info_types_command): Constify.
(info_variables_command): Remove non-const overload.
* symfile.c (info_ext_lang_command): Constify.
* stack.c (info_frame_command, info_locals_command)
(info_args_command): Constify.
(backtrace_command): Remove non-const overload.
* source.c (info_source_command, info_line_command): Constify.
* solib.c (info_sharedlibrary_command): Constify.
* skip.c (info_skip_command): Constify.
* ser-go32.c (info_serial_command): Constify.
* reverse.c (info_bookmarks_command): Constify.
* printcmd.c (info_symbol_command, info_address_command)
(info_display_command): Constify.
* osdata.c (info_osdata_command): Constify.
* objc-lang.c (info_selectors_command, info_classes_command):
Constify.
* nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify.
* memattr.c (info_mem_command): Constify.
* macrocmd.c (info_macro_command, info_macros_command): Constify.
* linux-fork.c (info_checkpoints_command): Constify.
* infrun.c (info_signals_command): Constify.
* inflow.c (info_terminal_command): Constify.
* inferior.c (info_inferiors_command): Constify.
(print_inferior): Constify.
* infcmd.c (info_program_command, info_all_registers_command)
(info_registers_command, info_vector_command)
(info_float_command): Constify.
(registers_info): Constify.
* gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd)
(info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd):
Constify.
* f-valprint.c (info_common_command): Constify.
* dcache.c (info_dcache_command): Constify.
(dcache_info_1): Constify.
* darwin-nat-info.c (info_mach_tasks_command)
(info_mach_task_command, info_mach_ports_command)
(info_mach_port_command, info_mach_threads_command)
(info_mach_thread_command, info_mach_regions_command)
(info_mach_regions_recurse_command, info_mach_region_command)
(info_mach_exceptions_command): Constify.
(get_task_from_args): Constify.
* cp-support.c (info_vtbl_command): Constify.
* breakpoint.c (info_watchpoints_command)
(info_tracepoints_command): Constify.
(info_breakpoints_command): Remove non-const overload.
* avr-tdep.c (avr_io_reg_read_command): Constify.
* auxv.c (info_auxv_command): Constify.
* ada-tasks.c (info_tasks_command): Constify.
(info_task): Constify.
* ada-lang.c (info_exceptions_command): Constify.
Tom Tromey [Wed, 11 Oct 2017 21:43:01 +0000 (15:43 -0600)]
Constify add_com
This changes add_com to take a cmd_const_cfunc_ftype, and then fixes
up all the command implementations.
In most cases this is trivial.
In a couple of places I had to again introduce a temporary non-const
overload. These overloads will be removed when add_info is
constified.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* solib.h (no_shared_libraries): Constify.
* frame.h (return_command): Constify.
* cli/cli-cmds.h (quit_command): Constify.
* top.h (quit_command, execute_command): Constify.
* target.h (flash_erase_command): Constify.
* inferior.h (set_inferior_args, attach_command): Constify.
* tracepoint.h (start_tracing, stop_tracing): Constify.
* breakpoint.h (break_command, tbreak_command)
(hbreak_command_wrapper, thbreak_command_wrapper)
(rbreak_command_wrapper, watch_command_wrapper)
(awatch_command_wrapper, rwatch_command_wrapper)
(get_tracepoint_by_number): Constify.
* symtab.c (info_variables_command, rbreak_command)
(symtab_symbol_info): Constify.
(info_variables_command): Add non-const overload.
* top.c (dont_repeat_command): Constify.
* breakpoint.c (ignore_command, commands_command)
(condition_command, tbreak_command, hbreak_command)
(thbreak_command, clear_command, break_command)
(info_breakpoints_command, watch_command, rwatch_command)
(awatch_command, trace_command, ftrace_command, strace_command)
(trace_pass_command, break_range_command, dprintf_command)
(agent_printf_command, get_tracepoint_by_number)
(watch_maybe_just_location, trace_pass_command): Constify.
(info_breakpoints_command): Add non-const overload.
* tracefile.c (tsave_command): Constify.
* infcmd.c (attach_command, disconnect_command, signal_command)
(queue_signal_command, stepi_command, nexti_command)
(finish_command, next_command, step_command, until_command)
(advance_command, jump_command, continue_command, run_command)
(start_command, starti_command, interrupt_command)
(run_command_1, set_inferior_args, step_1): Constify.
* inferior.c (add_inferior_command, remove_inferior_command)
(clone_inferior_command): Constify.
* linux-fork.c (checkpoint_command, restart_command): Constify.
* windows-nat.c (signal_event_command): Constify.
* guile/guile.c (guile_repl_command, guile_command): Constify.
* printcmd.c (x_command, display_command, printf_command)
(output_command, set_command, call_command, print_command)
(eval_command): Constify.
(non_const_set_command): Remove.
(_initialize_printcmd): Update.
* source.c (forward_search_command, reverse_search_command):
Constify.
* jit.c (jit_reader_load_command, jit_reader_unload_command):
Constify.
* infrun.c (handle_command): Constify.
* memattr.c (mem_command): Constify.
* stack.c (return_command, up_command, up_silently_command)
(down_command, down_silently_command, frame_command)
(backtrace_command, func_command, backtrace_command_1): Constify.
(backtrace_command): Add non-const overload.
* remote-sim.c (simulator_command): Constify.
* exec.c (set_section_command): Constify.
* tracepoint.c (tdump_command, trace_variable_command)
(tstatus_command, tstop_command, tstart_command)
(end_actions_pseudocommand, while_stepping_pseudocommand)
(collect_pseudocommand, teval_pseudocommand, actions_command)
(start_tracing, stop_tracing): Constify.
* value.c (init_if_undefined_command): Constify.
* tui/tui-stack.c (tui_update_command): Constify.
* tui/tui-win.c (tui_refresh_all_command)
(tui_set_tab_width_command, tui_set_win_height_command)
(tui_set_focus_command, tui_scroll_forward_command)
(tui_scroll_backward_command, tui_scroll_left_command)
(tui_scroll_right_command, parse_scrolling_args, tui_set_focus)
(tui_set_win_height): Constify.
* tui/tui-layout.c (tui_layout_command): Constify.
* procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd)
(proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd)
(proc_untrace_sysexit_cmd): Constify.
* remote.c (threadlist_test_cmd, threadinfo_test_cmd)
(threadset_test_cmd, threadlist_update_test_cmd)
(threadalive_test): Constify.
* objc-lang.c (print_object_command): Constify.
* command.h (add_com): Constify.
* cli/cli-dump.c (restore_command): Constify.
* cli/cli-cmds.c (pwd_command, echo_command, quit_command)
(help_command, complete_command, shell_command, edit_command)
(list_command, disassemble_command, make_command)
(apropos_command, alias_command): Constify.
* cli/cli-script.c (document_command, define_command)
(while_command, if_command, validate_comname): Constify.
* cli/cli-decode.c (struct cmd_list_element): Change type of
"fun".
* target.c (do_monitor_command, flash_erase_command): Constify.
* regcache.c (reg_flush_command): Constify.
* reverse.c (reverse_step, reverse_next, reverse_stepi)
(reverse_nexti, reverse_continue, reverse_finish)
(save_bookmark_command, goto_bookmark_command)
(exec_reverse_once): Constify.
* python/python.c (python_interactive_command, python_command):
Constify.
* typeprint.c (ptype_command, whatis_command, whatis_exp):
Constify.
* solib.c (sharedlibrary_command, no_shared_libraries): Constify.
* gcore.c (gcore_command): Constify.
Tom Tromey [Thu, 12 Oct 2017 14:27:21 +0000 (08:27 -0600)]
Add set_repeat_arguments function
The "x", "list", and "show commands" commands have special repetition
behavior: repeating the command doesn't re-run it with the same
arguments
This is currently implemented by modifying the passed-in argument; but
that won't work properly with const arguments (and seems pretty
obscure besides).
This patch adds a new "set_repeat_arguments" function and changes the
relevant places to call it.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* printcmd.c (x_command): Call set_repeat_arguments.
* cli/cli-cmds.c (list_command): Call set_repeat_arguments.
* top.c (repeat_arguments): New global.
(set_repeat_arguments): New function.
(execute_command): Handle repeat_arguments.
(show_commands): Calls set_repeat_arguments.
* command.h (set_repeat_arguments): Declare.
Tom Tromey [Thu, 12 Oct 2017 14:08:00 +0000 (08:08 -0600)]
Remove cleanup from backtrace_command
This removes a cleanup from backtrace_command, replacing it with
std::string. This patch temporarily changes backtrace_command so that
the parameter is named "args_in" and is immediately constified; this
is fixed again in the constification patch.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* stack.c (backtrace_command): Use std::string.
(backtrace_command_1): Make "count_exp" const.
Tom Tromey [Wed, 11 Oct 2017 23:04:29 +0000 (17:04 -0600)]
Constify add_path and friends
This constifies add_path, mod_path, and directory_switch.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* source.c (directory_switch, mod_path, add_path): Constify.
* defs.h (add_path, mod_path, directory_switch): Constify.
* mi/mi-cmd-env.c (env_mod_path): Constify.
Tom Tromey [Wed, 11 Oct 2017 03:54:01 +0000 (21:54 -0600)]
Make strip_bg_char return a unique_xmalloc_ptr
This changes strip_bg_char to return a unique_xmalloc_ptr and removes
several cleanups.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* infcmd.c (strip_bg_char): Return gdb::unique_xmalloc_ptr.
(run_command_1, continue_command, step_1, jump_command)
(signal_command, until_command, advance_command, finish_command)
(attach_command): Update.
Tom Tromey [Wed, 11 Oct 2017 00:14:10 +0000 (18:14 -0600)]
Make set_cmd_cfunc private
set_cmd_cfunc is only used in cli-decode.c, and I don't think there is
a good reason to expose it directly. So, this patch makes it private.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* command.h (set_cmd_cfunc): Don't declare.
* cli/cli-decode.c (set_cmd_cfunc): Now static.
Tom Tromey [Wed, 11 Oct 2017 00:12:06 +0000 (18:12 -0600)]
Constify add_com_suppress_notification
This constifies add_com_suppress_notification and fixes the one
caller.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* stack.c (select_frame_command): Constify.
* cli/cli-decode.c (add_com_suppress_notification): Constify.
* command.h (add_com_suppress_notification): Constify.
Tom Tromey [Tue, 10 Oct 2017 23:51:52 +0000 (17:51 -0600)]
Constify add_abbrev_prefix_cmd
This changes add_abbrev_prefix_cmd to take a const-taking callback
function and then fixes the one caller.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* breakpoint.c (stop_command): Constify.
* cli/cli-decode.c (struct cmd_list_element): Constify.
* command.h (add_abbrev_prefix_cmd): Constify.
Andrew Burgess [Tue, 7 Nov 2017 20:24:21 +0000 (20:24 +0000)]
opcodes/arc: Fix incorrect insn_class for some nps insns
A small number of NPS400 instruction incorrectly used NONE as an
insn_class_t, which would trigger a build warning. Fixed by changing to
MISC.
opcodes/ChangeLog:
* arc-nps400-tbl.h: Change incorrect use of NONE to MISC.
Jim Wilson [Tue, 7 Nov 2017 17:43:18 +0000 (09:43 -0800)]
Fix typo in my email address.
binutils/
* MAINTAINERS (RISC-V): Fix typo in my email address.
Palmer Dabbelt [Tue, 7 Nov 2017 01:53:12 +0000 (17:53 -0800)]
RISC-V: Add Jim Wilson as a maintainer, and clean up our entries
Jim has recently started working at SiFive, where he'll be contributing
to our binutils port. Andrew and I would like him to be a maintainer.
My understanding is that this is right place to ask.
I've also changed my address to my SiFive one, where I also work -- it
seems cleaner to have everyone use our proper email address. While I
was in there, I noticed a trailing space after Andrew's name so I went
ahead and removed it as well.
binutils/ChangeLog
2017-11-07 Palmer Dabbelt <palmer@sifive.com>
* MAINTAINERS (RISC-V): Add Jim Wilson as a maintainer.
Clean up Andrew's entry (remove trailing space, add tabs).
Change Palmer's email address, and clean up entry (add tabs).
Jim Wilson [Tue, 7 Nov 2017 00:32:08 +0000 (16:32 -0800)]
RISC-V: Fix riscv g++ testsuite EH failures.
This fixes some EH failures for the medany code model in the g++ testsuite.
The problem is that the assembler is computing some values in the eh_frame
section as constants, that instead should have had relocs to be resolved by
the linker. This happens in output_cfi_insn in the DW_CFA_advance_loc case
where it compares label frags and immediately simplifies if they are the
same. We can fix that by forcing a new frag after every instruction
that the linker can reduce in size. I've also added a testcase to verify
the fix. This was tested with binutils make check, and gcc/g++ make checks on
qemu for medlow and medany code models.
gas/
* config/tc-riscv.c (append_insn): Call frag_wane and frag_new at
end for linker optimizable relocs.
* testsuite/gas/riscv/eh-relocs.d: New.
* testsuite/gas/riscv/eh-relocs.s: New.
* testsuite/gas/riscv/riscv.exp: Run eh-relocs test.
Palmer Dabbelt [Mon, 6 Nov 2017 21:22:42 +0000 (13:22 -0800)]
RISC-V: Add satp as an alias for sptbr
The RISC-V privileged ISA changed the name of sptbr (Supervisor Page
Table Base Register) to satp (Supervisor Address Translation and
Protection) to reflect the fact it could be used for more than just
paging. This patch adds an alias, as they're the same register.
include/ChangeLog
2017-11-06 Palmer Dabbelt <palmer@dabbelt.com>
* opcode/riscv-opc.h (sptbr): Rename to satp.
(CSR_SPTBR): Rename to CSR_SATP.
(sptbr): Alias to CSR_SATP.
gas/ChangeLog
2017-11-06 Palmer Dabbelt <palmer@dabbelt.com>
* testsuite/gas/riscv/satp.d: New test.
testsuite/gas/riscv/satp.s: Likewise.
testsuite/gas/riscv/riscv.exp: Likewise.
config/tc-riscv.c (md_begin): Handle CSR aliases.
Pedro Alves [Tue, 7 Nov 2017 11:16:09 +0000 (11:16 +0000)]
Add some more breakpoint/location range tests
Some extra thoroughness tests that I had over here.
gdb/testsuite/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>
* gdb.cp/ena-dis-br-range.exp: Add more tests.
Pedro Alves [Tue, 7 Nov 2017 11:00:32 +0000 (11:00 +0000)]
Make breakpoint/location number parsing error output consistent
... and also make GDB catch a few more cases of invalid input.
This fixes the inconsistency in GDB's output (e.g., "bad" vs "Bad")
exposed by the new tests added in the previous commit.
Also, makes the "0-0" and "inverted range" cases be loud errors.
Also makes GDB reject negative breakpoint number in ranges. We
already rejected negative number literals, but you could still subvert
that via convenience variables, like:
(gdb) set $bp -1
(gdb) disable $bp.1-2
The change to get_number_trailer fixes a bug exposed by the new tests.
The function did not handle parsing "-$num". [This wasn't visible in
the gdb.multi/tids.exp (which has similar tests) because the TID range
parsing is implemented differently.]
gdb/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>
* breakpoint.c (extract_bp_kind): New enum.
(extract_bp_num, extract_bp_or_bp_range): New functions, partially
factored out from ...
(extract_bp_number_and_location): ... here.
* cli/cli-utils.c (get_number_trailer): Handle '-$variable'.
gdb/testsuite/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>
* gdb.base/ena-dis-br.exp (test_ena_dis_br): Adjust test.
* gdb.cp/ena-dis-br-range.exp: Adjust tests.
(disable_invalid, disable_inverted, disable_negative): New
procedures.
("bad numbers"): New set of tests.
Pedro Alves [Tue, 7 Nov 2017 11:00:31 +0000 (11:00 +0000)]
Add base 'enable/disable invalid location range' tests
This adds tests that exercise the "bad breakpoint number" paths.
Specifically:
- malformed ranges
- use of explicit 0 as bp/loc number.
- inverted ranges
I'm adding this as a baseline to improve. This shows that there's a
lot of inconsistency in GDB's output (e.g., "bad" vs "Bad").
Also, IMO, the "0-0" and inverted range cases should be loud errors.
That and more will all be addressed in the next patch.
gdb/testsuite/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>
* gdb.cp/ena-dis-br-range.exp: Add tests.
Pedro Alves [Tue, 7 Nov 2017 11:00:31 +0000 (11:00 +0000)]
Breakpoint location parsing: always error instead of warning
It's odd that when parsing a breakpoint or location number, we error out
in most cases, but warn in others.
(gdb) disable 1-
bad breakpoint number at or near: '1-'
(gdb) disable -1
bad breakpoint number at or near: '-1'
(gdb) disable .foo
bad breakpoint number at or near: '.foo'
(gdb) disable foo.1
Bad breakpoint number 'foo.1'
(gdb) disable 1.foo
warning: bad breakpoint number at or near '1.foo'
This changes GDB to always error out. It required touching one testcase
that expected the warning.
gdb/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>
* breakpoint.c (extract_bp_number_and_location): Change return
type to void. Throw error instead of warning.
(enable_disable_command): Adjust.
gdb/testsuite/ChangeLog:
2017-11-07 Pedro Alves <palves@redhat.com>
* gdb.base/ena-dis-br.exp: Don't expect "warning:".
Xavier Roirand [Tue, 7 Nov 2017 11:00:31 +0000 (11:00 +0000)]
Allow enabling/disabling breakpoint location ranges
When a breakpoint has multiple locations, like e.g.:
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x080486a2 in void foo<int>()...
1.2 y 0x080486ca in void foo<double>()...
[....]
1.5 y 0x080487fa in void foo<long>()...
it's possible to enable/disable the individual locations using the
'<breakpoint_number>.<location_number>' syntax, like e.g.:
(gdb) disable 1.2 1.3 1.4 1.5
That's inconvenient when you have a long list of locations to disable,
however.
This patch adds shorthand for the above, by making it possible to
specify a range of locations with the following syntax (similar to
thread id ranges):
<breakpoint_number>.<first_location_number>-<last_location_number>
For example, the command above can now be simplified to:
(gdb) disable 1.2-5
gdb/ChangeLog:
2017-11-07 Xavier Roirand <roirand@adacore.com>
Pedro Alves <palves@redhat.com>
* breakpoint.c (map_breakpoint_number_range): New, factored out
from ...
(map_breakpoint_numbers): ... here.
(find_location_by_number): Change parameters from string to
breakpoint number and location.
(extract_bp_number_and_location): New function.
(enable_disable_bp_num_loc)
(enable_disable_breakpoint_location_range)
(enable_disable_command): New functions, factored out ...
(enable_command, disable_command): ... these functions, and
adjusted to support ranges.
* NEWS: Document enable/disable breakpoint location range feature.
gdb/doc/ChangeLog:
2017-11-07 Xavier Roirand <roirand@adacore.com>
Pedro Alves <palves@redhat.com>
* gdb.texinfo (Set Breaks): Document support for breakpoint
location ranges in the enable/disable commands.
gdb/testsuite/ChangeLog:
2017-11-07 Xavier Roirand <roirand@adacore.com>
Pedro Alves <palves@redhat.com>
* gdb.base/ena-dis-br.exp: Add reference to
gdb.cp/ena-dis-br-range.exp.
* gdb.cp/ena-dis-br-range.exp: New file.
* gdb.cp/ena-dis-br-range.cc: New file.
Tamar Christina [Tue, 7 Nov 2017 10:17:21 +0000 (10:17 +0000)]
This patch similarly to the AArch64 one enables Dot Product support by default for the Cortex-A55 and Cortex-A75 which have hardware support for these instructions.
gas * config/tc-arm.c (arm_cpus):
Change FPU_ARCH_CRYPTO_NEON_VFP_ARMV8
into FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_DOTPROD.
include * opcode/arm.h (FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_DOTPROD):
New macro.
Alan Modra [Mon, 6 Nov 2017 04:51:53 +0000 (15:21 +1030)]
PowerPC64 statistics message
Fixes "linker stubs in 1 groups".
* elf64-ppc.c (ppc64_elf_build_stubs): Correct pluralization in
statistics message.
Alan Modra [Tue, 7 Nov 2017 06:02:07 +0000 (16:32 +1030)]
bundle_lock message tidy
I'd edited these thinking that there might be cases where the counts
were one, but on further investigation it appears not. What's left
here are some minor tweaks.
* read.c (assemble_one, s_bundle_unlock): Formatting.
Consistently add comma and "bytes" to error message.
* testsuite/gas/i386/bundle-bad.l: Adjust to suit.
Alan Modra [Tue, 7 Nov 2017 00:48:29 +0000 (11:18 +1030)]
readelf ngettext fixes
This patch is a first pass at fixing readelf message pluralization.
I've deliberately not fixed the "out of memory" errors since it's very
unlikely that they will ever be complaining about not being able to
allocate for a single entry, and a few others where the size is very
unlikely to be 1 byte.
Then there are messages like this one:
"Out of %lu items there are %zu bucket clashes (longest of %zu entries).\n"
I suppose this could be split into three parts, "Of %lu items ",
"there are %zu bucket clashes ", and "(longest of %zu entries).\n",
each part being printed separately, but that might not be ideal for
sentence construction in other languages. For now I'm punting on this
one.
Changes to readelf output require lots of testsuite adjustment..
binutils/
* dwarf.c (read_uleb128): Properly pluralize messages.
(display_debug_lines_raw, display_debug_loc): Likewise.
(display_debug_names, process_cu_tu_index): Likewise.
* od-macho.c (dump_code_signature_superblob): Likewise.
* readelf.c (process_program_headers): Likewise.
(process_section_header, process_relocs): Likewise.
(hppa_process_unwind, arm_process_unwind): Likewise.
(process_dynamic_section, process_version_sections): Likewise.
(process_symbol_table, process_syminfo): Likewise.
(apply_relocations, process_mips_specific): Likewise.
(process_gnu_liblist, process_notes_at): Likewise.
(process_archive): Likewise.
* testsuite/binutils-all/dw2-1.W,
* testsuite/binutils-all/dw2-3.W,
* testsuite/binutils-all/dw2-3gabi.W,
* testsuite/binutils-all/dw5.S,
* testsuite/binutils-all/dw5.W,
* testsuite/binutils-all/i386/compressed-1a.d,
* testsuite/binutils-all/libdw2-compressedgabi.out,
* testsuite/binutils-all/objdump.W,
* testsuite/binutils-all/readelf.r,
* testsuite/binutils-all/readelf.r-64,
* testsuite/binutils-all/x86-64/compressed-1a.d: Update
for pluralization fixes.
gas/
* testsuite/gas/arm/got_prel.d,
* testsuite/gas/elf/dwarf2-1.d,
* testsuite/gas/elf/dwarf2-2.d,
* testsuite/gas/elf/dwarf2-3.d,
* testsuite/gas/elf/dwarf2-5.d,
* testsuite/gas/elf/dwarf2-6.d,
* testsuite/gas/i386/debug1.d,
* testsuite/gas/i386/dw2-compress-1.d,
* testsuite/gas/i386/dw2-compress-3a.d,
* testsuite/gas/i386/dw2-compress-3b.d,
* testsuite/gas/i386/dw2-compressed-1.d,
* testsuite/gas/i386/dw2-compressed-3a.d,
* testsuite/gas/i386/dw2-compressed-3b.d,
* testsuite/gas/i386/ilp32/x86-64-localpic.d,
* testsuite/gas/i386/localpic.d,
* testsuite/gas/i386/x86-64-localpic.d,
* testsuite/gas/ia64/pr13167.d,
* testsuite/gas/mips/loc-swap-2.d,
* testsuite/gas/mips/loc-swap.d,
* testsuite/gas/mips/micromips@loc-swap-2.d,
* testsuite/gas/mips/micromips@loc-swap.d,
* testsuite/gas/mips/mips16-dwarf2-n32.d,
* testsuite/gas/mips/mips16-dwarf2.d,
* testsuite/gas/mips/mips16@loc-swap-2.d,
* testsuite/gas/mips/mips16@loc-swap.d,
* testsuite/gas/mips/mips16e@loc-swap.d,
* testsuite/gas/mmix/bspec-1.d,
* testsuite/gas/mmix/bspec-2.d,
* testsuite/gas/tic6x/unwind-1.d,
* testsuite/gas/tic6x/unwind-2.d,
* testsuite/gas/tic6x/unwind-3.d: Update for pluralization
fixes.
ld/
* testsuite/ld-aarch64/ifunc-13.d,
* testsuite/ld-aarch64/ifunc-15.d,
* testsuite/ld-aarch64/ifunc-20.d,
* testsuite/ld-alpha/tlsbin.rd,
* testsuite/ld-alpha/tlspic.rd,
* testsuite/ld-arm/ifunc-3.rd,
* testsuite/ld-arm/ifunc-9.rd,
* testsuite/ld-arm/unwind-mix.d,
* testsuite/ld-arm/unwind-rel.d,
* testsuite/ld-cris/hiddef1.d,
* testsuite/ld-cris/libdso-13.d,
* testsuite/ld-cris/libdso-2.d,
* testsuite/ld-cris/pr16044.d,
* testsuite/ld-cris/tls-local-63.d,
* testsuite/ld-cris/tls-local-64.d,
* testsuite/ld-cris/tls-und-38.d,
* testsuite/ld-cris/tls-und-42.d,
* testsuite/ld-cris/tls-und-46.d,
* testsuite/ld-cris/tls-und-50.d,
* testsuite/ld-cris/weakref3.d,
* testsuite/ld-cris/weakref4.d,
* testsuite/ld-elf/comm-data2r.rd,
* testsuite/ld-elf/discard1.d,
* testsuite/ld-elf/discard2.d,
* testsuite/ld-elf/pr19539.d,
* testsuite/ld-elf/pr22374-1.r,
* testsuite/ld-elf/pr22374-2.r,
* testsuite/ld-i386/combreloc.d,
* testsuite/ld-i386/emit-relocs-nacl.rd,
* testsuite/ld-i386/emit-relocs.rd,
* testsuite/ld-i386/pr13302.d,
* testsuite/ld-i386/pr17709-nacl.rd,
* testsuite/ld-i386/pr17709.rd,
* testsuite/ld-i386/pr19539.d,
* testsuite/ld-i386/pr19615.d,
* testsuite/ld-i386/pr19636-1a.d,
* testsuite/ld-i386/pr19636-1e.d,
* testsuite/ld-i386/pr19636-1f.d,
* testsuite/ld-i386/pr19636-2a.d,
* testsuite/ld-i386/pr19636-2b.d,
* testsuite/ld-i386/pr19636-2d-nacl.d,
* testsuite/ld-i386/pr19636-2e-nacl.d,
* testsuite/ld-i386/pr19636-3a.d,
* testsuite/ld-i386/pr19636-3d.d,
* testsuite/ld-i386/pr19636-3e.d,
* testsuite/ld-i386/pr19636-4a.d,
* testsuite/ld-i386/pr19645.d,
* testsuite/ld-i386/pr19827-nacl.rd,
* testsuite/ld-i386/pr19827.rd,
* testsuite/ld-i386/pr20253-4a.d,
* testsuite/ld-i386/pr20253-4b.d,
* testsuite/ld-i386/pr20253-5.d,
* testsuite/ld-i386/tlsbin-nacl.rd,
* testsuite/ld-i386/tlsbin.rd,
* testsuite/ld-i386/tlspic-nacl.rd,
* testsuite/ld-i386/tlspic.rd,
* testsuite/ld-i386/undefweakb.d,
* testsuite/ld-ia64/tlsbin.rd,
* testsuite/ld-ia64/tlspic.rd,
* testsuite/ld-ifunc/ifunc-13-i386.d,
* testsuite/ld-ifunc/ifunc-13-x86-64.d,
* testsuite/ld-ifunc/ifunc-15-i386.d,
* testsuite/ld-ifunc/ifunc-15-x86-64.d,
* testsuite/ld-ifunc/ifunc-20-i386.d,
* testsuite/ld-ifunc/ifunc-20-x86-64.d,
* testsuite/ld-ifunc/ifunc-23a-x86.d,
* testsuite/ld-ifunc/ifunc-23b-x86.d,
* testsuite/ld-ifunc/ifunc-23c-x86.d,
* testsuite/ld-ifunc/ifunc-24a-x86.d,
* testsuite/ld-ifunc/ifunc-24b-x86.d,
* testsuite/ld-ifunc/ifunc-24c-x86.d,
* testsuite/ld-ifunc/ifunc-25a-x86.d,
* testsuite/ld-ifunc/ifunc-25b-x86.d,
* testsuite/ld-ifunc/ifunc-25c-x86.d,
* testsuite/ld-m68k/got-1.d,
* testsuite/ld-mips-elf/vxworks1.rd,
* testsuite/ld-powerpc/ambiguousv1.d,
* testsuite/ld-powerpc/ambiguousv1b.d,
* testsuite/ld-powerpc/ambiguousv2.d,
* testsuite/ld-powerpc/ambiguousv2b.d,
* testsuite/ld-powerpc/tlsexe.r,
* testsuite/ld-powerpc/tlsexe32.r,
* testsuite/ld-powerpc/tlsexetoc.r,
* testsuite/ld-powerpc/tlsso.r,
* testsuite/ld-powerpc/tlsso32.r,
* testsuite/ld-powerpc/tlstocso.r,
* testsuite/ld-powerpc/vle-multiseg-1.d,
* testsuite/ld-powerpc/vle-multiseg-2.d,
* testsuite/ld-powerpc/vle-multiseg-3.d,
* testsuite/ld-s390/tlsbin.rd,
* testsuite/ld-s390/tlsbin_64.rd,
* testsuite/ld-s390/tlspic.rd,
* testsuite/ld-s390/tlspic_64.rd,
* testsuite/ld-sh/ld-r-1.d,
* testsuite/ld-sh/sh64/gotplt.d,
* testsuite/ld-sh/shared-1.d,
* testsuite/ld-sh/tlsbin-2.d,
* testsuite/ld-sh/tlspic-2.d,
* testsuite/ld-sparc/gotop32.rd,
* testsuite/ld-sparc/gotop64.rd,
* testsuite/ld-sparc/tlssunpic32.rd,
* testsuite/ld-sparc/tlssunpic64.rd,
* testsuite/ld-sparc/vxworks1-lib.rd,
* testsuite/ld-tic6x/shlib-app-1.rd,
* testsuite/ld-tic6x/shlib-app-1b.rd,
* testsuite/ld-tic6x/shlib-app-1r.rd,
* testsuite/ld-tic6x/shlib-app-1rb.rd,
* testsuite/ld-tic6x/shlib-noindex.rd,
* testsuite/ld-vax-elf/export-class-data.rd,
* testsuite/ld-x86-64/pr13082-1a.d,
* testsuite/ld-x86-64/pr13082-1b.d,
* testsuite/ld-x86-64/pr13082-2a.d,
* testsuite/ld-x86-64/pr13082-2b.d,
* testsuite/ld-x86-64/pr13082-3a.d,
* testsuite/ld-x86-64/pr13082-3c.d,
* testsuite/ld-x86-64/pr13082-4a.d,
* testsuite/ld-x86-64/pr13082-5a.d,
* testsuite/ld-x86-64/pr13082-5b.d,
* testsuite/ld-x86-64/pr13082-6a.d,
* testsuite/ld-x86-64/pr13082-6b.d,
* testsuite/ld-x86-64/pr17709-nacl.rd,
* testsuite/ld-x86-64/pr17709.rd,
* testsuite/ld-x86-64/pr19539a.d,
* testsuite/ld-x86-64/pr19539b.d,
* testsuite/ld-x86-64/pr19615.d,
* testsuite/ld-x86-64/pr19636-1a.d,
* testsuite/ld-x86-64/pr19636-1d.d,
* testsuite/ld-x86-64/pr19636-1e.d,
* testsuite/ld-x86-64/pr19636-2a.d,
* testsuite/ld-x86-64/pr19636-2e.d,
* testsuite/ld-x86-64/pr19636-2f.d,
* testsuite/ld-x86-64/pr19636-3a.d,
* testsuite/ld-x86-64/pr19645.d,
* testsuite/ld-x86-64/pr19807-2b.d,
* testsuite/ld-x86-64/pr19807-2d.d,
* testsuite/ld-x86-64/pr19827-nacl.rd,
* testsuite/ld-x86-64/pr19827.rd,
* testsuite/ld-x86-64/pr20253-4a.d,
* testsuite/ld-x86-64/pr20253-4b.d,
* testsuite/ld-x86-64/pr20253-4d.d,
* testsuite/ld-x86-64/pr20253-4e.d,
* testsuite/ld-x86-64/pr20253-5a.d,
* testsuite/ld-x86-64/pr20253-5b.d,
* testsuite/ld-x86-64/tlsbin-nacl.rd,
* testsuite/ld-x86-64/tlsbin.rd,
* testsuite/ld-x86-64/tlspic-nacl.rd,
* testsuite/ld-x86-64/tlspic.rd,
* testsuite/ld-x86-64/tlspic2-nacl.rd: Update for
pluralization fixes.
Alan Modra [Mon, 6 Nov 2017 09:14:02 +0000 (19:44 +1030)]
gas and ld pluralization fixes
gas/
* as.c (main): Properly pluralize messages.
* frags.c (frag_grow): Likewise.
* read.c (emit_expr_with_reloc, emit_expr_fix): Likewise.
(parse_bitfield_cons): Likewise.
* write.c (fixup_segment, compress_debug, write_contents): Likewise.
(relax_segment): Likewise.
* config/tc-arm.c (s_arm_elf_cons): Likewise.
* config/tc-cr16.c (l_cons): Likewise.
* config/tc-i370.c (i370_elf_cons): Likewise.
* config/tc-m68k.c (m68k_elf_cons): Likewise.
* config/tc-msp430.c (msp430_operands): Likewise.
* config/tc-s390.c (s390_elf_cons, s390_literals): Likewise.
* config/tc-mcore.c (md_apply_fix): Likewise.
* config/tc-tic54x.c (md_assemble): Likewise.
* config/tc-xtensa.c (xtensa_elf_cons): Likewise.
(xg_expand_assembly_insn): Likewise.
* config/xtensa-relax.c (build_transition): Likewise.
ld/
* ldlang.c (lang_size_sections_1): Properly pluralize messages.
(lang_check_section_addresses): Likewise.
Alan Modra [Mon, 6 Nov 2017 11:00:12 +0000 (21:30 +1030)]
Require ngettext in test of system gettext implementation
If binutils is going to use ngettext, then we'd better arrange for
intl/ to be compiled if the system gettext lacks ngettext.
* configure.ac: Invole AM_GNU_GETTEXT with need_ngettext.
* configure: Regenerate.
* aclocal.m4: Regenerate.
Alan Modra [Mon, 6 Nov 2017 04:50:00 +0000 (15:20 +1030)]
ngettext support
binutils has lacked proper pluralization of output messages for a long
time, for example, readelf will display information about a section
that "contains 1 entries" or "There are 1 section headers". Fixing
this properly requires us to use ngettext, because other languages
have different rules to English.
This patch defines macros for ngettext and friends to handle builds
with --disable-nls, and tidies the existing nls support. I've
redefined gettext rather than just defining "_" as dgettext in bfd and
opcodes in case someone wants to use gettext there (which might
conceivably happen with generated code).
bfd/
* sysdep.h: Formatting, comment fixes.
(gettext, ngettext): Redefine when ENABLE_NLS.
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
(_): Define using gettext.
(textdomain, bindtextdomain): Use safer "do nothing".
* hosts/alphavms.h (textdomain, bindtextdomain): Likewise.
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
opcodes/
* opintl.h: Formatting, comment fixes.
(gettext, ngettext): Redefine when ENABLE_NLS.
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
(_): Define using gettext.
(textdomain, bindtextdomain): Use safer "do nothing".
binutils/
* sysdep.h (textdomain, bindtextdomain): Use safer "do nothing".
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
gas/
* asintl.h (textdomain, bindtextdomain): Use safer "do nothing".
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
gold/
* system.h (textdomain, bindtextdomain): Use safer "do nothing".
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
ld/
* ld.h (textdomain, bindtextdomain): Use safer "do nothing".
(ngettext, dngettext, dcngettext): Define when !ENABLE_NLS.
GDB Administrator [Tue, 7 Nov 2017 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in