Nick Clifton [Thu, 20 Jul 2017 10:47:16 +0000 (11:47 +0100)]
Update the German translation for the opcodes library.
* po/de.po: Updated German translation.
GDB Administrator [Thu, 20 Jul 2017 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 19 Jul 2017 23:39:57 +0000 (00:39 +0100)]
PR ld/16656: Add missing annotation to the relevant ChangeLog entries
Add PR ld/16656 annotation to ChangeLog entries for commit
9a0f1d5099fa
("LD/testsuite: Conditionalize the placement of `.dynamic' in
GNU_RELRO") and commit ("LD/testsuite: Conditionalize the placement of
`.got' in GNU_RELRO").
Szabolcs Nagy [Tue, 4 Jul 2017 14:43:59 +0000 (15:43 +0100)]
[AArch64] Fix PR18841 ifunc relocation ordering
In order to get the ifunc relocs properly sorted the correct class
needs to be returned. The code mimics what has been done for x86.
Fixes
FAIL: Run pr18841 with libpr18841c.so
bfd/
PR ld/18841
* elfnn-aarch64.c (elfNN_aarch64_reloc_type_class): Return
reloc_class_ifunc for ifunc symbols.
Nick Clifton [Wed, 19 Jul 2017 15:14:02 +0000 (16:14 +0100)]
Extend previous fix to coff-rs6000.c to coff64-rs6000.c
PR 21786
* coff64-rs6000.c (_bfd_strntol): New function.
(_bfd_strntoll): New function.
(GET_VALUE_IN_FIELD): New macro.
(xcoff64_slurp_armap): Use new macros.
Nick Clifton [Wed, 19 Jul 2017 13:49:12 +0000 (14:49 +0100)]
Fix use-after-free error when parsing a corrupt nested archive.
PR 21787
* archive.c (bfd_generic_archive_p): If the bfd does not have the
correct magic bytes at the start, set the error to wrong format
and clear the format selector before returning NULL.
Maciej W. Rozycki [Wed, 19 Jul 2017 12:11:59 +0000 (13:11 +0100)]
LD/testsuite: Add 2**4 section alignment FILL script statement test
Complement commit
ffe54b3798db ("Pad sections according to current
script FILL.") and add a FILL script statement test for targets that
impose the minimum alignment of more than 2**2 for the `.text' section.
These targets include IA-64 targets, MIPS targets other than bare-metal
ELF and VxWorks, TILE-Gx targets, TILEPro targets and X86-64 PE targets.
Use the `notarget' tag for configuration triplets that are incompatible
with the new test, but are supported by the existing FILL test, and
`xfail' for ones that have issues due to section alignment or padding
with both tests. Make a complementary change to the existing FILL test,
removing the following test issues:
arm-epoc-pe -FAIL: ld-scripts/fill
mips-elf -XPASS: ld-scripts/fill
mips-img-elf -XPASS: ld-scripts/fill
mips-mti-elf -XPASS: ld-scripts/fill
mips-sde-elf -XPASS: ld-scripts/fill
mips-vxworks -XPASS: ld-scripts/fill
mipsel-elf -XPASS: ld-scripts/fill
mipsel-img-elf -XPASS: ld-scripts/fill
mipsel-mti-elf -XPASS: ld-scripts/fill
mipsel-vxworks -XPASS: ld-scripts/fill
mipsisa32-elf -XPASS: ld-scripts/fill
mipsisa32el-elf -XPASS: ld-scripts/fill
mipsisa64-elf -XPASS: ld-scripts/fill
mipsisa64el-elf -XPASS: ld-scripts/fill
tilegx-linux -FAIL: ld-scripts/fill
tilepro-elf -FAIL: ld-scripts/fill
tx39-elf -XPASS: ld-scripts/fill
ld/
* testsuite/ld-scripts/fill.d: Adjust `xfail' entries. Add
`notarget' entries. Update comments.
* testsuite/ld-scripts/fill16.d: New test.
* testsuite/ld-scripts/fill16_0.s: New test source.
* testsuite/ld-scripts/fill16_1.s: New test source.
* testsuite/ld-scripts/fill16_2.s: New test source.
* testsuite/ld-scripts/data.exp: Run the new test.
Nick Clifton [Wed, 19 Jul 2017 10:07:43 +0000 (11:07 +0100)]
Fix address violation when attempting to read a corrupt field in a COFF archive header structure.
PR 21786
* coff-rs6000.c (_bfd_strntol): New function.
(_bfd_strntoll): New function.
(GET_VALUE_IN_FIELD): New macro.
(EQ_VALUE_IN_FIELD): new macro.
(_bfd_xcoff_slurp_armap): Use new macros.
(_bfd_xcoff_archive_p): Likewise.
(_bfd_xcoff_read_ar_hdr): Likewise.
(_bfd_xcoff_openr_next_archived_file): Likewise.
(_bfd_xcoff_stat_arch_elt): Likewise.
claziss [Wed, 19 Jul 2017 07:56:55 +0000 (09:56 +0200)]
[ARC] Add SecureShield AUX registers
Update auxiliary registers with SecureShield ones.
opcodes/
2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
* arc-regs.h (sec_stat): New aux register.
(aux_kernel_sp): Likewise.
(aux_sec_u_sp): Likewise.
(aux_sec_k_sp): Likewise.
(sec_vecbase_build): Likewise.
(nsc_table_top): Likewise.
(nsc_table_base): Likewise.
(ersec_stat): Likewise.
(aux_sec_except): Likewise.
Claudiu Zissulescu [Wed, 19 Jul 2017 07:56:55 +0000 (09:56 +0200)]
[ARC] Add SJLI instruction.
include/
2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
* opcode/arc.h (SJLI): Add.
opcode/
2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
* arc-opc.c (extract_uimm12_20): New function.
(UIMM12_20): New operand.
(SIMM3_5_S): Adjust.
* arc-tbl.h (sjli): Add new instruction.
John Eric Martin [Wed, 19 Jul 2017 07:56:55 +0000 (09:56 +0200)]
[ARC] Add JLI support.
The following relocation types were added to GCC/binutils:
ARC_JLI_SECTOFF is a relocation type in Metaware that is now used by
GCC as well to adjust the index of function calls to functions with
attribute jli_call_always.
bfd/
2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
John Eric Martin <John.Martin@emmicro-us.com>
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* elf32-arc.c (JLI): Define.
* reloc.c: Add JLI relocations.
gas/
2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/gas/arc/jli-1.d: New file.
* testsuite/gas/arc/jli-1.s: Likewise.
* testsuite/gas/arc/taux.d: Update for jli_base.
include/
2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
John Eric Martin <John.Martin@emmicro-us.com>
* elf/arc-reloc.def: Add JLI relocs howto.
* opcode/arc-func.h (replace_jli): New function.
ld/
2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
John Eric Martin <John.Martin@emmicro-us.com>
* emulparams/arcelf.sh (JLI_START_TABLE): Define.
* scripttempl/elfarc.sc: Handle jlitab section.
* scripttempl/elfarcv2.sc: Likewise.
* testsuite/ld-arc/arc.exp: Add JLI test.
* testsuite/ld-arc/jli-script.ld: New file.
* testsuite/ld-arc/jli-simple.dd: Likewise.
* testsuite/ld-arc/jli-simple.rd: Likewise.
* testsuite/ld-arc/jli-simple.s: Likewise.
* testsuite/ld/testsuite/ld-arc/jli-overflow.s: Likewise.
* testsuite/ld/testsuite/ld-arc/jli-overflow.d: Likewise.
* testsuite/ld/testsuite/ld-arc/jli-overflow.err: Likewise.
opcode/
2017-07-19 Claudiu Zissulescu <claziss@synopsys.com>
John Eric Martin <John.Martin@emmicro-us.com>
* arc-opc.c (UIMM10_6_S_JLIOFF): Define.
(UIMM3_23): Adjust accordingly.
* arc-regs.h: Add/correct jli_base register.
* arc-tbl.h (jli_s): Likewise.
Tristan Gingold [Wed, 19 Jul 2017 07:55:12 +0000 (09:55 +0200)]
Remove datasize measurements based on sbrk()
binutils/
* nm.c (show_stats): Remove variable.
(long_options): Remove --stats option.
(main): Remove handling of --stats.
ld/
* ldmain.c (main): Remove display of data size.
gas/
* as.c (start_sbrk): Remove.
(main): Remove assignment.
(dump_statistics): Remove display of data size.
Tristan Gingold [Wed, 19 Jul 2017 06:05:30 +0000 (08:05 +0200)]
Fix gas crash on missing seh_endproc.
gas/
* testsuite/gas/pe/seh-x64-err-2.s: New test.
* testsuite/gas/pe/seh-x64-err-2.l: New stderr output.
* testsuite/gas/pe/pe.exp: Add test.
* config/obj-coff-seh.c (obj_coff_seh_do_final): Don't try to end
seh part.
GDB Administrator [Wed, 19 Jul 2017 00:00:59 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Tue, 18 Jul 2017 16:20:30 +0000 (17:20 +0100)]
LD/testsuite: Conditionalize the placement of `.got' in GNU_RELRO
Complement commit
d345186d0535 ("Check if GNU_RELRO segment is is
generated") and exclude the presence of a `.got' section from implying
the creation of a GNU_RELRO segment for targets which place the section
along with small data, and therefore as it stands cannot have the
section assigned to GNU_RELRO. This is because we currently only
support a single GNU_RELRO segment and we place it at the beginning of
regular data which is then separated from small data by read-write data.
Currently the list of such targets consists of Alpha, Linux HPPA, NetBSD
HPPA, OpenBSD HPPA, Meta, MIPS, Nios II, OpenRISC 1000, RISC-V, SH and
X86-64, as determined by examining default linker scripts produced in a
`--enable-targets=all' build for those that have DATA_SEGMENT_RELRO_END
set and `.got' placed beyond. These targets do not set NO_SMALL_DATA or
DATA_GOT in their respective files in ld/emulparams/*, hovever checking
for the absence of these settings on its own is not very feasible due to
the structure of these files and the lack of support for GNU_RELRO by
some targets in the first place.
Add a separate control for `.got.plt' which does get placed in GNU_RELRO
on MIPS targets even though `.got' does not.
ld/
* testsuite/ld-elf/binutils.exp (binutils_test): Make the
expectation for `.got' in GNU_RELRO segment target-specific.
Handle `.got.plt' separately.
Maciej W. Rozycki [Tue, 18 Jul 2017 16:20:30 +0000 (17:20 +0100)]
LD/testsuite: Conditionalize the placement of `.dynamic' in GNU_RELRO
Complement commit
d345186d0535 ("Check if GNU_RELRO segment is is
generated") and exclude the presence of a `.dynamic' section from
implying the creation of a GNU_RELRO segment for targets which place the
section in the (read-only) text segment, and therefore cannot have the
section assigned to GNU_RELRO and neither it would make sense.
Currently the list of such targets consists of 64-bit HPPA and
non-VxWorks MIPS targets, as determined by looking for TEXT_DYNAMIC
being set across ld/emulparams/* and then verified by examining default
linker scripts produced in a `--enable-targets=all' build.
ld/
* testsuite/ld-elf/binutils.exp (binutils_test): Make the
expectation for `.dynamic' in GNU_RELRO segment target-specific.
Yuri Chornovian [Tue, 18 Jul 2017 15:58:14 +0000 (16:58 +0100)]
Fix spelling typos.
David Blaikie [Tue, 18 Jul 2017 15:06:17 +0000 (16:06 +0100)]
Fix Fission (broken by my previous patch)
Turns out somewhere along the refactoring of the multiple-CU support
for Fission I broke the patch before submitting it (& seems to have
broken Fission support generally).
Syncing back to the point at which the patch was committed, the
previous test results on my machine are:
expected passes: 36137
unexpected failures: 416
with the previous (broken) patch committed:
expected passes: 36131
unexpected failures: 429
With this one line patch applied on top of the broken commit:
expected passes: 36144
unexpected failures: 416
(& all other result counts remained the same in all 3 cases)
gdb/ChangeLog:
2017-07-18 David Blaikie <dblaikie@gmail.com>
* dwarf2read.c (create_cus_hash_table): Re-add lost initialization
of dwo_cu's dwo_file.
Nick Clifton [Tue, 18 Jul 2017 14:46:13 +0000 (15:46 +0100)]
Fix runtime failure triggered by a corrupt ecoff input file.
PR binutils/21781
* coffcode.h (handle_COMDAT): Replace abort with an error message
and return.
Yao Qi [Tue, 18 Jul 2017 11:57:19 +0000 (12:57 +0100)]
Remove one line comment
This patch is going to remove a line comment, which was added in this
commit,
commit
55fea07
Author: Jim Kingdon <jkingdon@engr.sgi.com>
Date: Tue Sep 14 01:08:22 1993 +0000
* remote.c: Define remote_debug to 0 and #if 0 baud_rate. Temporary
hack so this file compiles again.
* remote-utils.c (gr_multi_scan): Cast return value from alloca.
(gr_multi_scan): #if 0 never-reached return(-1).
and at that moment, remote_prepare_to_store does updates some global
state,
static void
remote_prepare_to_store ()
{
/* Make sure the entire registers array is valid. */
read_register_bytes (0, (char *)NULL, REGISTER_BYTES);
}
However, now, remote_prepare_to_store doesn't do that at all, and
rsa->sizeof_g_packet is updated in init_remote_state, so the line of
comment is out of date, and this patch removes it.
gdb:
2017-07-18 Yao Qi <yao.qi@linaro.org>
* remote.c (store_registers_using_G): Remove one line comment.
Yao Qi [Tue, 18 Jul 2017 11:46:14 +0000 (12:46 +0100)]
Simplify regcache_cpy and remove regcache::cpy_no_passthrough
Nowadays, regcache_cpy is used where src is read-only and dst is not
read-only, so the regcache_cpy can be simplified to handle this case only.
As a result, regcache::cpy_no_passthrough, which is about two read-only
regcache copy, is no longer used, remove it as well.
gdb:
2017-07-18 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache_cpy): Simplify it.
(regcache::cpy_no_passthrough): Remove it.
* regcache.h (cpy_no_passthrough): Remove it.
(regcache_dup, regcache_cpy): Update comments.
Yao Qi [Tue, 18 Jul 2017 11:39:22 +0000 (12:39 +0100)]
Improve doc about "maint print c-tdesc"
In my patch extending command "maint print c-tdesc"
(https://sourceware.org/ml/gdb-patches/2017-06/msg00286.html), Eli
raised some questions on the existing doc to this command. It is not
very clear, so this patch improves it. Eli approved it.
gdb/doc:
2017-07-18 Yao Qi <yao.qi@linaro.org>
* gdb.texinfo (Maintenance Commands): Improve the doc to
command "maint print c-tdesc".
Nick Clifton [Tue, 18 Jul 2017 11:18:01 +0000 (12:18 +0100)]
Import updated Ukranian and Swedish translations.
gas * po/uk.po: Updated Ukranian translation.
binutils* po/sv.po: Updated Swedish translation.
Pedro Alves [Tue, 18 Jul 2017 10:38:17 +0000 (11:38 +0100)]
Fix GDB builds that include the simulator
The completer rewrite series missed adjusting target sim to the new
completion_tracker interface.
src/gdb/remote-sim.c: In function ‘void _initialize_remote_sim()’:
src/gdb/remote-sim.c:1350:46: error: invalid conversion from ‘VEC_char_ptr* (*)(cmd_list_element*, const char*, const char*)’ to ‘void (*)(cmd_list_element*, completion_tracker&, const char*, const char*)’ [-fpermissive]
set_cmd_completer (c, sim_command_completer);
^
This commit fixes it, and also takes care to be exception safe (the
previous code would leak if growing the VEC throws).
Tested manually with a --target=arm-none-eabi build.
gdb/ChangeLog:
2017-07-18 Pedro Alves <palves@redhat.com>
* remote-sim.c (sim_command_completer): Adjust to work with a
completion_tracker instead of a VEC.
Hans-Peter Nilsson [Tue, 18 Jul 2017 10:14:38 +0000 (12:14 +0200)]
* dwarf.c (display_debug_names): Initialize hash_prev.
gcc-4.3.0 warns that it may be used uninitialized. It takes a look
and a half at the code to understand that it's false.
GDB Administrator [Tue, 18 Jul 2017 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Mon, 17 Jul 2017 19:42:32 +0000 (12:42 -0700)]
i386: Add tests for PIE with undefined weak symbol
* testsuite/ld-i386/i386.exp: Run pie1 and pie1-nacl.
* testsuite/ld-i386/pie1-nacl.d: New file.
* testsuite/ld-i386/pie1.d: Likewise.
* testsuite/ld-i386/pie1.s: Likewise.
H.J. Lu [Mon, 17 Jul 2017 19:40:57 +0000 (12:40 -0700)]
Add missing ChangeLog entries for PR ld/21782 fix
Pedro Alves [Mon, 17 Jul 2017 19:08:02 +0000 (20:08 +0100)]
A smarter linespec completer
Continuing the theme of the explicit locations patch, this patch gets
rid of the need for quoting function names in linespec TAB completion.
To recap, when you have overloads in your program, and you want to set
a breakpoint in one of them:
void function(int); // set breakpoint here.
void function(long);
(gdb) b function(i[TAB]
<all the symbols in the program that start with "i" are uselessly shown...>
This patch gets rid of the need for quoting by switching the linespec
completer to use the custom completion word point mechanism added in
the previous explicit location patch (extending it as needed), to
correctly determine the right completion word point. In the case
above, we want the completer to figure out that it's completing a
function name that starts with "function(i", and it now does.
We also want the completer to know when it's potentially completing a
source file name, for:
(gdb) break source.[TAB] -> source.c:
(gdb) break source.c: # Type line number or function name now
And we want it to know to complete label names, which it doesn't today:
(gdb) break function:lab[TAB]
etc., etc.
So what we want is for completion to grok the input string as closely
to how the linespec parser groks it.
With that in mind, the solution suggests itself - make the linespec
completer use the same parsing code as normal linespec parsing.
That's what the patch does. The old completer is replaced by one that
reuses the actual linespec parser as much as possible. This (ideally)
eliminate differences between what completion understands and actually
setting breakpoints understands by design.
The completer now offers sensible completion candidates depending on
which component of the linespec is being completed, source filename,
function, line number, expression, and (a new addition), labels. For
example, when completing the function part, we now show the full name
of the method as completion candidates, instead of showing whatever
comes after what readline considered the word break character:
(gdb) break klass::method[TAB]
klass:method1(int)
klass:method2()
If input is past the function, then we now offer keyword condidates:
(gdb) b function(int) [TAB]
if task thread
If input is past a keyword, we offer expression completion, which is
different from linespec completion:
(gdb) b main if 1 + glo[TAB]
global
(e.g., completes on types, struct data fields, etc.)
As mentioned, this teaches the linespec completer about completing
label symbols too:
(gdb) b source.c:function:lab[TAB]
A nice convenience is that when completion uniquely matches a source
name, gdb adds the ":" automatically for you:
(gdb) b filenam[TAB]
(gdb) b filename.c: # ':' auto-added, cursor right after it.
It's the little details. :-)
I worked on this patch in parallel with writing the (big) testcase
added closer to the end of the series, which exercises many many
tricky cases around quoting and whitespace insertion placement. In
general, I think it now all Just Works.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* completer.c (complete_source_filenames): New function.
(complete_address_and_linespec_locations): New function.
(location_completer): Use complete_address_and_linespec_locations.
(completion_tracker::build_completion_result): Honor the tracker's
request to suppress append.
* completer.h (completion_tracker::suppress_append_ws)
(completion_tracker::set_suppress_append_ws): New methods.
(completion_tracker::m_suppress_append_ws): New field.
(complete_source_filenames): New declaration.
* linespec.c (linespec_complete_what): New.
(struct ls_parser) <complete_what, completion_word,
completion_quote_char, completion_quote_end, completion_tracker>:
New fields.
(string_find_incomplete_keyword_at_end): New.
(linespec_lexer_lex_string): Record quote char. If in completion
mode, don't throw.
(linespec_lexer_consume_token): Advance the completion word point.
(linespec_lexer_peek_token): Save/restore completion info.
(save_stream_and_consume_token): New.
(set_completion_after_number): New.
(linespec_parse_basic): Set what to complete next depending on
token. Handle function and label completions specially.
(parse_linespec): Disable objc shortcut in completion mode. Set
what to complete next depending on token type. Skip keyword if in
completion mode.
(complete_linespec_component, linespec_complete): New.
* linespec.h (linespec_complete): Declare.
gdb/testsuite/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* gdb.base/completion.exp: Adjust expected output.
* gdb.linespec/ls-errs.exp: Don't send tab characters, now that
the completer works.
Pedro Alves [Mon, 17 Jul 2017 19:28:12 +0000 (20:28 +0100)]
Linespec lexing and C++ operators
There's some lexing code in linespec that isn't handling C++ operators
correctly. It's the usual confusion with operator< / operator<<, in
code that wants to skip past template parameters.
The linespec_lexer_lex_string change is necessary otherwise we get
this (with current master):
(gdb) break 'operator<'
unmatched quote
The need for the find_toplevel_char change was exposed by the use of
that function in the explicit location completer. Without the fix,
that completer is not able to "see" past operator< symbols, without
quoting, like:
(gdb) b -function operator<(int, int) -labe[TAB] # nothing happens
gdb incorrectly thinks "-labe" is part of the "unclosed" template
parameter list started with "<".
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* linespec.c (linespec_lexer_lex_string, find_toplevel_char):
Handle 'operator<' / 'operator<<'.
Pedro Alves [Mon, 17 Jul 2017 19:24:41 +0000 (20:24 +0100)]
Explicit locations -label completer
We're missing a completer for
(gdb) break -function func -label [TAB]
This patch adds one. Tests will be added later in the series.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* completer.c (collect_explicit_location_matches): Handle
MATCH_LABEL.
(convert_explicit_location_to_linespec): New, factored out from
...
(convert_explicit_location_to_sals): ... this.
(complete_label): New.
(linespec_complete_label, find_label_symbols_in_block): New.
(find_label_symbols): Add completion_mode parameter and adjust to
call find_label_symbols_in_block.
* linespec.h (linespec_complete_label): Declare.
Pedro Alves [Mon, 17 Jul 2017 19:21:33 +0000 (20:21 +0100)]
Rewrite/enhance explicit locations completer, parse left->right
One of the most annoying (to me) things about GDB's completion is when
you have overloads in your program, and you want to set a breakpoint
in one of them:
void function(int); // set breakpoint here.
void function(long);
(gdb) b -f func[TAB]
(gdb) b -f function( # ok, gdb completed as much as possible.
(gdb) b -f function([TAB] # show me the overloads, please.
<_all_ symbols in the program are shown...>
E.g., when debugging GDB, that'd be:
(gdb) b -f function([TAB]
(anonymous namespace)::get_global()::global pt_insn_get_offset@plt scm_new_port_table_entry
asprintf pt_pkt_alloc_decoder scm_new_port_table_entry@plt
asprintf@plt pt_pkt_alloc_decoder@plt scm_out_of_range
bt_ctf_get_char_array pt_pkt_sync_forward scm_out_of_range@plt
bt_ctf_get_char_array@plt pt_pkt_sync_forward@plt scm_putc
bt_ctf_get_uint64 pwrite scm_putc@plt
bt_ctf_get_uint64@plt pwrite@plt scm_reverse_x
bt_ctf_iter_read_event PyErr_Restore scm_reverse_x@plt
bt_ctf_iter_read_event@plt PyErr_Restore@plt scm_set_port_filename_x
<snip...>
Now that's a load of completely useless completions.
The reason GDB offers those is that the completer relies on readline
figuring out the completion word point in the input line based on the
language's word break characters, which include "(". So readline
tells the completer to complete on "", the string that is after '('.
Likewise, if you type "function(i[TAB]" to try to complete to "int",
you're out of luck. GDB shows you all the symbols in the program that
start with "i"... This makes sense for the expression completer, as
what you'd want to type is e.g., a global variable, say:
(gdb) print function(i[TAB]
but, it makes no sense when specifying a function name for a
breakpoint location.
To get around that limitation, users need to quote the function name,
like:
(gdb) b -f 'function([TAB]
function(int) function(long)
(gdb) b 'function(i[TAB]
(gdb) b 'function(int)' # now completes correctly!
Note that the quoting is only necessary for completion. Creating the
breakpoint does not require the quoting:
(gdb) b -f function(int) [RET]
Breakpoint 1 at ....
This patch removes this limitation.
(
Actually, it's a necessary patch, though not sufficient. That'll
start working correctly by the end of the series. With this patch, if try it,
you'll see:
(gdb) b -f function(i[TAB]
(gdb) b -f function
i.e., gdb strips everything after the "(". That's caused by some code
in symtab.c that'll be eliminated further down the series. These
patches are all unfortunately interrelated, which is also the reason
new tests only appear much later in the series.
But let's ignore that reality for the remainder of the description.
)
So... this patch gets rid of the need for quoting.
It does that by adding a way for a completer to control the exact
completion word point that readline should start the completion
request for, instead of letting readline try to figure it out using
the current language's word break chars array, and often failing.
In the case above, we want the completer to figure out that it's
completing a function name that starts with "function(i". It now
does.
It took me a while to figure out a way to ask readline to "use this
exact word point", and for a while I feared that it'd be impossible
with current readline (and having to rely on master readline for core
functionality is something I'd like to avoid very much). Eventually,
after several different attempts, I came up with what is described in
the comment above gdb_custom_word_point_brkchars in the patch.
With this patch, the handle_brkchars phase of the explicit location
completer advances the expected word point as it parses the input line
left to right, until it figures out exactly what we're completing,
instead of expecting readline to break the string using the word break
characters, and then having the completer heuristically fix up a bad
decision by parsing the input string backwards. This allows correctly
knowning that we're completing a symbol name after -function, complete
functions without quoting, etc.
Later, we'll make use of this same mechanims to implement a proper
linespec completer that avoids need for quoting too.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_collect_symbol_completion_matches): Add
complete_symbol_mode parameter.
* cli/cli-cmds.c (complete_command): Get the completion result out
of the handle_brkchars tracker if used a custom word point.
* completer.c: Include "linespec.h".
(enum explicit_location_match_type) <MATCH_LINE>: New enumerator.
(advance_to_expression_complete_word_point): New.
(completion_tracker::completes_to_completion_word): New.
(complete_files_symbols): Pass down
complete_symbol_mode::EXPRESSION.
(explicit_options, probe_options): New.
(collect_explicit_location_matches): Complete on the
explictit_loc->foo instead of word. Use
linespec_complete_function. Handle MATCH_LINE. Handle offering
keyword and options completions.
(backup_text_ptr): Delete.
(skip_keyword): New.
(complete_explicit_location): Remove 'word' parameter. Add
language, quoted_arg_start and quoted_arg_end parameters.
Rewrite, parsing left to right.
(location_completer): Rewrite.
(location_completer_handle_brkchars): New function.
(symbol_completer): Pass down complete_symbol_mode::EXPRESSION.
(enum complete_line_internal_reason): Adjust comments.
(completion_tracker::discard_completions): New.
(completer_handle_brkchars_func_for_completer): Handle
location_completer.
(gdb_custom_word_point_brkchars)
(gdb_org_rl_basic_quote_characters): New.
(gdb_completion_word_break_characters_throw)
(completion_find_completion_word): Handle trackers that use a
custom word point.
(completion_tracker::advance_custom_word_point_by): New.
(completion_tracker::build_completion_result): Don't rely on
readline appending the quote char.
(gdb_rl_attempted_completion_function_throw): Handle trackers that
use a custom word point.
(gdb_rl_attempted_completion_function): Restore
rl_basic_quote_characters.
* completer.h (class completion_tracker): Extend intro comment.
(completion_tracker::set_quote_char)
(completion_tracker::quote_char)
(completion_tracker::set_use_custom_word_point)
(completion_tracker::use_custom_word_point)
(completion_tracker::custom_word_point)
(completion_tracker::set_custom_word_point)
(completion_tracker::advance_custom_word_point_by)
(completion_tracker::completes_to_completion_word)
(completion_tracker::discard_completions): New methods.
(completion_tracker::m_quote_char)
(completion_tracker::m_use_custom_word_point)
(completion_tracker::m_custom_word_point): New fields.
(advance_to_expression_complete_word_point): Declare.
* f-lang.c (f_collect_symbol_completion_matches): Add
complete_symbol_mode parameter.
* language.h (struct language_defn)
<la_collect_symbol_completion_matches>: Add complete_symbol_mode
parameter.
* linespec.c (linespec_keywords): Add NULL terminator. Make extern.
(linespec_complete_function): New function.
(linespec_lexer_lex_keyword): Adjust.
* linespec.h (linespec_keywords, linespec_complete_function): New
declarations.
* location.c (find_end_quote): New function.
(explicit_location_lex_one): Add explicit_completion_info
parameter. Save quoting info. Don't throw if being called for
completion. Don't handle Ada operators here.
(is_cp_operator, skip_op_false_positives, first_of)
(explicit_location_lex_one_function): New function.
(string_to_explicit_location): Replace 'dont_throw' parameter with
an explicit_completion_info pointer parameter. Handle it. Don't
use explicit_location_lex_one to lex function names. Use
explicit_location_lex_one_function instead.
* location.h (struct explicit_completion_info): New.
(string_to_explicit_location): Replace 'dont_throw' parameter with
an explicit_completion_info pointer parameter.
* symtab.c (default_collect_symbol_completion_matches_break_on):
Add complete_symbol_mode parameter. Handle LINESPEC mode.
(default_collect_symbol_completion_matches)
(collect_symbol_completion_matches): Add complete_symbol_mode
parameter.
(collect_symbol_completion_matches_type): Pass down
complete_symbol_mode::EXPRESSION.
(collect_file_symbol_completion_matches): Add complete_symbol_mode
parameter. Handle LINESPEC mode.
* symtab.h (complete_symbol_mode): New.
(default_collect_symbol_completion_matches_break_on)
(default_collect_symbol_completion_matches)
(collect_symbol_completion_matches)
(collect_file_symbol_completion_matches): Add complete_symbol_mode
parameter.
gdb/testsuite/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* gdb.linespec/ls-errs.exp (do_test): Adjust expected output.
H.J. Lu [Mon, 17 Jul 2017 19:17:59 +0000 (12:17 -0700)]
x86-64: Limit PIC check to shared library build
When building an executable, undefined symbols are error and undefined
weak symbols are resolved to zero. We only need to check PIC for
building a shared library.
bfd/
PR ld/21782
* elf64-x86-64.c (elf_x86_64_relocate_section): Limit PIC check
to shared library.
ld/
PR ld/21782
* testsuite/ld-x86-64/pie3-nacl.d: New file.
* testsuite/ld-x86-64/pie3.d: Likewise.
* testsuite/ld-x86-64/pie3.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pie3 and pie3-nacl.
Pedro Alves [Mon, 17 Jul 2017 19:08:48 +0000 (20:08 +0100)]
Introduce strncmp_iw
The explicit locations completer patch will need a strncmp_iw
function, that to strcmp_iw like strncmp is to strcmp. This patch
implements it.
(Unit tests added a bit further down in this series will exercise
this.)
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* utils.c (enum class strncmp_iw_mode): New.
(strcmp_iw): Rename to ...
(strncmp_iw_with_mode): ... this. Add string2_len and mode
parameters. Handle them.
(strncmp_iw): New.
(strcmp_iw): Reimplement as wrapper around strncmp_iw_with_mode.
* utils.h (strncmp_iw): Declare.
(strcmp_iw): Move describing comments here.
H.J. Lu [Mon, 17 Jul 2017 17:40:18 +0000 (10:40 -0700)]
Re-indent elf_x86_64_relocate_section
* elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
Pedro Alves [Mon, 17 Jul 2017 14:51:55 +0000 (15:51 +0100)]
Introduce CP_OPERATOR_STR/CP_OPERATOR_LEN and use throughout
Move LENGTH_OF_OPERATOR from cp-support.c to cp-support.h so we can
use it elsewhere. Since there's already
CP_ANONYMOUS_NAMESPACE_STR/CP_ANONYMOUS_NAMESPACE_LEN there, follow
the same naming pattern for the new symbols.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* c-exp.y (operator_stoken): Use CP_OPERATOR_LEN and
CP_OPERATOR_STR.
* c-typeprint.c (is_type_conversion_operator): Use
CP_OPERATOR_STR.
* cp-support.c (LENGTH_OF_OPERATOR): Delete.
(cp_find_first_component_aux): Use CP_OPERATOR_STR and
CP_OPERATOR_LEN.
* cp-support.h (CP_OPERATOR_STR, CP_OPERATOR_LEN): New.
* gnu-v2-abi.c (gnuv2_is_operator_name): Use CP_OPERATOR_STR.
* gnu-v3-abi.c (gnuv3_is_operator_name): Use CP_OPERATOR_STR.
* linespec.c (linespec_lexer_lex_string): Use CP_OPERATOR_LEN and
CP_OPERATOR_STR.
* location.c: Include "cp-support.h".
(explicit_location_lex_one): Use CP_OPERATOR_LEN and
CP_OPERATOR_STR.
* symtab.c (operator_chars): Use CP_OPERATOR_STR and
CP_OPERATOR_LEN.
Pedro Alves [Mon, 17 Jul 2017 14:30:59 +0000 (15:30 +0100)]
"complete" command and completion word break characters
The linespec/locations/completer testcase added later in the series
tests every completion with both TAB completion and the "complete"
command. This exposed problems in the "complete" command, around
determining the completion word point.
First, the complete command has a too-simple approximation of what
readline's TAB-completion code does to find the completion word point.
Unfortunately, readline doesn't expose the functionality it uses
internally, so to fix this this patch copies over the relevant code,
and adjusts it a bit to better fit the use cases we need it for.
(Specifically, our version avoids relying on the
rl_word_break_characters, etc. globals, and instead takes those as
arguments.)
A following patch will want to use this function for TAB-completion
too, but the "complete" command was a good excuse to split this to a
separate patch.
Then, notice how the complete_command does not call into the completer
for the command being completed to determine the right set of word
break characters. It always uses the default set. That is fixed by
having the "complete" command call into complete_line_internal for a
full handle_brkchars phase, just TAB-completion.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* cli/cli-cmds.c (complete_command): Use a completion tracker
along with completion_find_completion_word for handle_brkchars
phase.
* completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE)
(RL_QF_BACKSLASH, RL_QF_OTHER_QUOTE): New.
(struct gdb_rl_completion_word_info): New.
(gdb_rl_find_completion_word): New.
(completion_find_completion_word): New.
* completer.h (completion_find_completion_word): Declare.
Pedro Alves [Mon, 17 Jul 2017 13:45:59 +0000 (14:45 +0100)]
Introduce class completion_tracker & rewrite completion<->readline interaction
This patch reworks the whole completion machinery, and prepares it
for later enhancements.
Adds a new "completion_tracker" class that is meant to hold everything
about the state of the current completion operation.
This class now has the responsibility of tracking the list of
completion matches, and checking whether the max completions limit has
been reached. You can look at this as this patch starting out by
C++fying the existing "completion_tracker" in symtab.c (it's just an
htab_t typedef currently), moving it to completer.h/c, and then making
it a class/generalizing/enhancing it.
Unlike with the current tracking, completion_tracker now checks
whether the limit has been reached on each completion match list
insertion. This both simplifies the max-completions handling code
(maybe_add_completion_enum is gone, for example), and is a
prerequisite for follow up patches.
The current completion_tracker is only used for symbol completions,
and the symbol code gets at the current instance via globals. This
patch cleans that up by adding a completion_tracker reference to the
signature of the completion functions, and passing the tracker around
everywhere necessary.
Then, the patch changes how the completion match list is handed over
to readline. Currently, we're using the rl_completion_entry_function
readline entry point, and the patch switches to
rl_attempted_completion_function. A following patch will want to let
GDB itself decide the common completion prefix between all matches
(what readline calls the "lowest common denominator"), instead of
having readline compute it, and that's not possible with the
rl_completion_entry_function entry point. Also,
rl_attempted_completion_function lets GDB hand over the match list to
readline as an array in one go instead of passing down matches one by
one, so from that angle it's a nicer entry point anyway.
Lastly, the patch catches exceptions around the readline entry points,
because we can't let C++ exceptions cross readline. We handle that in
the readline input entry point, but the completion entry point isn't
guarded, so GDB can abort if completion throws. E.g., in current
master:
(gdb) b -function "fun<tab>
terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR'
Aborted (core dumped)
This patch fixes that. This will be exercised in the new tests added
later on in the series.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* ada-lang.c (symbol_completion_match): Adjust comments.
(symbol_completion_add): Replace vector parameter with
completion_tracker parameter. Use it.
(ada_make_symbol_completion_list): Rename to...
(ada_collect_symbol_completion_matches): ... this. Add
completion_tracker parameter and use it.
(ada_language_defn): Adjust.
* break-catch-syscall.c (catch_syscall_completer): Adjust
prototype and work with completion_tracker instead of VEC.
* breakpoint.c (condition_completer): Adjust prototype and work
with completion_tracker instead of VEC.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Adjust to renames.
* cli/cli-cmds.c (complete_command): Rework using
completion_tracker. Catch exceptions when completing.
* cli/cli-decode.c (integer_unlimited_completer)
(complete_on_cmdlist, complete_on_enum): Adjust prototype and work
with completion_tracker instead of VEC.
* command.h (struct completion_tracker): Forward declare.
(completer_ftype, completer_handle_brkchars_ftype): Change
types.
(complete_on_cmdlist, complete_on_enum): Adjust.
* completer.c: Include <algorithm>.
(struct gdb_completer_state): New.
(current_completion): New global.
(readline_line_completion_function): Delete.
(noop_completer, filename_completer)
(filename_completer_handle_brkchars, complete_files_symbols)
(linespec_location_completer): Adjust to work with a
completion_tracker instead of a VEC.
(string_or_empty): New.
(collect_explicit_location_matches): Adjust to work with a
completion_tracker instead of a VEC.
(explicit_location_completer): Rename to ...
(complete_explicit_location): ... this and adjust to work with a
completion_tracker instead of a VEC.
(location_completer): Adjust to work with a completion_tracker
instead of a VEC.
(add_struct_fields): Adjust to work with a completion_list instead
of VEC.
(expression_completer): Rename to ...
(complete_expression): ... this and adjust to work with a
completion_tracker instead of a VEC. Use complete_files_symbols.
(expression_completer): Reimplement on top of complete_expression.
(symbol_completer): Adjust to work with a completion_tracker
instead of a VEC.
(enum complete_line_internal_reason): Add describing comments.
(complete_line_internal_normal_command): Adjust to work with a
completion_tracker instead of a VEC.
(complete_line_internal): Rename to ...
(complete_line_internal_1): ... this and adjust to work with a
completion_tracker instead of a VEC. Assert TEXT is NULL in the
handle_brkchars phase.
(new_completion_tracker): Delete.
(complete_line_internal): Reimplement as TRY/CATCH wrapper around
complete_line_internal_1.
(free_completion_tracker): Delete.
(INITIAL_COMPLETION_HTAB_SIZE): New.
(completion_tracker::completion_tracker)
(completion_tracker::~completion_tracker): New.
(maybe_add_completion): Delete.
(completion_tracker::maybe_add_completion)
(completion_tracker::add_completion)
(completion_tracker::add_completions): New.
(throw_max_completions_reached_error): Delete.
(complete_line): Adjust to work with a completion_tracker instead
of a VEC. Don't create a completion_tracker_t or check for max
completions here.
(command_completer, command_completer_handle_brkchars)
(signal_completer, reg_or_group_completer_1)
(reg_or_group_completer, default_completer_handle_brkchars):
Adjust to work with a completion_tracker.
(gdb_completion_word_break_characters_throw): New.
(gdb_completion_word_break_characters): Reimplement.
(line_completion_function): Delete.
(completion_tracker::recompute_lowest_common_denominator)
(expand_preserving_ws)
(completion_tracker::build_completion_result)
(completion_result::completion_result)
(completion_result::completion_result)
(completion_result::~completion_result)
(completion_result::completion_result)
(completion_result::release_match_list, compare_cstrings)
(completion_result::sort_match_list)
(completion_result::reset_match_list)
(gdb_rl_attempted_completion_function_throw)
(gdb_rl_attempted_completion_function): New.
* completer.h (completion_list, struct completion_result)
(class completion_tracker): New.
(complete_line): Add completion_tracker parameter.
(readline_line_completion_function): Delete.
(gdb_rl_attempted_completion_function): New.
(noop_completer, filename_completer, expression_completer)
(location_completer, symbol_completer, command_completer)
(signal_completer, reg_or_group_completer): Update prototypes.
(completion_tracker_t, new_completion_tracker)
(make_cleanup_free_completion_tracker): Delete.
(enum maybe_add_completion_enum): Delete.
(maybe_add_completion): Delete.
(throw_max_completions_reached_error): Delete.
* corefile.c (complete_set_gnutarget): Adjust to work with a
completion_tracker instead of a VEC.
* cp-abi.c (cp_abi_completer): Adjust to work with a
completion_tracker instead of a VEC.
* d-lang.c (d_language_defn): Adjust.
* disasm.c (disassembler_options_completer): Adjust to work with a
completion_tracker instead of a VEC.
* f-lang.c (f_make_symbol_completion_list): Rename to ...
(f_collect_symbol_completion_matches): ... this. Adjust to work
with a completion_tracker instead of a VEC.
(f_language_defn): Adjust.
* go-lang.c (go_language_defn): Adjust.
* guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer):
Adjust to work with a completion_tracker instead of a VEC.
* infrun.c (handle_completer): Likewise.
* interps.c (interpreter_completer): Likewise.
* interps.h (interpreter_completer): Likewise.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Adjust.
* language.h (language_defn::la_make_symbol_completion_list):
Rename to ...
(language_defn::la_collect_symbol_completion_matches): ... this
and adjust to work with a completion_tracker instead of a VEC.
* m2-lang.c (m2_language_defn): Adjust.
* objc-lang.c (objc_language_defn): Adjust.
* opencl-lang.c (opencl_language_defn): Adjust.
* p-lang.c (pascal_language_defn): Adjust.
* python/py-cmd.c (cmdpy_completer_helper): Handle NULL word.
(cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work
with a completion_tracker.
* rust-lang.c (rust_language_defn): Adjust.
* symtab.c (free_completion_list, do_free_completion_list)
(return_val, completion_tracker): Delete.
(completion_list_add_name, completion_list_add_symbol)
(completion_list_add_msymbol, completion_list_objc_symbol)
(completion_list_add_fields, add_symtab_completions): Add
completion_tracker parameter and use it.
(default_make_symbol_completion_list_break_on_1): Rename to...
(default_collect_symbol_completion_matches_break_on): ... this.
Add completion_tracker parameter and use it instead of allocating
a completion tracker here.
(default_make_symbol_completion_list_break_on): Delete old
implementation.
(default_make_symbol_completion_list): Delete.
(default_collect_symbol_completion_matches): New.
(make_symbol_completion_list): Delete.
(collect_symbol_completion_matches): New.
(make_symbol_completion_type): Rename to ...
(collect_symbol_completion_matches_type): ... this. Add
completion_tracker parameter and use it instead of VEC.
(make_file_symbol_completion_list_1): Rename to...
(collect_file_symbol_completion_matches): ... this. Add
completion_tracker parameter and use it instead of VEC.
(make_file_symbol_completion_list): Delete.
(add_filename_to_list): Use completion_list instead of a VEC.
(add_partial_filename_data::list): Now a completion_list.
(make_source_files_completion_list): Work with a completion_list
instead of a VEC.
* symtab.h: Include "completer.h".
(default_make_symbol_completion_list_break_on)
(default_make_symbol_completion_list, make_symbol_completion_list)
(make_symbol_completion_type, make_file_symbol_completion_list)
(make_source_files_completion_list): Delete.
(default_collect_symbol_completion_matches_break_on)
(default_collect_symbol_completion_matches)
(collect_symbol_completion_matches)
(collect_symbol_completion_matches_type)
(collect_file_symbol_completion_matches)
(make_source_files_completion_list): New.
* top.c (init_main): Don't install a rl_completion_entry_function
hook. Install a rl_attempted_completion_function hook instead.
* tui/tui-layout.c (layout_completer): Adjust to work with a
completion_tracker.
* tui/tui-regs.c (tui_reggroup_completer):
* tui/tui-win.c (window_name_completer, focus_completer)
(winheight_completer): Adjust to work with a completion_tracker.
* value.c: Include "completer.h".
(complete_internalvar): Adjust to work with a completion_tracker.
* value.h (complete_internalvar): Likewise.
Pedro Alves [Mon, 17 Jul 2017 11:05:03 +0000 (12:05 +0100)]
Clean up "completer_handle_brkchars" callback handling
This patch cleans up "completer_handle_brkchars" callback handling:
- Renames the function typedef to better match its intent:
completer_ftype_void -> completer_handle_brkchars_ftype
- Factors out common code in complete_line_internal handling the
"handle_brkchars" callback to a separate function.
- Centralizes all the "completer method" to "handle_brkchars method"
mapping in a single function.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* cli/cli-decode.c (set_cmd_completer_handle_brkchars): Adjust to
renames.
* cli/cli-decode.h (struct cmd_list_element) <completer>: Move
comments to completer_ftype's declaration.
<completer_handle_brkchars>: Change type to
completer_handle_brkchars_ftype.
* command.h (completer_ftype): Add describing comment and give
names to parameters.
(completer_ftype_void): Rename to ...
(completer_handle_brkchars_ftype) ... this. Add describing comment.
(set_cmd_completer_handle_brkchars): Adjust.
* completer.c (filename_completer_handle_brkchars): New function.
(complete_line_internal_normal_command): New function, factored
out from ...
(complete_line_internal): ... here.
(command_completer_handle_brkchars)
(default_completer_handle_brkchars)
(completer_handle_brkchars_func_for_completer): New functions.
* completer.h (set_gdb_completion_word_break_characters): Delete
declaration.
(completer_handle_brkchars_func_for_completer): New declaration.
* python/py-cmd.c (cmdpy_completer_handle_brkchars): Adjust to use
completer_handle_brkchars_func_for_completer.
Pedro Alves [Mon, 17 Jul 2017 10:55:42 +0000 (11:55 +0100)]
Rename make_symbol_completion_list_fn -> symbol_completer
"make_symbol_completion_list_fn" is odly named when you look at a list
of "standard" completers, like the Python/Guile completer lists
adjusted by this patch. Rename / move it to completers.h/c, for
consistency.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* completer.c (symbol_completer): New function, based on
make_symbol_completion_list_fn.
* completer.h (symbol_completer): New declaration.
* guile/scm-cmd.c (cmdscm_completers): Adjust.
* python/py-cmd.c (completers): Adjust.
* symtab.c (make_symbol_completion_list_fn): Delete.
* symtab.h (make_symbol_completion_list_fn): Delete.
* cli/cli-decode.c (add_cmd): Adjust.
Pedro Alves [Mon, 17 Jul 2017 10:28:33 +0000 (11:28 +0100)]
Fix TAB-completion + .gdb_index slowness (generalize filename_seen_cache)
Tab completion when debugging a program binary that uses GDB index is
surprisingly much slower than when GDB uses psymtabs instead. Around
1.5x/3x slower. That's surprising, because the whole point of GDB
index is to speed things up...
For example, with:
set pagination off
set $count = 0
while $count < 400
complete b string_prin # matches gdb's string_printf
printf "count = %d\n", $count
set $count = $count + 1
end
$ time ./gdb --batch -q ./gdb-with-index -ex "source script.cmd"
real 0m11.042s
user 0m10.920s
sys 0m0.042s
$ time ./gdb --batch -q ./gdb-without-index -ex "source script.cmd"
real 0m4.635s
user 0m4.590s
sys 0m0.037s
Same but with:
- complete b string_prin
+ complete b zzzzzz
to exercise the no-matches worst case, master currently gets you
something like:
with index without index
real 0m11.971s 0m8.413s
user 0m11.912s 0m8.355s
sys 0m0.035s 0m0.035s
Running gdb under perf shows 80% spent inside
maybe_add_partial_symtab_filename, and 20% spent in the lbasename
inside that.
The problem that tab completion walks over all compunit symtabs, and
for each, walks the contained file symtabs. And there a huge number
of file symtabs (each included system header, etc.) that appear in
each compunit symtab's file symtab list. As in, when debugging GDB, I
have 367381 symtabs iterated, when of those only 5371 filenames are
unique...
This was a regression from the earlier (nice) split of symtabs in
compunit symtabs + file symtabs.
The fix here is to add a cache of unique filenames per objfile so that
the walk / uniquing is only done once. There's already a abstraction
for this in symtab.c; this patch moves that code out to a separate
file and C++ifies it bit.
This makes the worst-case scenario above consistently drop to ~2.5s
(1.5s for the "string_prin" hit case), making it over 3.3x times
faster than psymtabs in this use case (7x in the "string_prin" hit
case).
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* Makefile.in (COMMON_OBS): Add filename-seen-cache.o.
* dwarf2read.c: Include "filename-seen-cache.h".
* dwarf2read.c (dwarf2_per_objfile) <filenames_cache>: New field.
(dw2_map_symbol_filenames): Build and use a filenames_seen_cache.
* filename-seen-cache.c: New file.
* filename-seen-cache.h: New file.
* symtab.c: Include "filename-seen-cache.h".
(struct filename_seen_cache, INITIAL_FILENAME_SEEN_CACHE_SIZE)
(create_filename_seen_cache, clear_filename_seen_cache)
(delete_filename_seen_cache, filename_seen): Delete, parts moved
to filename-seen-cache.h/filename-seen-cache.c.
(output_source_filename, sources_info)
(maybe_add_partial_symtab_filename)
(make_source_files_completion_list): Adjust to use
filename_seen_cache.
Pedro Alves [Mon, 17 Jul 2017 10:31:20 +0000 (11:31 +0100)]
C++ify dwarf2_per_objfile
This makes dwarf2_per_objfile a class with cdtors.
A following patch will add a non-trivial field to struct
dwarf2_per_objfile, making dwarf2_per_objfile itself non-trivial.
Since dwarf2_per_objfile is allocated in an obstack, we need to run
its cdtors manually.
Tested on x86-64 GNU/Linux.
gdb/ChangeLog:
2017-07-17 Pedro Alves <palves@redhat.com>
* dwarf2read.c (dwarf2_per_objfile): In-class initialize all
fields.
(dwarf2_per_objfile::dwarf2_per_objfile(objfile*, const
dwarf2_debug_sections*)): New.
(dwarf2_per_objfile::dwarf2_per_objfile(const
dwarf2_per_objfile&)): Declare as deleted.
(dwarf2_per_objfile::operator=): Declare as deleted.
(dwarf2_per_objfile::dwarf2_per_objfile)
(dwarf2_per_objfile::~dwarf2_per_objfile)
(dwarf2_per_objfile::free_cached_comp_units): New.
(dwarf2_has_info): dwarf2_per_objfile initialization code moved to
ctor. Call dwarf2_per_objfile's ctor manually.
(dwarf2_locate_sections): Deleted/refactored as ...
(dwarf2_per_objfile::locate_sections): ... this new method.
(free_cached_comp_units): Defer to
dwarf2_per_objfile::free_cached_comp_units.
(dwarf2_free_objfile): Call dwarf2_per_objfile's dtor manually.
Nick Clifton [Mon, 17 Jul 2017 09:51:45 +0000 (10:51 +0100)]
Correct previous fix for an absence of input files on the ar command line, so that a complaint is not issued in MRI mode.
PR 21433
* ar.c (main): Skip check for no files on the command line when
running in MRI mode.
Georg-Johann Lay [Mon, 17 Jul 2017 09:23:10 +0000 (10:23 +0100)]
Update assembler documentation on some AVR cores.
PR 21472
* config/tc-avr.c (mcu_types): Add entries for: attiny212,
attiny214, attiny412, attiny414, attiny814, attiny1614,
attiny1616, attiny1617, attiny3214, attiny3216, attiny3217.
(md_show_usage): Adjust doc for "avrxmega3".
* doc/c-avr.texi (AVR options) [-mmcu=]: Adjust doc for avrxmega3.
Add MCUs: attiny212, attiny214, attiny412, attiny414, attiny416,
attiny417, attiny814, attiny816, attiny817, attiny1614,
attiny1616, attiny1617, attiny3214, attiny3216, attiny3217.
GDB Administrator [Mon, 17 Jul 2017 00:00:58 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sun, 16 Jul 2017 02:20:52 +0000 (11:50 +0930)]
__tls_get_addr_opt GOT entries
My 2017-01-24 patch (commit
f0158f44) wrongly applied an optimization
of GOT entries for the __tls_get_addr_opt stub, to shared libraries.
When the TLS segment layout is known, as it is for the executable and
shared libraries loaded at initial program start, powerpc supports a
__tls_get_addr optimization. On the first call to __tls_get_addr for
a given __tls_index GOT entry, the DTPMOD word is set to zero and the
DTPREL word to the thread pointer offset to the thread variable. This
allows the __tls_get_addr_opt stub to return that value immediately
without making a call into glibc for any subsequent __tls_get_addr
calls using that __tls_index GOT entry.
That's all fine, but I thought I'd be clever and when the thread
variable is local, set up the GOT entry as if __tls_get_addr had
already been called. Which is good only for the executable, since ld
cannot know the TLS layout for shared libraries.
Of course, if this only applies to executables there isn't much point
to the optimization. Normally, GD and LD code in an executable will
be converted to IE or LE, losing the __tls_get_addr call. So the only
time it will trigger is with --no-tls-optimize. Thus, revert all
support.
* elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
__tls_index GOT entries when using __tls_get_addr_opt stub.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
GDB Administrator [Sun, 16 Jul 2017 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Wed, 14 Jun 2017 18:52:32 +0000 (19:52 +0100)]
gdb: Make some test names unique
Make sure all of the tests have unique names in
gdb.mi/mi-vla-fortran.exp.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-vla-fortran.exp: Make test names unique.
GDB Administrator [Sat, 15 Jul 2017 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 14 Jul 2017 14:10:39 +0000 (08:10 -0600)]
Handle sizeof(type) in Rust
PR rust/21764 notes that "sizeof" does not work correctly for all types
in Rust. The bug turns out to be an error in the conversion of the AST
to gdb expressions. This patch fixes the bug and also avoids generating
incorrect expressions in another case.
Tested on the buildbot. I'm checking this in.
2017-07-14 Tom Tromey <tom@tromey.com>
PR rust/21764:
* rust-exp.y (convert_ast_to_expression): Add "want_type"
parameter.
<UNOP_SIZEOF>: Split into separate case.
<UNOP_VAR_VALUE>: Handle want_type. Add error case.
2017-07-14 Tom Tromey <tom@tromey.com>
PR rust/21764:
* gdb.rust/simple.exp: Add tests.
Tom Tromey [Thu, 13 Jul 2017 21:03:27 +0000 (15:03 -0600)]
Make gdb.lookup_typename work for Rust types
PR rust/21763 points out that gdb.lookup_typename does not work properly
for (some) Rust types. I tracked this down to a missing case in
symbol_matches_domain.
Tested by the buildbot.
2017-07-14 Tom Tromey <tom@tromey.com>
PR rust/21763:
* symtab.c (symbol_matches_domain): Add language_rust to special
case.
* rust-exp.y (convert_ast_to_expression) <OP_VAR_VALUE>: Don't
treat LOC_TYPEDEF symbols as variables.
2017-07-14 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.exp: Add regression test for PR rust/21763.
Pedro Alves [Fri, 14 Jul 2017 15:50:35 +0000 (16:50 +0100)]
Fix gdb.base/completion.exp with --target_board=dwarf4-gdb-index
This is the same patch as posted at
<https://sourceware.org/ml/gdb-patches/2017-02/msg00644.html>, with
the test at
<https://sourceware.org/ml/gdb-patches/2017-02/msg00687.html> squashed
in.
This patch fixes:
-FAIL: gdb.base/completion.exp: tab complete break break.c:ma (timeout)
-FAIL: gdb.base/completion.exp: complete break break.c:ma
+PASS: gdb.base/completion.exp: tab complete break break.c:ma
+PASS: gdb.base/completion.exp: delete breakpoint for tab complete break break.c:ma
+PASS: gdb.base/completion.exp: complete break break.c:ma
When run with --target_board=dwarf4-gdb-index.
The issue here is that make_file_symbol_completion_list_1, used when
completing a symbol restricted to a given source file, uses
lookup_symtab to look up the symtab with the given name, and search
for matching symbols inside. This assumes that there's only one
symtab for the given source file. This is an incorrect assumption
with (for example) -fdebug-types-section, where we'll have an extra
extra symtab containing the types. lookup_symtab finds that symtab,
and inside that symtab there are no functions...
gdb/ChangeLog:
2017-07-14 Pedro Alves <palves@redhat.com>
* symtab.c (make_file_symbol_completion_list_1): Iterate over
symtabs matching all symtabs with SRCFILE as file name instead of
only considering the first hit, with lookup_symtab.
gdb/testsuite/ChangeLog:
2017-07-14 Pedro Alves <palves@redhat.com>
* gdb.linespec/base/one/thefile.cc (z1): New function.
* gdb.linespec/base/two/thefile.cc (z2): New function.
* gdb.linespec/linespec.exp: Add tests.
Ravi Bangoria [Fri, 14 Jul 2017 07:56:27 +0000 (13:26 +0530)]
binutils/objdump: Fix disassemble for huge elf sections
When elf section size is beyond unsigned int max value, objdump fails
to disassemble from that section. Ex on PowerPC,
$ objdump -h /proc/kcore
Idx Name Size VMA
4 load2
100000000 c000000000000000
Here, size of load2 section is 0x100000000. Also note that, 0xc00....
address range is kernel space for PowerPC. Now let's try to disassemble
do_sys_open() using /proc/kcore.
$ cat /proc/kallsyms | grep -A1 -w do_sys_open
c00000000036c000 T do_sys_open
c00000000036c2d0 T SyS_open
Before patch:
$ objdump -d --start-address=0xc00000000036c000 --stop-address=0xc00000000036c2d0 /proc/kcore
/proc/kcore: file format elf64-powerpcle
Disassembly of section load2:
c00000000036c000 <load2+0x36c000>:
c00000000036c000: Address 0xc00000000036c000 is out of bounds.
Fix this by changing type of 'buffer_length' from unsigned int to
size_t. After patch:
$ objdump -d --start-address=0xc00000000036c000 --stop-address=0xc00000000036c2d0 /proc/kcore
/proc/kcore: file format elf64-powerpcle
Disassembly of section load2:
c00000000036c000 <load2+0x36c000>:
c00000000036c000: fc 00 4c 3c addis r2,r12,252
c00000000036c004: 00 53 42 38 addi r2,r2,21248
c00000000036c008: a6 02 08 7c mflr r0
include/
* dis-asm.h (struct disassemble_info): Change type of buffer_length
field to size_t.
opcodes/
* dis-buf.c (buffer_read_memory): Change type of end_addr_offset,
max_addr_offset and octets variables to size_t.
Alan Modra [Fri, 14 Jul 2017 09:07:26 +0000 (18:37 +0930)]
ppc32 tlsopt tests
These all were odd in that they used r13 as the GOT pointer. That
didn't matter for the purpose of testing, but would never occur in
practice. Also, the tlsopt5 tests could have their global dynamic
sequences optimized to initial exec, so link with -shared.
* testsuite/ld-powerpc/powerpc.exp: Add -shared to tlsop5 tests.
* testsuite/ld-powerpc/tlsopt5.d: Adjust.
* testsuite/ld-powerpc/tlsopt1_32.s: Use r30 as GOT pointer.
* testsuite/ld-powerpc/tlsopt2_32.s: Likewise.
* testsuite/ld-powerpc/tlsopt3_32.s: Likewise.
* testsuite/ld-powerpc/tlsopt4_32.s: Likewise.
* testsuite/ld-powerpc/tlsopt5_32.s: Rewrite.
* testsuite/ld-powerpc/tlsopt1_32.d: Adjust.
* testsuite/ld-powerpc/tlsopt2_32.d: Adjust.
* testsuite/ld-powerpc/tlsopt3_32.d: Adjust.
* testsuite/ld-powerpc/tlsopt5_32.d: Adjust.
Maciej W. Rozycki [Fri, 14 Jul 2017 10:53:08 +0000 (11:53 +0100)]
PR ld/21529: Use a linker script to limit output with the test case
Complement commit
d9409498813c ("Add a testcase for PR ld/21529") and
use a linker script to prevent an inter-segment gap arranged by the
default linker script associated with some targets such as `rx-elf':
$ ld -e main -o tmpdir/dump-elf tmpdir/pr21529.o
$ readelf -l tmpdir/dump-elf
Elf file type is EXEC (Executable file)
Entry point 0x10000004
There are 2 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x001000 0x10000000 0x10000000 0x00008 0x00008 R E 0x1000
LOAD 0x001ffc 0xbffffffc 0xbffffffc 0x00004 0x00004 RW 0x1000
Section to Segment mapping:
Segment Sections...
00 .text
01 .stack
$
and converted to padding with the use of the binary BFD for output from
producing unreasonably large files.
ld/
* testsuite/ld-unique/pr21529.ld: New test linker script.
* testsuite/ld-unique/pr21529.d: Use it.
Simon Marchi [Fri, 14 Jul 2017 10:47:40 +0000 (12:47 +0200)]
ax-gdb: Remove more unused arguments
gdb/ChangeLog:
* ax-gdb.c (gen_aggregate_elt_ref): Remove operand_name and
operator_name parameters.
(gen_expr): Update function call.
Simon Marchi [Fri, 14 Jul 2017 10:47:40 +0000 (12:47 +0200)]
ax-gdb: Remove unnecessary gdbarch parameters
In multiple places, we pass the gdbarch as an argument to some
functions, even though it's available in the agent_expr structure also
passed to the same functions. Remove these arguments and replace their
usage with accesses to agent_expr::gdbarch.
gdb/ChangeLog:
* dwarf2loc.h (dwarf2_compile_expr_to_ax): Remove gdbarch
parameter.
* symtab.h (struct symbol_computed_ops::tracepoint_var_ref):
Likewise.
* dwarf2loc.c (dwarf2_compile_expr_to_ax): Remove gdbarch
parameter, use agent_expr::gdbarch instead, update function
calls.
(locexpr_tracepoint_var_ref): Likewise.
(loclist_tracepoint_var_ref): Likewise.
* ax-gdb.c (gen_trace_static_fields): Likewise.
(gen_traced_pop): Likewise.
(gen_frame_args_address): Likewise.
(gen_frame_locals_address): Likewise.
(gen_var_ref): Likewise.
(gen_struct_ref_recursive): Likewise.
(gen_static_field): Likewise.
(gen_maybe_namespace_elt): Likewise.
(gen_expr): Likewise.
(gen_trace_for_var): Likewise.
(gen_trace_for_expr): Likewise.
(gen_trace_for_return_address): Likewise.
Simon Marchi [Fri, 14 Jul 2017 10:47:39 +0000 (12:47 +0200)]
ax-gdb: Remove two unused agent_expr *ax parameters
gdb/ChangeLog:
* ax-gdb.c (gen_deref, gen_address_of): Remove unused ax
parameter.
(gen_struct_ref, gen_expr, gen_expr_binop_rest): Update call.
Simon Marchi [Fri, 14 Jul 2017 10:47:39 +0000 (12:47 +0200)]
ax-gdb: Use ax->gdbarch instead of exp->gdbarch, remove unused parameters
In many ax generation functions, the "expression *exp" parameter is only
used to access the gdbarch. The same value can be found in the
"agent_expr *ax" parameter, which needs to be passed in any case. By
using ax->gdbarch instead of exp->gdbarch, we can avoid passing exp in
many of these functions.
gdb/ChangeLog:
* ax-gdb.c (gen_usual_unary): Remove exp parameter, get gdbarch
from ax, update calls.
(gen_usual_arithmetic): Likewise.
(gen_integral_promotions): Likewise.
(gen_bitfield_ref): Likewise.
(gen_primitive_field): Likewise.
(gen_struct_ref_recursive): Likewise.
(gen_struct_ref): Likewise.
(gen_maybe_namespace_elt): Likewise.
(gen_struct_elt_for_reference): Likewise.
(gen_namespace_elt): Likewise.
(gen_aggregate_elt_ref): Likewise.
(gen_expr): Get gdbarch from ax, update calls.
(gen_expr_binop_rest): Likewise.
GDB Administrator [Fri, 14 Jul 2017 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Thu, 13 Jul 2017 21:40:22 +0000 (14:40 -0700)]
Add RDMA support for falkot/qdf24xx.
gas/
* config/tc-arch64.c (aarch64_cpus): Add AARCH64_FEATURE_RDMA to
falkor and qdf24xx entries.
Andrew Burgess [Thu, 13 Jul 2017 19:55:11 +0000 (20:55 +0100)]
gdb: Fix more parameter passing to mi_create_breakpoint
In the test gdb.mi/mi-vla-fortran.exp the parameters passed to
mi_create_breakpoint are passed in the wrong order. By good luck the
tests still passes, however the wrong test name is used. All fixed in
this commit.
A previous commit fixed most of these, but I missed this last one.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-vla-fortran.exp: Correct even more parameter passing
to mi_create_breakpoint.
Pedro Alves [Thu, 13 Jul 2017 19:56:42 +0000 (20:56 +0100)]
Fix x86-64 GNU/Linux crashes
Ref: https://sourceware.org/ml/gdb-patches/2017-07/msg00162.html
Debugging x86-64 GNU/Linux programs currently crashes GDB in
tdesc_use_registers during gdbarch initialization:
Program received signal SIGSEGV, Segmentation fault.
0x0000000001093eaf in htab_remove_elt_with_hash (htab=0x2ef9fa0, element=0x26af960, hash=
557151073) at src/libiberty/hashtab.c:728
728 if (*slot == HTAB_EMPTY_ENTRY)
(top-gdb) p slot
$1 = (void **) 0x0
(top-gdb) bt
#0 0x0000000001093eaf in htab_remove_elt_with_hash (htab=0x2ef9fa0, element=0x26af960, hash=
557151073) at src/libiberty/hashtab.c:728
#1 0x0000000001093e79 in htab_remove_elt (htab=0x2ef9fa0, element=0x26af960) at src/libiberty/hashtab.c:714
#2 0x00000000009121b0 in tdesc_use_registers (gdbarch=0x3001240, target_desc=0x2659cb0, early_data=0x2881cb0)
at src/gdb/target-descriptions.c:1328
#3 0x000000000047c93e in i386_gdbarch_init (info=..., arches=0x0) at src/gdb/i386-tdep.c:8634
#4 0x0000000000818d5f in gdbarch_find_by_info (info=...) at src/gdb/gdbarch.c:5394
#5 0x00000000007198a8 in set_gdbarch_from_file (abfd=0x2f48250) at src/gdb/arch-utils.c:618
#6 0x00000000007f21cb in exec_file_attach (filename=0x7fffffffddb0 "/home/pedro/gdb/tests/threads", from_tty=1) at src/gdb/exec.c:380
#7 0x0000000000865c18 in catch_command_errors_const (command=0x7f1d83 <exec_file_attach(char const*, int)>, arg=0x7fffffffddb0 "/home/pedro/gdb/tests/threads",
from_tty=1) at src/gdb/main.c:403
#8 0x00000000008669cf in captured_main_1 (context=0x7fffffffd860) at src/gdb/main.c:1035
#9 0x0000000000866de2 in captured_main (data=0x7fffffffd860) at src/gdb/main.c:1142
#10 0x0000000000866e24 in gdb_main (args=0x7fffffffd860) at src/gdb/main.c:1160
#11 0x000000000041312d in main (argc=3, argv=0x7fffffffd968) at src/gdb/gdb.c:32
The direct cause of the crash is that we tried to remove an element
from the hash which supposedly exists, but does not. (htab_remove_elt
shouldn't really crash in this case, but that's secondary.)
The real problem is that early_data passed to tdesc_use_registers
includes regs from a target description that is not the target_desc,
which violates its assumptions. The registers in question are the
fs_base/gs_base registers, added by amd64_init_abi:
tdesc_numbered_register (feature, tdesc_data_segments,
AMD64_FSBASE_REGNUM, "fs_base");
tdesc_numbered_register (feature, tdesc_data_segments,
AMD64_GSBASE_REGNUM, "gs_base");
and that happens because amd64_linux_init_abi uses amd64_init_abi as
helper, but they don't coordinate on which fallback tdesc to use.
amd64_init_abi does:
if (! tdesc_has_registers (tdesc))
tdesc = tdesc_amd64;
and then adds the fs_base/gs_base registers of the "tdesc_amd64" tdesc
to the tdesc_arch_data.
After amd64_init_abi returns, amd64_linux_init_abi does:
if (! tdesc_has_registers (tdesc))
tdesc = tdesc_amd64_linux;
tdep->tdesc = tdesc;
and we end up tdesc_amd64_linux installed in tdep->tdesc.
The fix is to make sure that amd64_linux_init_abi and amd64_init_abi
agree on default tdesc, by adding a "default tdesc" parameter to
amd64_init_abi, instead of having amd64_init_abi hardcode a default.
With this, amd64_init_abi creates the fs_base/gs_base registers using
the tdesc_amd64_linux tdesc.
Tested on x86-64 GNU/Linux, -m64. I don't have an x32 setup handy.
Thanks to John Baldwin, Yao Qi and Simon Marchi for the investigation.
gdb/ChangeLog:
2017-07-13 Pedro Alves <palves@redhat.com>
* amd64-darwin-tdep.c (x86_darwin_init_abi_64): Pass tdesc_amd64
as default tdesc.
* amd64-dicos-tdep.c (amd64_dicos_init_abi):
* amd64-fbsd-tdep.c (amd64fbsd_init_abi):
* amd64-linux-tdep.c (amd64_linux_init_abi): Pass
tdesc_amd64_linux as default tdesc. Get final tdesc from the
tdep.
(amd64_x32_linux_init_abi): Pass tdesc_x32_linux as default tdesc.
Get final tdesc from the tdep.
* amd64-nbsd-tdep.c (amd64nbsd_init_abi): Pass tdesc_amd64 as
default tdesc.
* amd64-obsd-tdep.c (amd64obsd_init_abi): Likewise.
* amd64-sol2-tdep.c (amd64_sol2_init_abi): Likewise.
* amd64-tdep.c (amd64_init_abi): Add 'default_tdesc' parameter.
Use it as default tdesc.
(amd64_x32_init_abi): Add 'default_tdesc' parameter, and pass it
down to amd_init_abi. No longer handle fallback tdesc here.
* amd64-tdep.h (tdesc_x32): Declare.
(amd64_init_abi, amd64_x32_init_abi): Add 'default_tdesc'
parameter.
* amd64-windows-tdep.c (amd64_windows_init_abi): Pass tdesc_amd64
as default tdesc.
Andrew Burgess [Wed, 14 Jun 2017 18:47:52 +0000 (19:47 +0100)]
gdb: Fix parameter passing to mi_create_breakpoint
In the test gdb.mi/mi-vla-fortran.exp the parameters passed to
mi_create_breakpoint are passed in the wrong order. By good luck the
tests still passes, however the wrong test name is used. All fixed in
this commit.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-vla-fortran.exp: Correct parameter passing to
mi_create_breakpoint.
Andreas Arnez [Thu, 13 Jul 2017 18:17:03 +0000 (20:17 +0200)]
S390: Add record/replay support for arch12 instructions
Support record/replay of the z/Architecture instructions that were
introduced with arch12.
gdb/ChangeLog:
* s390-linux-tdep.c (s390_process_record): Add support for
instructions new in arch12.
H.J. Lu [Thu, 13 Jul 2017 15:10:57 +0000 (08:10 -0700)]
Always delete $testarchive first
Always delete $testarchive first so that it exists only when it is
supported,
* testsuite/binutils-all/objdump.exp: Always delete $testarchive
first.
GDB Administrator [Thu, 13 Jul 2017 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Cary Coutant [Wed, 12 Jul 2017 14:24:37 +0000 (07:24 -0700)]
Add missing gold/ChangeLog entry.
Alan Modra [Wed, 12 Jul 2017 12:49:58 +0000 (22:19 +0930)]
Update PO files
bfd/
* po/es.po: Update from translationproject.org/latest/bfd/.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/ja.po: Likewise.
* po/ro.po: Likewise.
* po/ru.po: Likewise.
* po/sr.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.
* po/hr.po: New file from translationproject.org.
* configure.ac (ALL_LINGUAS): Add hr. Sort.
* configure: Regenerate.
binutils/
* po/bg.po: Update from translationproject.org/latest/binutils/.
* po/ca.po: Likewise.
* po/da.po: Likewise.
* po/es.po: Likewise.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/hr.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/ja.po: Likewise.
* po/ro.po: Likewise.
* po/ru.po: Likewise.
* po/sk.po: Likewise.
* po/sr.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.
* po/zh_TW.po: Likewise.
gas/
* po/es.po: Update from translationproject.org/latest/gas/.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/ja.po: Likewise.
* po/ru.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/zh_CN.po: Likewise.
gold/
* po/es.po: Update from translationproject.org/latest/gold/.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.
* po/ja.po: New file from translationproject.org.
* po/sv.po: Likewise.
* po/uk.po: Likewise.
gprof/
* po/bg.po: Update from translationproject.org/latest/gprof/.
* po/da.po: Likewise.
* po/de.po: Likewise.
* po/eo.po: Likewise.
* po/es.po: Likewise.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/ga.po: Likewise.
* po/hu.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/ja.po: Likewise.
* po/ms.po: Likewise.
* po/nl.po: Likewise.
* po/pt_BR.po: Likewise.
* po/ro.po: Likewise.
* po/ru.po: Likewise.
* po/sr.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
ld/
* po/bg.po: Update from translationproject.org/latest/ld/.
* po/da.po: Likewise.
* po/es.po: Likewise.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/ja.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.
* po/zh_TW.po: Likewise.
* po/de.po: New file from translationproject.org.
* po/ru.po: Likewise.
* configure.ac (ALL_LINGUAS): Add de, ru. Sort.
* configure: Regenerate.
opcodes/
* po/da.po: Update from translationproject.org/latest/opcodes/.
* po/de.po: Likewise.
* po/es.po: Likewise.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/nl.po: Likewise.
* po/pt_BR.po: Likewise.
* po/ro.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.
Nick Clifton [Wed, 12 Jul 2017 11:17:02 +0000 (12:17 +0100)]
Fix compile time warnings building the binutils with gcc 7.1.1.
bfd * elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
plt_name buffer.
(elf_xtensa_get_gotplt_section): Increase length of got_name
buffer.
* mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
default return of FALSE.
* mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
default return of FALSE.
binutils * dwarf.c (dwarf_vmatoa_1): Do not pass a NULL string pointer to
sprintf.
* srconv.c (walk_tree_type): Initialise the spare field of the
IT_dty structure.
gas * config/tc-pru.c (md_assemble): Add continue statement after
handling 'E' operand character.
* config/tc-v850.c (md_assemble): Initialise the 'insn' variable.
Alan Modra [Wed, 12 Jul 2017 09:52:30 +0000 (19:22 +0930)]
rs6000 testsuite update
* testsuite/ld-scripts/align.exp: Exclude powerpc*-*-aix*.
* testsuite/ld-scripts/assign-loc.d: Likewise.
* testsuite/ld-scripts/defined3.d: Likewise.
* testsuite/ld-scripts/defined4.d: Likewise.
* testsuite/ld-scripts/defined5.d: Likewise.
* testsuite/ld-scripts/expr2.d: Likewise.
* testsuite/ld-scripts/provide.exp: Likewise.
* testsuite/ld-scripts/sane1.d: Likewise.
* testsuite/ld-scripts/size.exp: Likewise.
* testsuite/ld-scripts/defined2.d: Don't xfail rs6000-*-aix*.
Alan Modra [Sun, 9 Jul 2017 13:41:32 +0000 (23:11 +0930)]
bfd_error_handler bfd_vma and bfd_size_type args
This patch uses the new %L _bfd_error_handler support for printing
bfd_vma arguments, and fixes a many other format and/or argument
errors in error messages.
bfd/
* binary.c (binary_set_section_contents): Don't print filepos in
error message.
(coff_write_object_contents): Cast size_t for error message.
(coff_slurp_line_table): Don't use bfd_vma symndx.
(coff_slurp_reloc_table): Remove unneeded cast.
* dwarf2.c (read_section): Cast bfd_int64_t to long long for
error message.
(find_abstract_instance_name): Likewise.
* elf32-arm.c (arm_type_of_stub): Correct error arg order.
(bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
(elf32_arm_check_relocs): Make r_symndx an int.
* elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
format string.
* elf32-metag.c (elf_metag_relocate_section): Delete extra error
message arg.
* elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
error message.
* elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
* elf32-s390.c (elf_s390_check_relocs): Likewise.
* elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
* elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
* elf64-s390.c (elf_s390_check_relocs): Likewise.
* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
* elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
* elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
* elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
and use %lu for error message.
* elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
* mmo.c (mmo_scan): Make stab_loc a file_ptr. Cast expression for
error message.
* elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
in error message.
(elf32_arm_final_link_relocate): Likewise.
* coff-arm.c (bfd_arm_process_before_allocation): Likewise.
* coffcode.h (styp_to_sec_flags): Likewise.
* cofflink.c (_bfd_coff_write_global_sym): Likewise.
* ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
* elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
* elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
(elf32_bfin_merge_private_bfd_data): Likewise.
* elf32-cris.c (cris_elf_relocate_section): Likewise.
* elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
* elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
(i370_elf_relocate_section): Likewise.
* elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
* elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
* elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
* elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
* elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
* elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
* elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
(_bfd_mips_elf_merge_private_bfd_data): Likewise.
* ieee.c (ieee_write_id, read_id): Likewise.
* mach-o.c (bfd_mach_o_write_contents): Likewise.
(bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
(bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
(bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
* stabs.c (_bfd_link_section_stabs): Likewise.
* coff-arm.c (coff_arm_relocate_section): Use L modifier in error
format.
* coff-mcore.c (coff_mcore_relocate_section): Likewise.
* coff-ppc.c (coff_ppc_relocate_section): Likewise.
* coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
* coff-sh.c (sh_relax_section): Likewise.
(sh_relax_delete_bytes, sh_swap_insns): Likewise.
* coff-tic80.c (coff_tic80_relocate_section): Likewise.
* coffcode.h (coff_slurp_reloc_table): Likewise.
* coffgen.c (_bfd_coff_get_external_symbols): Likewise.
(_bfd_coff_read_string_table): Likewise.
* cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
* compress.c (bfd_get_full_section_contents): Likewise.
* dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
* elf.c (bfd_elf_string_from_elf_section): Likewise.
* elf32-arc.c (arc_special_overflow_checks): Likewise.
* elf32-arm.c (elf32_arm_tls_relax): Likewise.
(elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
(elf32_arm_write_section): Likewise.
* elf32-bfin.c (bfin_relocate_section): Likewise.
(bfinfdpic_relocate_section): Likewise.
* elf32-hppa.c (hppa_build_one_stub): Likewise.
(final_link_relocate, elf32_hppa_relocate_section): Likewise.
* elf32-i386.c (elf_i386_tls_transition): Likewise.
(elf_i386_relocate_section): Likewise.
* elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
* elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-metag.c (elf_metag_relocate_section): Likewise.
* elf32-nds32.c (unrecognized_reloc_msg): Likewise.
(nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
(nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
(nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
(nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
(nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
(nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
(nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
(nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
* elf32-rx.c (UNSAFE_FOR_PID): Likewise.
* elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
* elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
* elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
* elf32-sh.c (sh_elf_relax_section): Likewise.
(sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
(sh_elf_relocate_section): Likewise.
* elf32-sh64.c (shmedia_prepare_reloc): Likewise.
* elf32-spu.c (spu_elf_relocate_section): Likewise.
* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
* elf32-v850.c (v850_elf_relax_section): Likewise.
* elf32-vax.c (elf_vax_check_relocs): Likewise.
(elf_vax_relocate_section): Likewise.
* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
(extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
(compute_text_actions, compute_ebb_proposed_actions): Likewise.
(do_fix_for_relocatable_link): Likewise.
* elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
(elf64_alpha_relax_with_lituse): Likewise.
* elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
(elf_hppa_final_link_relocate): Likewise.
* elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
(elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
(elf64_vms_link_add_object_symbols): Likewise.
* elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
(mmix_final_link_relocate): Likewise.
* elf64-s390.c (invalid_tls_insn): Likewise.
(elf_s390_relocate_section): Likewise.
* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
(elf_x86_64_relocate_section): Likewise.
* elfcode.h (elf_slurp_symbol_table): Likewise.
* elfcore.h (elf_core_file_p): Likewise.
* elflink.c (elf_link_read_relocs_from_section): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
(elfNN_aarch64_relocate_section): Likewise.
* elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
(elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
* elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
(_bfd_mips_elf_relocate_section): Likewise.
(_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
* ieee.c (ieee_slurp_external_symbols): Likewise.
* ihex.c (ihex_write_object_content): Likewise.
* mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
* merge.c (_bfd_merged_section_offset): Likewise.
* mmo.c (mmo_write_loc_chunk): Likewise.
(mmo_write_object_contents): Likewise.
* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
* stabs.c (_bfd_link_section_stabs): Likewise.
* xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
ld/
* testsuite/ld-arc/nps-1b.err: Update.
* testsuite/ld-x86-64/ilp32-11.d: Update.
GDB Administrator [Wed, 12 Jul 2017 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in
Han Shen [Mon, 10 Jul 2017 22:23:05 +0000 (15:23 -0700)]
Fixing for PR gold/21491 - Errata workaround can produce broken images.
The problem is caused by the fact that gold is relocating the stubs
for an entire output section when it processes the relocations for a
particular input section that happened to be designated as the stub
table "owner". The Relocate_task for that input section may or may not
run before the Relocate_task for another input section that contains
the code that needs the erratum fix, but doesn't "own" the stub
table. If it runs before (or might even race with) that other task, it
ends up with a copy of the unrelocated original instruction.
In other words - when calling fix_errata() from
do_relocate_sections(), gold is going through the list of errata stubs
that are associated only with that object. This routine updates the
stored original instruction and replaces it in the output view with a
branch to the stub. Later, as gold is going through the object file's
input sections, it then checks for stub tables "owned" by each input
section, and writes out all the stubs from that stub table, regardless
of what object file each stub is associated with.
Fixed by relocating the erratum stub only after the corresponding
errata spot is fixed. That is to have fix_errata() call
Stub_table::relocate_erratum_stub() for each stub.
gold/ChangeLog
2017-07-06 Han Shen <shenhan@google.com>
PR gold/21491
* aarch64.cc (Erratum_stub::invalidate_erratum_stub): New method.
(Erratum_stub::is_invalidated_erratum_stub): New method.
(Stub_table::relocate_reloc_stub): Renamed from "relocate_stub".
(Stub_table::relocate_reloc_stubs): Renamed from "relocate_stubs".
(Stub_table::relocate_erratum_stub): New method.
(AArch64_relobj::fix_errata_and_relocate_erratum_stubs): Renamed from
"fix_errata".
(Target_aarch64::relocate_reloc_stub): Renamed from "relocate_stub".
John Baldwin [Tue, 27 Jun 2017 01:18:19 +0000 (18:18 -0700)]
Support the fs_base and gs_base registers on FreeBSD/amd64 native processes.
Use ptrace operations to fetch and store the fs_base and gs_base registers
for FreeBSD/amd64 processes. Note that FreeBSD does not currently store the
value of these registers in core dumps, so these registers are only
available when inspecting a running process.
gdb/ChangeLog:
* amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Use
PT_GETFSBASE and PT_GETGSBASE.
(amd64bsd_store_inferior_registers): Use PT_SETFSBASE and
PT_SETGSBASE.
John Baldwin [Tue, 27 Jun 2017 01:14:43 +0000 (18:14 -0700)]
Include the fs_base and gs_base registers in amd64 target descriptions.
This permits these registers to be used with non-Linux targets.
gdb/ChangeLog:
* features/Makefile (amd64.dat, amd64-avx.dat, amd64-mpx.dat)
(amd64-avx-mpx.dat, amd64-avx-avx512.dat)
(amd64-avx-mpx-avx512-pku.dat): Add i386/64bit-segments.xml in
those rules.
* features/i386/amd64-avx-avx512.xml: Add 64bit-segments.xml.
* features/i386/amd64-avx-mpx-avx512-pku.xml: Add 64bit-segments.xml.
* features/i386/amd64-avx-mpx.xml: Add 64bit-segments.xml.
* features/i386/amd64-avx.xml: Add 64bit-segments.xml.
* features/i386/amd64-mpx.xml: Add 64bit-segments.xml.
* features/i386/amd64.xml: Add 64bit-segments.xml.
* features/i386/amd64-avx-avx512.c: Regenerated.
* features/i386/amd64-avx-mpx-avx512-pku.c: Regenerated.
* features/i386/amd64-avx-mpx.c: Regenerated.
* features/i386/amd64-avx.c: Regenerated.
* features/i386/amd64-mpx.c: Regenerated.
* features/i386/amd64.c: Regenerated.
* regformats/i386/amd64-avx-avx512.dat: Regenerated.
* regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerated.
* regformats/i386/amd64-avx-mpx.dat: Regenerated.
* regformats/i386/amd64-avx.dat: Regenerated.
* regformats/i386/amd64-mpx.dat: Regenerated.
* regformats/i386/amd64.dat: Regenerated.
H.J. Lu [Tue, 11 Jul 2017 15:37:48 +0000 (08:37 -0700)]
Support single digit GCC version
On Fedora 26, "g++ -dumpversion" displays "7", instead of "7.1.1".
Update selective.exp to support single digit GCC version. Also
remove duplicated [4-9] version check.
* testsuite/ld-selective/selective.exp: Support single digit
GCC version.
Andreas Schwab [Tue, 11 Jul 2017 15:36:35 +0000 (17:36 +0200)]
Add missing newlines in readelf -n output
* readelf.c (process_note): Print newline after description data
in narrow mode.
(print_core_note): Print newline if nothing was printed in wide
mode.
Alan Modra [Tue, 11 Jul 2017 13:08:54 +0000 (22:38 +0930)]
ppc32 use of %x in einfo format, typo fix
* elf32-ppc.c (ppc_elf_relocate_section): Fix typo.
Jiong Wang [Tue, 11 Jul 2017 10:11:09 +0000 (11:11 +0100)]
[AArch64] Use "#pass" instead of "#..." to filter multiple lines
ld/
* testsuite/ld-aarch64/dt_textrel.d: Use "#pass" instead of ".*" to
filter out remaining lines.
Alan Modra [Tue, 11 Jul 2017 09:48:47 +0000 (19:18 +0930)]
ppc32 use of %x in einfo format
einfo doesn't support %x.
* elf32-ppc.c (ppc_elf_relocate_section): Emit "unexpected
instruction" error using _bfd_error_handler, not einfo.
Alan Modra [Tue, 11 Jul 2017 09:43:08 +0000 (19:13 +0930)]
Mark generated cgen files read-only
* cgen.sh: Mark generated files read-only.
* epiphany-asm.c: Regenerate.
* epiphany-desc.c: Regenerate.
* epiphany-desc.h: Regenerate.
* epiphany-dis.c: Regenerate.
* epiphany-ibld.c: Regenerate.
* epiphany-opc.c: Regenerate.
* epiphany-opc.h: Regenerate.
* fr30-asm.c: Regenerate.
* fr30-desc.c: Regenerate.
* fr30-desc.h: Regenerate.
* fr30-dis.c: Regenerate.
* fr30-ibld.c: Regenerate.
* fr30-opc.c: Regenerate.
* fr30-opc.h: Regenerate.
* frv-asm.c: Regenerate.
* frv-desc.c: Regenerate.
* frv-desc.h: Regenerate.
* frv-dis.c: Regenerate.
* frv-ibld.c: Regenerate.
* frv-opc.c: Regenerate.
* frv-opc.h: Regenerate.
* ip2k-asm.c: Regenerate.
* ip2k-desc.c: Regenerate.
* ip2k-desc.h: Regenerate.
* ip2k-dis.c: Regenerate.
* ip2k-ibld.c: Regenerate.
* ip2k-opc.c: Regenerate.
* ip2k-opc.h: Regenerate.
* iq2000-asm.c: Regenerate.
* iq2000-desc.c: Regenerate.
* iq2000-desc.h: Regenerate.
* iq2000-dis.c: Regenerate.
* iq2000-ibld.c: Regenerate.
* iq2000-opc.c: Regenerate.
* iq2000-opc.h: Regenerate.
* lm32-asm.c: Regenerate.
* lm32-desc.c: Regenerate.
* lm32-desc.h: Regenerate.
* lm32-dis.c: Regenerate.
* lm32-ibld.c: Regenerate.
* lm32-opc.c: Regenerate.
* lm32-opc.h: Regenerate.
* lm32-opinst.c: Regenerate.
* m32c-asm.c: Regenerate.
* m32c-desc.c: Regenerate.
* m32c-desc.h: Regenerate.
* m32c-dis.c: Regenerate.
* m32c-ibld.c: Regenerate.
* m32c-opc.c: Regenerate.
* m32c-opc.h: Regenerate.
* m32r-asm.c: Regenerate.
* m32r-desc.c: Regenerate.
* m32r-desc.h: Regenerate.
* m32r-dis.c: Regenerate.
* m32r-ibld.c: Regenerate.
* m32r-opc.c: Regenerate.
* m32r-opc.h: Regenerate.
* m32r-opinst.c: Regenerate.
* mep-asm.c: Regenerate.
* mep-desc.c: Regenerate.
* mep-desc.h: Regenerate.
* mep-dis.c: Regenerate.
* mep-ibld.c: Regenerate.
* mep-opc.c: Regenerate.
* mep-opc.h: Regenerate.
* mt-asm.c: Regenerate.
* mt-desc.c: Regenerate.
* mt-desc.h: Regenerate.
* mt-dis.c: Regenerate.
* mt-ibld.c: Regenerate.
* mt-opc.c: Regenerate.
* mt-opc.h: Regenerate.
* or1k-asm.c: Regenerate.
* or1k-desc.c: Regenerate.
* or1k-desc.h: Regenerate.
* or1k-dis.c: Regenerate.
* or1k-ibld.c: Regenerate.
* or1k-opc.c: Regenerate.
* or1k-opc.h: Regenerate.
* or1k-opinst.c: Regenerate.
* xc16x-asm.c: Regenerate.
* xc16x-desc.c: Regenerate.
* xc16x-desc.h: Regenerate.
* xc16x-dis.c: Regenerate.
* xc16x-ibld.c: Regenerate.
* xc16x-opc.c: Regenerate.
* xc16x-opc.h: Regenerate.
* xstormy16-asm.c: Regenerate.
* xstormy16-desc.c: Regenerate.
* xstormy16-desc.h: Regenerate.
* xstormy16-dis.c: Regenerate.
* xstormy16-ibld.c: Regenerate.
* xstormy16-opc.c: Regenerate.
* xstormy16-opc.h: Regenerate.
Iain Buclaw [Tue, 11 Jul 2017 07:51:03 +0000 (09:51 +0200)]
Sync dlang demangling tests from upstream libiberty testsuite.
Rationale behind the change instead of adding a `.init$' postfix being
that "initializer for symbol" is much more informative when inspecting D
runtime type information in gdb, which is the only place where you would
encounter references to this compiler-generated symbol.
gdb/testsuite/ChangeLog:
* gdb.dlang/demangle.exp: Update for demangling changes.
GDB Administrator [Tue, 11 Jul 2017 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Anton Kolesov [Mon, 10 Jul 2017 17:48:30 +0000 (20:48 +0300)]
Add missing ChangeLog etries
This adds the missing ChangeLog entries for my previous patch
3d99e81 Import setenv and unsetenv from gnulib
Nick Clifton [Mon, 10 Jul 2017 12:18:05 +0000 (13:18 +0100)]
Fix compile time warning about duplicate case values for powerpc-aix target.
* coffcode.h (coff_slurp_symbol_table): Do not include an entry
for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.
Yao Qi [Mon, 10 Jul 2017 11:00:35 +0000 (12:00 +0100)]
Re-generate i386/amd64-avx-avx512-linux.c and i386/amd64-avx-mpx-avx512-pku-linux.c
gdb:
2017-07-10 Yao Qi <yao.qi@linaro.org>
* features/i386/amd64-avx-avx512-linux.c: Re-generated.
* features/i386/amd64-avx-mpx-avx512-pku-linux.c: Re-generated.
Yao Qi [Mon, 10 Jul 2017 10:53:44 +0000 (11:53 +0100)]
Re-indent the code
gdb/gdbserver:
2017-07-10 Yao Qi <yao.qi@linaro.org>
* linux-x86-low.c (x86_linux_read_description): Re-indent the code.
Anton Kolesov [Mon, 3 Jul 2017 16:17:29 +0000 (19:17 +0300)]
Import setenv and unsetenv from gnulib
This patch supersedes
https://sourceware.org/ml/gdb-patches/2017-07/msg00009.html
---
Patch [1] broke a build on MinGW hosts, because MinGW doesn't provide POSIX
functions setenv () and unsetenv (). This can be fixed by using
implementations from gnulib.
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
9a6c7d9c0
gdb/ChangeLog
yyyy-mm-dd Anton Kolesov <Anton.Kolesov@synopsys.com>
* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add setenv and
unsetenv.
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
* gnulib/configure: Regenerate.
* gnulib/import/Makefile.am: Regenerate.
* gnulib/import/Makefile.in: Regenerate.
* gnulib/import/m4/gnulib-cache.m4: Regenerate.
* gnulib/import/m4/gnulib-comp.m4: Regenerate.
* gnulib/import/m4/environ.m4: New file.
* gnulib/import/m4/setenv.m4: New file.
* gnulib/import/setenv.c: New file.
* gnulib/import/unsetenv.c: New file.
GDB Administrator [Mon, 10 Jul 2017 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Jan Kratochvil [Sun, 9 Jul 2017 18:52:18 +0000 (20:52 +0200)]
DWARF-5: Fix error message typo.
binutils/
2017-07-09 Rafael Fontenelle <rafaelff@gnome.org>
* dwarf.c (display_formatted_table): Fix error message typo.
Simon Marchi [Sun, 9 Jul 2017 18:25:38 +0000 (20:25 +0200)]
compile-loc2c: Fix uninitialized variable error
Compiling with clang gives this warning/error:
/home/emaisin/src/binutils-gdb/gdb/compile/compile-loc2c.c:731:6: error: variable 'uoffset' is uninitialized when used here [-Werror,-Wuninitialized]
uoffset += dwarf2_per_cu_text_offset (per_cu);
^~~~~~~
/home/emaisin/src/binutils-gdb/gdb/compile/compile-loc2c.c:669:23: note: initialize the variable 'uoffset' to silence this warning
uint64_t uoffset, reg;
^
= 0
I am really not sure if what this patch does is good, but it is my best
guess. DW_OP_addr means that there's an constant address provided by
the DWARF bytecode that should be pushed on the stack. That address is
considered skipped by the "op_ptr += addr_size", but it is never read.
uoffset is indeed read just after, without having been assigned first.
So I think the intent is to read the address, it was just omitted.
gdb/ChangeLog:
* compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Read
address when op is DW_OP_addr.
Tom Tromey [Sun, 28 May 2017 14:06:54 +0000 (08:06 -0600)]
Fix size check in dwarf2_evaluate_loc_desc_full
This Rust bug report:
https://github.com/rust-lang/rust/issues/41970
noted an error from gdb. What is happening here (for me, the original
report had a different error) is that a pieced DWARF expression is not
writing to every byte in the resulting value. GDB errors in this
case. However, it seems to me that it is always valid to write fewer
bytes; the issue comes from writing too many -- that is, the test is
reversed. The test was also checking the sub-object, but this also
seems incorrect, as it's expected for the expression to write the
entirety of the enclosing object. So, this patch reverses the test
and applies it to the outer type, not the subobject type.
Regtested on the buildbot.
gdb/ChangeLog
2017-07-09 Tom Tromey <tom@tromey.com>
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Reverse size
check and apply to outer type.
gdb/testsuite/ChangeLog
2017-07-09 Tom Tromey <tom@tromey.com>
* gdb.dwarf2/shortpiece.exp: New file.
GDB Administrator [Sun, 9 Jul 2017 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 8 Jul 2017 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
John Baldwin [Wed, 28 Jun 2017 19:50:56 +0000 (12:50 -0700)]
Read signal information from FreeBSD core dumps.
FreeBSD recently added a new ELF core note which dumps the entire LWP
info structure (the same structure returned by the ptrace PT_LWPINFO
operation) for each thread. The plan is for this note to eventually
supplant the older "thrmisc" ELF core note as it contains more
information and it permits new information to be exported via both
ptrace() and core dumps using the same structure.
For signal information, the implementation is similar to the native
implementation for FreeBSD processes. The PL_FLAG_SI flag must be
checked to determine if the embedded siginfo_t structure is valid, and
if so it is transferred into the caller's buffer.
gdb/ChangeLog:
* fbsd-tdep.c (LWPINFO_OFFSET, LWPINFO_PL_FLAGS)
(LWPINFO64_PL_SIGINFO, LWPINFO32_PL_SIGINFO, PL_FLAG_SI)
(SIZE64_SIGINFO_T, SIZE32_SIGINFO_T, fbsd_core_xfer_siginfo): New.
(fbsd_init_abi): Install gdbarch "core_xfer_siginfo" method.
John Baldwin [Wed, 28 Jun 2017 19:47:14 +0000 (12:47 -0700)]
Create pseudo sections for FreeBSD NT_PTLWPINFO core notes.
bfd/ChangeLog:
* elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO.
John Baldwin [Wed, 28 Jun 2017 18:41:41 +0000 (11:41 -0700)]
Recognize the recently-added FreeBSD core dump note for LWP info.
This core dump note contains the same information returned by the
ptrace PT_LWPINFO operation for each LWP belonging to a process.
binutils/ChangeLog:
* readelf.c (get_freebsd_elfcore_note_type): Handle
NT_FREEBSD_PTLWPINFO.
include/ChangeLog:
* elf/common.h (NT_FREEBSD_PTLWPINFO): Define.
John Baldwin [Wed, 28 Jun 2017 18:21:10 +0000 (11:21 -0700)]
Use the thread_section_name helper class in fbsd_core_thread_name.
gdb/ChangeLog:
* fbsd-tdep.c (fbsd_core_thread_name): Use thread_section_name.
John Baldwin [Wed, 28 Jun 2017 18:11:20 +0000 (11:11 -0700)]
Add a new gdbarch method to fetch signal information from core files.
Previously the core_xfer_partial method used core_get_siginfo to handle
TARGET_OBJECT_SIGNAL_INFO requests. However, core_get_siginfo looked for
Linux-specific sections in the core file. To support fetching siginfo
from cores on other systems, add a new gdbarch method (`core_xfer_siginfo`)
and move the body of the existing core_get_siginfo into a
linux_core_xfer_siginfo implementation of this method in linux-tdep.c.
gdb/ChangeLog:
* corelow.c (get_core_siginfo): Remove.
(core_xfer_partial): Use the gdbarch "core_xfer_siginfo" method
instead of get_core_siginfo.
* gdbarch.sh (core_xfer_siginfo): New gdbarch callback.
* gdbarch.h: Re-generate.
* gdbarch.c: Re-generate.
* linux-tdep.c (linux_core_xfer_siginfo): New.
(linux_init_abi): Install gdbarch "core_xfer_siginfo" method.