external/binutils.git
6 years agoUse dlsym to check if libdl is needed for plugin
H.J. Lu [Thu, 5 Apr 2018 22:31:41 +0000 (15:31 -0700)]
Use dlsym to check if libdl is needed for plugin

config/plugins.m4 has

 if test "$plugins" = "yes"; then
    AC_SEARCH_LIBS([dlopen], [dl])
  fi

Plugin uses dlsym, but libasan.so only intercepts dlopen, not dlsym:

[hjl@gnu-tools-1 binutils-text]$ nm -D /lib64/libasan.so.4| grep " dl"
0000000000038580 W dlclose
                 U dl_iterate_phdr
000000000004dc50 W dlopen
                 U dlsym
                 U dlvsym
[hjl@gnu-tools-1 binutils-text]$

Testing dlopen for libdl leads to false negative when -fsanitize=address
is used.  It results in link failure:

../bfd/.libs/libbfd.a(plugin.o): undefined reference to symbol 'dlsym@@GLIBC_2.16'

dlsym should be used to check if libdl is needed for plugin.

bfd/

PR gas/22318
* configure: Regenerated.

binutils/

PR gas/22318
* configure: Regenerated.

gas/

PR gas/22318
* configure: Regenerated.

gprof/

PR gas/22318
* configure: Regenerated.

ld/

PR gas/22318
* configure: Regenerated.

6 years agoconfig: Sync with GCC
H.J. Lu [Thu, 5 Apr 2018 22:22:13 +0000 (15:22 -0700)]
config: Sync with GCC

Sync with GCC
2018-04-05  H.J. Lu  <hongjiu.lu@intel.com>

PR gas/22318
* plugins.m4 (AC_PLUGINS): Use dlsym to check if libdl is needed.

2018-02-14  Igor Tsimbalist  <igor.v.tsimbalist@intel.com>

PR target/84148
* cet.m4: Check if target support multi-byte NOPS (SSE).

6 years agoImprove warnings for relocations referring to discarded sections.
Cary Coutant [Thu, 5 Apr 2018 21:51:37 +0000 (14:51 -0700)]
Improve warnings for relocations referring to discarded sections.

gold/
* target-reloc.h (relocate_section): Add local symbol index or global
symbol name to warning about relocation that refers to discarded
section.

6 years agoMIPS/binutils/testsuite: Fix `.dc.l' typo in `strip-13mips64.s'
Maciej W. Rozycki [Thu, 5 Apr 2018 21:35:25 +0000 (14:35 -0700)]
MIPS/binutils/testsuite: Fix `.dc.l' typo in `strip-13mips64.s'

Fix a typo: `.dc.w' -> `.dc.l' in `strip-13mips64.s', correcting a bug
from commit 2f8ceb38991e ("binutils/testsuite: Support REL and MIPS64
reloc formats with `strip-13'").  For relocation format correctness only
as there is no observable change in test results due to the lack of
connection between the second relocation entry affected and the examined
error message produced.

binutils/
* testsuite/binutils-all/strip-13mips64.s: Use `.dc.l' rather
than `.dc.w' in second relocation.

6 years agoRevert previous patch and apply revised patch.
Cary Coutant [Thu, 5 Apr 2018 16:41:42 +0000 (09:41 -0700)]
Revert previous patch and apply revised patch.

Revert:

2018-04-05  James Cowgill  <james.cowgill@mips.com>

PR gold/22770
* mips.cc (Mips_got_info::record_got_page_entry): Fetch existing
page entries for the object's GOT.

Apply:

PR gold/22770
* mips.cc (Mips_got_info::record_got_page_entry): Don't insert
Got_page_entry for object's GOT.
(Mips_got_info::add_got_page_entries): Add all pages from from's GOT.
Rename to add_got_page_count.
(Got_page_entry): Remove num_pages.

6 years agoMIPS: Fix GOT page counter in multi-got links
James Cowgill [Thu, 5 Apr 2018 15:47:53 +0000 (08:47 -0700)]
MIPS: Fix GOT page counter in multi-got links

The record_got_page_entry function records and updates the maximum
number of GOT page entries which may be required by an object. In the
case where an existing GOT page entry was expanded, only the entry
belonging to output GOT would have its page count updated. This leaves
the entry belonging to the object GOT with the num_pages count of 1 it
was originally initialized with. Later on when GOTs are being merged in a
multi-got link, this causes the value of entry->num_pages in
add_got_page_entries to always be 1 and underestimates the number of pages
required for the new entry. This in turn leads to an assertion failure in
get_got_page_offset where we run out of pages.

Fix by obtaining the object's GOT entry unconditionally and not just
the first time it gets created. Now that entry2 is always valid, remove
the useless NULL checks.

gold/
PR gold/22770
* mips.cc (Mips_got_info::record_got_page_entry): Fetch existing
page entries for the object's GOT.

6 years agoStop the IA64 linker from removing unwind tables when garbage collecting.
Nick Clifton [Thu, 5 Apr 2018 13:44:05 +0000 (14:44 +0100)]
Stop the IA64 linker from removing unwind tables when garbage collecting.

PR 23030
* emulparams/elf64_ia64.sh (OTHER_READONLY_SECTIONS): Make sure
that the .IA_64.unwind_info and .IA_64.unwind sections are not
subject to garbage collection.

6 years agoRemove unnecessary include from linespec.h
Tom Tromey [Sat, 31 Mar 2018 18:55:32 +0000 (12:55 -0600)]
Remove unnecessary include from linespec.h

linespec.h was inculding vec.h, but doesn't expose any VECs.
So, this include can be removed.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* linespec.h: Remove include of "vec.h".

6 years agoRemove typep and VEC(typep) from linespec.c
Tom Tromey [Sat, 31 Mar 2018 18:52:57 +0000 (12:52 -0600)]
Remove typep and VEC(typep) from linespec.c

This removes VEC(typep) from linespec.c in favor of std::vector.  It
also removes the "typep" typedef.  This change allowed the removal of
some cleanups.

I believe the previous cleanup code in find_superclass_methods could
result in a memory leak, so this patch is an improvement in that way
as well.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* linespec.c (typep): Remove typedef.
(find_methods, find_superclass_methods): Take a std::vector.
(find_method): Use std::vector.

6 years agoMore use of std::vector in linespec.c
Tom Tromey [Sat, 31 Mar 2018 18:43:56 +0000 (12:43 -0600)]
More use of std::vector in linespec.c

This changes some spots in linespec.c to take a std::vector.  This
patch spilled out to objc-lang.c a bit as well.  This change allows
for the removal of some cleanups.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* utils.c (compare_strings): Remove.
* utils.h (compare_strings): Remove.
* objc-lang.h (find_imps): Update.
* objc-lang.c (find_methods): Take a std::vector.
(uniquify_strings, find_imps): Likewise.
* linespec.c (find_methods): Take a std::vector.
(decode_objc): Use std::vector.
(add_all_symbol_names_from_pspace, find_superclass_methods): Take
a std::vector.
(find_method, find_function_symbols): Use std::vector.

6 years agoChange streq to return bool
Tom Tromey [Sun, 1 Apr 2018 15:33:13 +0000 (09:33 -0600)]
Change streq to return bool

I wanted to use streq with std::unique in another (upcoming) patch in
this seres, so I changed it to return bool.  To my surprise, this lead
to regressions.  The cause turned out to be that streq was used as an
htab callback -- by casting it to the correct function type.  This
sort of cast is invalid, so this patch adds a variant which is
directly suitable for use by htab.  (Note that I did not add an
overload, as I could not get that to work with template deduction in
the other patch.)

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* completer.c (completion_tracker::completion_tracker): Remove
cast.
(completion_tracker::discard_completions): Likewise.
* breakpoint.c (ambiguous_names_p): Remove cast.
* ada-lang.c (_initialize_ada_language): Remove cast.
* utils.h (streq): Update.
(streq_hash): Add new declaration.
* utils.c (streq): Return bool.
(streq_hash): New function.

6 years agoRemove a string copy from event_location_to_sals
Tom Tromey [Sat, 31 Mar 2018 18:21:10 +0000 (12:21 -0600)]
Remove a string copy from event_location_to_sals

The use of "const" showed that a string copy in event_location_to_sals
was unnecessary.  This patch removes it.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* linespec.c (event_location_to_sals) <case ADDRESS_LOCATION>:
Remove a string copy.

6 years agoHave filter_results take a std::vector
Tom Tromey [Sat, 31 Mar 2018 18:16:54 +0000 (12:16 -0600)]
Have filter_results take a std::vector

This chagnes filter_results to take a std::vector, allowing the
removal of some cleanups in its callers.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* linespec.c (filter_results): Use std::vector.
(decode_line_2, decode_line_full): Update.

6 years agoReturn std::string from canonical_to_fullform
Tom Tromey [Sat, 31 Mar 2018 17:01:55 +0000 (11:01 -0600)]
Return std::string from canonical_to_fullform

This changes canonical_to_fullform to return a std::string, and
changes decode_line_2 to use std::vector.  This allows for the removal
of some cleanups.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* linespec.c (canonical_to_fullform): Return std::string.
(filter_results): Update.
(struct decode_line_2_item): Add constructor.
<fullform, displayform>: Now std::string.
(decode_line_2_compare_items): Now a std::sort comparator.
(decode_line_2): Update.

6 years agoMake copy_token_string return unique_xmalloc_ptr
Tom Tromey [Sat, 11 Nov 2017 18:09:52 +0000 (11:09 -0700)]
Make copy_token_string return unique_xmalloc_ptr

This changes copy_token_string to return a unique_xmalloc_ptr, which
allows the removal of some cleanups.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* linespec.c (copy_token_string): Return a unique_xmalloc_ptr.
(unexpected_linespec_error): Update.
(linespec_parse_basic, parse_linespec): Update.

6 years agoFix some indentation in linespec.c
Tom Tromey [Sat, 31 Mar 2018 16:54:25 +0000 (10:54 -0600)]
Fix some indentation in linespec.c

This removes some leftover comments and fixes the indentation in a
couple of spots in linespec.c.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* linespec.c (linespec_parse_basic): Reindent.

6 years agoRemove some cleanups from search_minsyms_for_name
Tom Tromey [Sat, 31 Mar 2018 16:32:00 +0000 (10:32 -0600)]
Remove some cleanups from search_minsyms_for_name

This changes struct collect_minsyms to use a std::vector, which
enables the removal of a cleanup from search_minsyms_for_name.  This
also changes iterate_over_minimal_symbols to take a
gdb::function_view, which makes a function in linespec.c more
type-safe.

ChangeLog
2018-04-05  Tom Tromey  <tom@tromey.com>

* minsyms.h (iterate_over_minimal_symbols): Update.
* minsyms.c (iterate_over_minimal_symbols): Take a
gdb::function_view.
* linespec.c (struct collect_minsyms): Remove.
(compare_msyms): Now a std::sort comparator.
(add_minsym): Add parameters.
(search_minsyms_for_name): Update.  Use std::vector.

6 years agobinutils/testsuite: Tighten the error message check with `strip-13'
Maciej W. Rozycki [Thu, 5 Apr 2018 12:08:35 +0000 (13:08 +0100)]
binutils/testsuite: Tighten the error message check with `strip-13'

Avoid false positives and actually verify both that an `unsupported
relocation type 0x8f' message is produced and that no other message is,
except for the final `bad value', in the `strip-13' test.  This ensures
that it is a relocation processing error and not a different issue that
has caused `strip' to terminate unsuccessfully, and that the number
representing the unsupported relocation has not been clobbered.

binutils/
* testsuite/binutils-all/strip-13.d: Also expect `unsupported
relocation type 0x8f' error message.

6 years agobinutils/testsuite: Support REL and MIPS64 reloc formats with `strip-13'
Maciej W. Rozycki [Thu, 5 Apr 2018 12:08:35 +0000 (13:08 +0100)]
binutils/testsuite: Support REL and MIPS64 reloc formats with `strip-13'

Add source variants for the `strip-13' test that produce relocations in
the REL and MIPS64 formats, fixing a failure for the `mips64el-openbsd'
target.  This also corrects output for `i*86-*', `i960-*', `m6812-*' and
`m68hc12-*', o32 `mips*-*', and `score*-*' targets, which however does
not show up as a test result change due to lax error message matching
causing `bad value' previously produced by `strip' as a result of input
file rejection to be accepted as a test pass.

For `m6811-*' aka `m68hc11-*' targets this causes a phantom regression,
because they use 16-bit addressing and therefore `.dc.a' emits 16-bit
quantities causing relocation data constructed in assembly not to be as
expected.  Previously input was rejected by `strip' with a `bad value'
message and now it is accepted, however due to the relocation data error
the relocation number is not one of the unsupported ones and the tool
completes successfully, which scores as a test failure.

Disable the test case for `m6811-*' and `m68hc11-*' targets then, as it
is a test case bug rather than a problem with the relevant backend.  A
separate change to the test case is required to correct this problem, at
which point the test case can be enabled for the affected targets.

binutils/
* testsuite/binutils-all/strip-13.s: Rename to...
* testsuite/binutils-all/strip-13rela.s: ... this.
* testsuite/binutils-all/strip-13rel.s: New test source.
* testsuite/binutils-all/strip-13mips64.s: New test source.
* testsuite/binutils-all/strip-13.d: Remove `arm-*', `d10v-*',
`dlx-*' and `xgate-*' from `not-target' list.  Add `m6811-*' and
`m68hc11-*' to `not-target' list.
* testsuite/binutils-all/objcopy.exp: Switch between sources for
`strip-13'.

6 years agobinutils/testsuite: Enable `strip-13' test for `hppa*-*'
Maciej W. Rozycki [Thu, 5 Apr 2018 12:08:35 +0000 (13:08 +0100)]
binutils/testsuite: Enable `strip-13' test for `hppa*-*'

Based on relocations defined in include/elf/*.h files we have relocation
numbers: 143, 159, 214 and 215 currently not used by any of our ELF
targets.  Use 143 then instead of 241 to enable the `strip-13' test for
`hppa*-*' targets.  It has a side effect with some targets of verifying
that unused relocations whose numbers are below the respective R_*_max
value are handled correctly.

binutils/
* testsuite/binutils-all/strip-13.s: Use 143 (0x8f) rather than
241 (0xf1) for the relocation number and RELA addend.
* testsuite/binutils-all/strip-13.d: Remove `hppa*-*' from the
`not-target' list.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 5 Apr 2018 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years ago[GOLD] Make powerpc64 .branch_lt relro
Alan Modra [Wed, 4 Apr 2018 07:40:36 +0000 (17:10 +0930)]
[GOLD] Make powerpc64 .branch_lt relro

Better security beats better placement for code optimization.

* powerpc.cc (Target_powerpc::make_brlt_section): Make .branch_lt relro.

6 years agoelf-hppa.h warning fix
Alan Modra [Wed, 4 Apr 2018 02:30:22 +0000 (12:00 +0930)]
elf-hppa.h warning fix

* elf-hppa.h (elf_hppa_info_to_howto): Init howto to NULL.
(elf_hppa_info_to_howto_rel): Likewise.

6 years ago * binutils/MAINTAINERS: Update e-mail address.
John David Anglin [Wed, 4 Apr 2018 22:29:17 +0000 (18:29 -0400)]
* binutils/MAINTAINERS: Update e-mail address.

6 years agoi386: Clear vex instead of vex.evex
H.J. Lu [Wed, 4 Apr 2018 11:36:44 +0000 (04:36 -0700)]
i386: Clear vex instead of vex.evex

"vex" has many fields to control how to decode an instruction.  Clear
all fields in "vex" before decoding an instruction to avoid using values
left from the previous instruction.

gas/

PR binutils/23025
* testsuite/gas/i386/prefix.s: Add tests for vcvtpd2dq with
VEX and EVEX prefixes.
* testsuite/gas/i386/prefix.d: Updated.

opcodes/

PR binutils/23025
* i386-dis.c (get_valid_dis386): Don't set vex.prefix nor vex.w
to 0.
(print_insn): Clear vex instead of vex.evex.

6 years agoAdd blurb about linker changes for Cygwin and Mingw targets.
Eric Botcazou [Wed, 4 Apr 2018 10:18:09 +0000 (12:18 +0200)]
Add blurb about linker changes for Cygwin and Mingw targets.

6 years agoSpeed up direct linking with DLLs on Windows (2/2).
Eric Botcazou [Wed, 4 Apr 2018 10:13:05 +0000 (12:13 +0200)]
Speed up direct linking with DLLs on Windows (2/2).

This patch deals with the generation of the import library on the fly.

The implementation is inefficient because the linker makes a lot of
calls to realloc and memmove when importing the symbols in order to
maintain a sorted list of symbols.

This is fixable by relying on the fact that, for every linked DLL,
the list of symbols it exports is already sorted so you can import
them en masse once you have found the insertion point.

ld/
* deffile.h (def_file_add_import_from): Declare.
(def_file_add_import_at): Likewise.
* deffilep.y (fill_in_import): New function extracted from...
(def_file_add_import): ...here.  Call it.
(def_file_add_import_from): New function.
(def_file_add_import_at): Likewise.
* pe-dll.c (pe_implied_import_dll): Use an optimized version of the
insertion loop for imported symbols if possible.

6 years agoSpeed up direct linking with DLLs on Windows (1/2).
Eric Botcazou [Wed, 4 Apr 2018 10:07:50 +0000 (12:07 +0200)]
Speed up direct linking with DLLs on Windows (1/2).

This patch deals with the auto-import feature.  There are 2 versions
of this feature: the original one, which was piggybacked on the OS
loader with an optional help from the runtime (--enable-auto-import
--enable-runtime-pseudo-reloc-v1) and is still the one mostly
documented in the sources and manual; the enhanced one by Kai Tietz,
which is entirely piggybacked on the runtime (--enable-auto-import
--enable-runtime-pseudo-reloc-v2) and is the default for Mingw and
Cygwin nowadays.

The implementation is inefficient because of pe[p]_find_data_imports:
for every undefined symbol, the function walks the entire set of
relocations for all the input files and does a direct name comparison
for each of them.

This is easily fixable by using a hash-based map for v1 and a simple
hash table for v2.  This patch leaves v1 alone and only changes v2.
It also factors out pe[p]_find_data_imports into a common function,
removes old cruft left and right, and attempts to better separate
the implementations of v1 and v2 in the code.

ld/
* emultempl/pe.em (U_SIZE): Delete.
(pe_data_import_dll): Likewise.
(make_import_fixup): Return void, take 4th parameter and pass it down
in call to pe_create_import_fixup.
(pe_find_data_imports): Move to...
(gld_${EMULATION_NAME}_after_open): Run the stdcall fixup pass after
the auto-import pass and add a guard before running the latter.
* emultempl/pep.em (U_SIZE): Delete.
(pep_data_import_dll): Likewise.
(make_import_fixup): Return void, take 4th parameter and pass it down
in call to pe_create_import_fixup.
(pep_find_data_imports): Move to...
(gld_${EMULATION_NAME}_after_open): Run the stdcall fixup pass after
the auto-import pass and add a guard before running the latter.
* pe-dll.c (runtime_pseudp_reloc_v2_init): Change type to bfd_boolean.
(pe_walk_relocs_of_symbol): Rename into...
(pe_walk_relocs): ...this.  Add 2 more parameters,4th parameter to the
callback prototype and pass 4th parameter in calls to the callback.
If the import hash table is present, invoke the callback on the reloc
if the symbol name is in the table.
(pe_find_data_imports): ...here.  Take 2 parameters.  Build an import
hash table for the pseudo-relocation support version 2.  When it is
built, walk the relocations only once at the end; when it is not, do
not build a fixup when the symbol isn't part of an import table.
Issue the associated warning only after a first fixup is built.
(tmp_seq2): Delete.
(make_singleton_name_imp): Likewise.
(make_import_fixup_mark): Return const char * and a stable string.
(make_import_fixup_entry): Do not deal with the pseudo-relocation
support version 2.
(make_runtime_pseudo_reloc): Factor out code and fix formatting.
(pe_create_import_fixup): Add 5th parameter.  Clearly separate the
pseudo-relocation support version 2 from the rest.  Fix formatting.
* pe-dll.h (pe_walk_relocs_of_symbol): Delete.
(pe_find_data_imports): Declare.
(pe_create_import_fixup): Add 5th parameter.
* pep-dll.c (pe_data_import_dll): Delete.
(pe_find_data_imports): Define.
(pe_walk_relocs_of_symbol): Delete.
* pep-dll.h (pep_walk_relocs_of_symbol): Delete.
(pep_find_data_imports): Declare.
(pep_create_import_fixup): Add 5th parameter.
* ld.texinfo (--enable-auto-import): Adjust to new implementation.

6 years agoUpdate Spanish translations for ld/ opcodes/ and gold/ sub-directories
Nick Clifton [Wed, 4 Apr 2018 08:00:18 +0000 (09:00 +0100)]
Update Spanish translations for ld/ opcodes/ and gold/ sub-directories

6 years agoRetire Jason Eckhardt as i860 maintainer.
Nick Clifton [Wed, 4 Apr 2018 07:35:19 +0000 (08:35 +0100)]
Retire Jason Eckhardt as i860 maintainer.

* MAINTAINERS: Move Jason Eckhardt to past maintainers section.

6 years agoPR binutils/22875: HPPA/ELF: Also fail with relocation placeholders
Maciej W. Rozycki [Wed, 4 Apr 2018 01:00:49 +0000 (02:00 +0100)]
PR binutils/22875: HPPA/ELF: Also fail with relocation placeholders

Do not consider R_PARISC_UNIMPLEMENTED placeholder relocation entries of
the `elf_hppa_howto_table' table valid in `info_to_howto' HPPA handlers.
Instead issue an unsupported relocation type error and return a NULL
howto as with relocations whose number is R_PARISC_UNIMPLEMENTED or
beyond.

bfd/
* elf-hppa.h (elf_hppa_info_to_howto): Also return
unsuccessfully for unimplemented relocations.
(elf_hppa_info_to_howto_rel): Likewise.

6 years agoPR binutils/22875: i860/ELF: Report unsupported relocation types
Maciej W. Rozycki [Wed, 4 Apr 2018 01:00:49 +0000 (02:00 +0100)]
PR binutils/22875: i860/ELF: Report unsupported relocation types

Complement commit f3185997ac09 ("PR 22875: Stop strip corrupting unknown
relocs"), <https://sourceware.org/ml/binutils/2018-02/msg00445.html>,
and also set the `bfd_error_bad_value' error and report an unsupported
relocation type if a howto lookup fails with the i860 backend, fixing a
confusing `no error' error message and removing a binutils test failure:

failed with: <.../binutils/strip-new: tmpdir/bintest.o: no error>, expected: <.* bad value>
.../binutils/strip-new: tmpdir/bintest.o: no error
FAIL: binutils-all/strip-13

with the `i860-stardent-elf' target.

bfd/
* elf32-i860.c (lookup_howto): Add `abfd' parameter.  Set the
`bfd_error_bad_value' error and call `_bfd_error_handler' on a
howto lookup failure.
(elf32_i860_reloc_type_lookup): Adjust `lookup_howto' call
accordingly.
(elf32_i860_info_to_howto_rela): Likewise.
(elf32_i860_relocate_splitn): Likewise.
(elf32_i860_relocate_pc16): Likewise.
(elf32_i860_relocate_pc26): Likewise.
(elf32_i860_relocate_section): Likewise.

6 years agoPR binutils/22875: Visium/ELF: Prevent an out-of-bounds howto table access
Maciej W. Rozycki [Wed, 4 Apr 2018 01:00:49 +0000 (02:00 +0100)]
PR binutils/22875: Visium/ELF: Prevent an out-of-bounds howto table access

Prevent an out-of-bounds `visium_elf_howto_table' table access in
`visium_info_to_howto_rela' by using the size of the table rather than
R_VISIUM_max to determine the number of entries in the contiguous
regular Visium relocation range defined and described in the table.

bfd/
* elf32-visium.c (visium_info_to_howto_rela): Correct the range
check for `visium_elf_howto_table' table access.

6 years agoPR binutils/22875: IQ2000/ELF: Prevent an out-of-bounds howto table access
Maciej W. Rozycki [Wed, 4 Apr 2018 01:00:49 +0000 (02:00 +0100)]
PR binutils/22875: IQ2000/ELF: Prevent an out-of-bounds howto table access

Prevent an out-of-bounds `iq2000_elf_howto_table' table access in
`iq2000_info_to_howto_rela' by using the size of the table rather than
R_IQ2000_max to determine the number of entries in the contiguous
regular IQ2000 relocation range defined and described in the table.

bfd/
* elf32-iq2000.c (iq2000_info_to_howto_rela): Correct the range
check for `iq2000_elf_howto_table' table access.

6 years agoPR binutils/22875: FRV/ELF: Prevent an out-of-bounds howto table access
Maciej W. Rozycki [Wed, 4 Apr 2018 01:00:48 +0000 (02:00 +0100)]
PR binutils/22875: FRV/ELF: Prevent an out-of-bounds howto table access

Prevent an out-of-bounds `elf32_frv_howto_table' table access in
`frv_info_to_howto_rela' by using the size of the table rather than
R_FRV_max to determine the number of entries in the contiguous regular
FRV relocation range defined and described in the table.

bfd/
* elf32-frv.c (frv_info_to_howto_rela): Correct the range check
for `elf32_frv_howto_table' table access.

6 years agoPR binutils/22875: MIPS/ELF: Also fail with relocation placeholders
Maciej W. Rozycki [Wed, 4 Apr 2018 01:00:48 +0000 (02:00 +0100)]
PR binutils/22875: MIPS/ELF: Also fail with relocation placeholders

Do not consider placeholder EMPTY_HOWTO relocation entries valid in
`rtype_to_howto' MIPS handlers.  Instead issue an unsupported relocation
type error and return a NULL howto as with relocations outside the three
ISA-specific min-max ranges.

bfd/
* elf32-mips.c (mips_elf32_rtype_to_howto): Also return
unsuccessfully for placeholder howtos.
* elf64-mips.c (mips_elf64_rtype_to_howto): Likewise.
* elfn32-mips.c (mips_elf_n32_rtype_to_howto): Likewise.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 4 Apr 2018 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoChange read_alphacoff_dynamic_symtab to use gdb::byte_vector
Tom Tromey [Sat, 11 Nov 2017 02:52:33 +0000 (19:52 -0700)]
Change read_alphacoff_dynamic_symtab to use gdb::byte_vector

This changes read_alphacoff_dynamic_symtab to use gdb::byte_vector.
This allows for the removal of some cleanups.

Tested by the buildbot; though I don't know whether this code path is
ever actually run.

gdb/ChangeLog
2018-04-03  Tom Tromey  <tom@tromey.com>

* mipsread.c (read_alphacoff_dynamic_symtab): Use
gdb::byte_vector.

6 years agoMIPS/LD/testsuite: Correct LD emulations for `mips*-*-kfreebsd*-gnu'
Maciej W. Rozycki [Tue, 3 Apr 2018 08:16:44 +0000 (01:16 -0700)]
MIPS/LD/testsuite: Correct LD emulations for `mips*-*-kfreebsd*-gnu'

Complement commit 86b24e15c45b ("MIPS/LD/testsuite: Correct
comm-data.exp test ABI/emul/endian arrangement") and set LD emulations
correctly for `mips*-*-kfreebsd*-gnu' targets in comm-data.exp, removing
test suite failures:

FAIL: MIPS o32/copyreloc common symbol override test (auxiliary shared object build)
FAIL: MIPS o32/copyreloc common symbol override test
FAIL: MIPS o32/nocopyreloc common symbol override test (auxiliary shared object build)
FAIL: MIPS o32/nocopyreloc common symbol override test

ld/
* testsuite/ld-mips-elf/comm-data.exp: Correct support for
`mips*-*-kfreebsd*-gnu' targets.

6 years agoFix problem where mixed section types can cause internal error during a -r link.
Cary Coutant [Mon, 2 Apr 2018 23:12:10 +0000 (16:12 -0700)]
Fix problem where mixed section types can cause internal error during a -r link.

During a -r (or --emit-relocs) link, if two sections had the same name but
different section types, gold would put relocations for both sections into
the same relocation section even though the data sections remained separate.

For .eh_frame sections, when one section is PROGBITS and another is
X86_64_UNWIND, we really should be using the UNWIND section type and
combining the sections anyway.  For other sections, we should be
creating one relocation section for each output data section.

gold/
PR gold/23016
* incremental.cc (can_incremental_update): Check for unwind section
type.
* layout.h (Layout::layout): Add sh_type parameter.
* layout.cc (Layout::layout): Likewise.
(Layout::layout_reloc): Create new output reloc section if data
section does not already have one.
(Layout::layout_eh_frame): Check for unwind section type.
(Layout::make_eh_frame_section): Use unwind section type for .eh_frame
and .eh_frame_hdr.
* object.h (Sized_relobj_file::Shdr_write): New typedef.
(Sized_relobj_file::layout_section): Add sh_type parameter.
(Sized_relobj_file::Deferred_layout::Deferred_layout): Add sh_type
parameter.
* object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
unwind section type.
(Sized_relobj_file::layout_section): Add sh_type parameter; pass it
to Layout::layout.
(Sized_relobj_file::do_layout): Make local copy of sh_type.
Force .eh_frame sections to unwind section type.
Pass sh_type to layout_section.
(Sized_relobj_file<size, big_endian>::do_layout_deferred_sections):
Pass sh_type to layout_section.
* output.cc (Output_section::Output_section): Initialize reloc_section_.
* output.h (Output_section::reloc_section): New method.
(Output_section::set_reloc_section): New method.
(Output_section::reloc_section_): New data member.
* target.h (Target::unwind_section_type): New method.
(Target::Target_info::unwind_section_type): New data member.

* aarch64.cc (aarch64_info): Add unwind_section_type.
* arm.cc (arm_info, arm_nacl_info): Likewise.
* i386.cc (i386_info, i386_nacl_info, iamcu_info): Likewise.
* mips.cc (mips_info, mips_nacl_info): Likewise.
* powerpc.cc (powerpc_info): Likewise.
* s390.cc (s390_info): Likewise.
* sparc.cc (sparc_info): Likewise.
* tilegx.cc (tilegx_info): Likewise.
* x86_64.cc (x86_64_info, x86_64_nacl_info): Likewise.

* testsuite/Makefile.am (pr23016_1, pr23016_2): New test cases.
* testsuite/Makefile.in: Regenerate.
* testsuite/testfile.cc: Add unwind_section_type.
* testsuite/pr23016_1.sh: New test script.
* testsuite/pr23016_1a.s: New source file.
* testsuite/pr23016_1b.s: New source file.
* testsuite/pr23016_2.sh: New test script.
* testsuite/pr23016_2a.s: New source file.
* testsuite/pr23016_2b.s: New source file.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 Apr 2018 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAdd myself as a write-after-approval GDB maintainer.
Weimin Pan [Mon, 2 Apr 2018 21:23:59 +0000 (16:23 -0500)]
Add myself as a write-after-approval GDB maintainer.

6 years agoFix merge issues in gdb/ChangeLog and gdb/testsuite/ChangeLog...
Joel Brobecker [Mon, 2 Apr 2018 18:34:11 +0000 (11:34 -0700)]
Fix merge issues in gdb/ChangeLog and gdb/testsuite/ChangeLog...

... introduced by the previous commit to these files.
Also adjust the date in the new ChangeLog entries (out of date).

6 years agoFix infinite recursion when printing static member with typedef
Weimin Pan [Wed, 28 Mar 2018 19:23:48 +0000 (13:23 -0600)]
Fix infinite recursion when printing static member with typedef

The original problem was fixed (see related PR 22242). But using a typedef
as the declared type for a static member variable, as commented in this PR,
is still causing gdb to get into infinite loop when printing the static
member's value. This problem can be reproduced as follows:

% cat t.cc
class A {
    typedef A type;
public:
    bool operator==(const type& other) { return true; }

    static const type INSTANCE;
};

const A A::INSTANCE;

int main() {
    A a;
    if (a == A::INSTANCE) {
        return -1;
    }
    return 0;
}
% g++ -g t.cc
% gdb -ex "start" -ex "p a" a.out

The fix is rather trivial - in cp_print_static_field(), should call
check_typedef() to get the static member's real type and use it to
check whether it's a struct or an array.

As Simon suggested, I've added a new test case to the testsuite
and am passing the original type, not the real type, as argument
to both cp_print_value_fields() and val_print().

Re-tested on both aarch64-linux-gnu and amd64-linux-gnu. No regressions.

6 years agogdb/ChangeLog: Fix filenames in a couple of entries
Joel Brobecker [Mon, 26 Mar 2018 16:09:56 +0000 (09:09 -0700)]
gdb/ChangeLog: Fix filenames in a couple of entries

6 years agoChange rs6000_ptrace_ldinfo to return a byte_vector
Tom Tromey [Fri, 10 Nov 2017 20:52:37 +0000 (13:52 -0700)]
Change rs6000_ptrace_ldinfo to return a byte_vector

This changes rs6000_ptrace_ldinfo to return a byte_vector.  I think
this points out an existing double-free in
rs6000_xfer_shared_libraries.

Tested by the buildbot.

gdb/ChangeLog
2018-04-01  Tom Tromey  <tom@tromey.com>

* rs6000-nat.c (rs6000_ptrace_ldinfo): Return a byte_vector.
(rs6000_xfer_shared_libraries): Update.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 Apr 2018 00:00:44 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRemove char_ptr typedef
Simon Marchi [Sun, 1 Apr 2018 18:23:17 +0000 (14:23 -0400)]
Remove char_ptr typedef

Now that all instances of VEC(char_ptr) are gone, we can remove the
typedef.  There is just one usage left, that is trivial to replace.

Tested by rebuilding on an enable-targets=all build.

gdb/ChangeLog:

* common/gdb_vecs.h (char_ptr): Remove.
* tracepoint.c (encode_actions_1): Remove usage of char_ptr.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 1 Apr 2018 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 31 Mar 2018 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRemove usage of VEC(char_ptr) in gdbscm_parse_function_args
Simon Marchi [Fri, 30 Mar 2018 21:18:56 +0000 (17:18 -0400)]
Remove usage of VEC(char_ptr) in gdbscm_parse_function_args

This is a straightforward replacement, no change in behavior are
intended/expected.

This is the last usage of VEC(char_ptr), so it can now be removed.

gdb/ChangeLog:

* guile/scm-utils.c (gdbscm_parse_function_args): Replace VEC
with std::vector.
* common/gdb_vecs.h (DEF_VEC_P (char_ptr)): Remove.

6 years agoUse std::vector and std::string instead of VEC(char_ptr) in gdbserver tdesc
Simon Marchi [Fri, 30 Mar 2018 21:18:55 +0000 (17:18 -0400)]
Use std::vector and std::string instead of VEC(char_ptr) in gdbserver tdesc

This is a straightforward replacement, no change in behavior are
intended/expected.

gdb/gdbserver/ChangeLog:

* tdesc.h (struct target_desc) <features>: Change type to
std::vector<std::string>.
* tdesc.c (target_desc::~target_desc): Adjust to std::vector
changes.
(tdesc_get_features_xml): Likewise.
(tdesc_create_feature): Likewise.

6 years agoUse std::vector in uploaded_tp
Simon Marchi [Fri, 30 Mar 2018 21:18:54 +0000 (17:18 -0400)]
Use std::vector in uploaded_tp

This patch changes the VEC(char_ptr) fields in uploaded_tp to use
std::vector<char *>.  At first, I wanted to creep in more changes, like
using std::string, but it was making the patch too big and less focused,
so I decided to keep it to just that.

It also looks like the strings in those vectors are never free'd.  If
so, we can fix that in another patch.

gdb/ChangeLog:

* tracepoint.h (struct uploaded_tp): Initialize fields.
<actions, step_actions, cmd_strings>: Change type to
std::vector<char *>.
* tracepoint.c (get_uploaded_tp): Allocate with new.
(free_uploaded_tps): Free with delete.
(parse_tracepoint_definition): Adjust to std::vector change.
* breakpoint.c (read_uploaded_action): Likewise.
(create_tracepoint_from_upload): Likewise.
* ctf.c (ctf_write_uploaded_tp): Likewise.
(SET_ARRAY_FIELD): Likewise.
* tracefile-tfile.c (tfile_write_uploaded_tp): Likewise.

6 years agoRemove some cleanups from solib-svr4.c
Tom Tromey [Tue, 27 Mar 2018 20:42:55 +0000 (14:42 -0600)]
Remove some cleanups from solib-svr4.c

This removes a few cleanups from solib-svr4.c in a straightforward
way.

gdb/ChangeLog
2018-03-30  Tom Tromey  <tom@tromey.com>

* solib-svr4.c (lm_info_read): Use gdb::byte_vector.  Return
std::unique_ptr.
(svr4_keep_data_in_core): Update.
(svr4_read_so_list): Update.

6 years agoChange target_read_string to use unique_xmalloc_ptr
Tom Tromey [Tue, 27 Mar 2018 20:31:10 +0000 (14:31 -0600)]
Change target_read_string to use unique_xmalloc_ptr

This changes the out parameter of target_read_string to be a
unique_xmalloc_ptr.  This avoids a cleanup and sets the stage for more
cleanup removals.

This patch also removes a seemingly needless alloca from
print_subexp_standard.

gdb/ChangeLog
2018-03-30  Tom Tromey  <tom@tromey.com>

* windows-nat.c (handle_output_debug_string, handle_exception):
Update.
* target.h (target_read_string): Update.
* target.c (target_read_string): Change "string" to
unique_xmalloc_ptr.
* solib-svr4.c (open_symbol_file_object, svr4_read_so_list):
Update.
* solib-frv.c (frv_current_sos): Update.
* solib-dsbt.c (dsbt_current_sos): Update.
* solib-darwin.c (darwin_current_sos): Update.
* linux-thread-db.c (inferior_has_bug): Update.
* expprint.c (print_subexp_standard) <case OP_OBJC_MSGCALL>:
Update.  Remove alloca.
* ada-lang.c (ada_main_name): Update.

6 years agoRemove free_dwo_file_cleanup
Tom Tromey [Wed, 28 Mar 2018 21:35:46 +0000 (15:35 -0600)]
Remove free_dwo_file_cleanup

This removes free_dwo_file_cleanup, the last cleanup in dwarf2read.c.
This is replaced with a unique_ptr; which, despite the fact that a
dwo_file is obstack-allocated, seemed like the best fit.

gdb/ChangeLog
2018-03-30  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (struct free_dwo_file_cleanup_data): Remove.
(struct dwo_file_deleter): New.
(dwo_file_up): New typedef.
(open_and_init_dwo_file): Use dwo_file_up.
(free_dwo_file_cleanup): Remove.

6 years agoRemove parameter from free_dwo_file
Tom Tromey [Wed, 28 Mar 2018 21:21:08 +0000 (15:21 -0600)]
Remove parameter from free_dwo_file

The objfile parameter to free_dwo_file is unused, so remove it.

gdb/ChangeLog
2018-03-30  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (free_dwo_file): Remove "objfile" parameter.
(free_dwo_file_cleanup, free_dwo_file_from_slot): Update.

6 years agoRemove free_cached_comp_units cleanups
Tom Tromey [Wed, 28 Mar 2018 21:04:30 +0000 (15:04 -0600)]
Remove free_cached_comp_units cleanups

This changes free_cached_comp_units from a cleanup function to an RAII
class.

gdb/ChangeLog
2018-03-30  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (class free_cached_comp_units): New class.
(dw2_instantiate_symtab, dwarf2_build_psymtabs_hard): Use it.
(free_cached_comp_units): Remove function.

6 years agoRemove make_cleanup_unpush_target
Tom Tromey [Wed, 28 Mar 2018 21:49:24 +0000 (15:49 -0600)]
Remove make_cleanup_unpush_target

This removes make_cleanup_unpush_target, replacing it with a
unique_ptr.  This may seem odd, because the object in question is not
actually freed, but unique_ptr provided the necessary functionality.

Tested by the buildbot.

gdb/ChangeLog
2018-03-30  Tom Tromey  <tom@tromey.com>

* utils.h (make_cleanup_unpush_target): Remove.
* inf-ptrace.c (struct target_unpusher): New.
(target_unpush_up) New typedef.
(inf_ptrace_create_inferior, inf_ptrace_attach): Use
target_unpush_up.
* utils.c (do_unpush_target, make_cleanup_unpush_target): Remove.

6 years agoMake power8 the default cpu when assembling for 64-bit little endian targets.
Peter Bergner [Fri, 30 Mar 2018 13:33:27 +0000 (08:33 -0500)]
Make power8 the default cpu when assembling for 64-bit little endian targets.

gas/
PR binutils/23013
* config/tc-ppc.c (ppc_set_cpu): Select appropriate cpu when ppc_obj64
and little endian.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Mar 2018 00:00:36 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoPR binutils/22875: MIPS: Remove duplicate unsupported relocation processing
Maciej W. Rozycki [Thu, 29 Mar 2018 13:09:48 +0000 (14:09 +0100)]
PR binutils/22875: MIPS: Remove duplicate unsupported relocation processing

Remove a duplicate `unsupported relocation type' message and the setting
of the `bfd_error_bad_value' error from `mips_elf32_rtype_to_howto',
added with commit f3185997ac09 ("PR 22875: Stop strip corrupting unknown
relocs"), <https://sourceware.org/ml/binutils/2018-02/msg00445.html>.
This message is already produced and the `bfd_error_bad_value' error set
by `mips_elf32_rtype_to_howto' before a NULL howto is returned, so there
is no need to repeat these actions here.

bfd/
* elf32-mips.c (mips_info_to_howto_rel): Remove the calls to
`_bfd_error_handler' and to set the `bfd_error_bad_value' error.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 29 Mar 2018 00:00:32 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoBFD/PA: Remove ATTRIBUTE_UNUSED from `elf_hppa_info_to_howto_rel'
Maciej W. Rozycki [Wed, 28 Mar 2018 21:42:17 +0000 (22:42 +0100)]
BFD/PA: Remove ATTRIBUTE_UNUSED from `elf_hppa_info_to_howto_rel'

Remove ATTRIBUTE_UNUSED annotation from the `abfd' parameter in
`elf_hppa_info_to_howto' now that commit f3185997ac09 ("PR 22875: Stop
strip corrupting unknown relocs"),
<https://sourceware.org/ml/binutils/2018-02/msg00445.html>, made it
used.

bfd/
* elf-hppa.h (elf_hppa_info_to_howto_rel): Remove
ATTRIBUTE_UNUSED from `abfd'.

6 years agoBFD/PA: Correct formatting in `elf_hppa_info_to_howto_rel'
Maciej W. Rozycki [Wed, 28 Mar 2018 21:42:17 +0000 (22:42 +0100)]
BFD/PA: Correct formatting in `elf_hppa_info_to_howto_rel'

Wrap the `_bfd_error_handler' call to fit in 80 columns, fixing commit
e8f5af786c76 ("Use standardized error message for unrecognized relocs.").

bfd/
* elf-hppa.h (elf_hppa_info_to_howto_rel): Correct
`_bfd_error_handler' call formatting.

6 years agoMIPS/BFD: Call `mips_elf32_rtype_to_howto' directly with o32 (ChangeLog)
Maciej W. Rozycki [Wed, 28 Mar 2018 21:42:17 +0000 (22:42 +0100)]
MIPS/BFD: Call `mips_elf32_rtype_to_howto' directly with o32 (ChangeLog)

Correct ChangeLog date for commit 8205a328f8b8 ("MIPS/BFD: Call
`mips_elf32_rtype_to_howto' directly with o32").

6 years agoUse top-level config support for enabling plugins.
Cary Coutant [Wed, 28 Mar 2018 00:49:49 +0000 (17:49 -0700)]
Use top-level config support for enabling plugins.

Also recognizes --plugin options when plugins are disabled.

2018-03-28  Cary Coutant  <ccoutant@gmail.com>

gold/
PR gold/21423
PR gold/22500
* configure.ac: Call AC_USE_SYSTEM_EXTENSIONS.
Replace check for --enable-plugins with AC_PLUGINS.
* options.cc (parse_plugin, parse_plugin_opt): Remove #ifdef.
(General_options::finalize): Check if plugins enabled.
* options.h (--plugin, --plugin-opt): Define even if plugins not
enabled.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* testsuite/Makefile.in: Regenerate.

6 years agoMIPS/BFD: Call `mips_elf32_rtype_to_howto' directly with o32
Maciej W. Rozycki [Wed, 28 Mar 2018 20:37:37 +0000 (21:37 +0100)]
MIPS/BFD: Call `mips_elf32_rtype_to_howto' directly with o32

Call `mips_elf32_rtype_to_howto' directly rather than via the
`->elf_backend_mips_rtype_to_howto' method in the o32 backend,
complementing commit 861fb55ab50a ("Defer allocation of R_MIPS_REL32 GOT
slots"), <https://sourceware.org/ml/binutils/2008-08/msg00096.html>, and
reverting the change to `mips_info_to_howto_rel' originally made with
commit 0a44bf6950b3 ("mips-vxworks support"),
<https://sourceware.org/ml/binutils/2006-03/msg00179.html>.

With `mips_vxworks_rtype_to_howto' gone there is a single backend method
used across all o32 targets, so there in no need for the indirection and
the associated extra cost.  This also makes the o32 backend consistent
with the n32 and n64 backends.

bfd/
* elf32-mips.c (mips_info_to_howto_rel): Call
`mips_elf32_rtype_to_howto' directly rather than via
`->elf_backend_mips_rtype_to_howto'.

6 years ago[2/2][LD][AARCH64]Add BFD_RELOC_AARCH64_TLSLE_LDST8/16/32/64_TPREL_LO12 support in LD.
Renlin Li [Wed, 28 Mar 2018 17:06:05 +0000 (18:06 +0100)]
[2/2][LD][AARCH64]Add BFD_RELOC_AARCH64_TLSLE_LDST8/16/32/64_TPREL_LO12 support in LD.

This patch adds the following relocation support into binutils bfd linker.
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.

Those relocations includes both ip64 and ilp32 variant.

6 years ago[1/2][GAS][AARCH64]Add BFD_RELOC_AARCH64_TLSLE_LDST8/16/32/64_TPREL_LO12 support...
Renlin Li [Wed, 28 Mar 2018 17:03:55 +0000 (18:03 +0100)]
[1/2][GAS][AARCH64]Add BFD_RELOC_AARCH64_TLSLE_LDST8/16/32/64_TPREL_LO12 support in GAS.

This patch adds the following relocation support into binutils gas.
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST16_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST32_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST64_TPREL_LO12_NC,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12,
BFD_RELOC_AARCH64_TLSLE_LDST8_TPREL_LO12_NC.

Those relocations includes both ip64 and ilp32 variant.

6 years agoAdd support for R_AARCH64_TLSLE_LDST8_TPREL_LO12, etc.
Cary Coutant [Wed, 28 Mar 2018 01:24:48 +0000 (18:24 -0700)]
Add support for R_AARCH64_TLSLE_LDST8_TPREL_LO12, etc.

elfcpp/
PR gold/22969
* aarch64.h: Fix spelling of R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC.
gold/
PR gold/22969
* aarch64-reloc.def: Add TLSLE_LDST* relocations.
* aarch64.cc (Target_aarch64::optimize_tls_reloc): Likewise.
(Target_aarch64::Scan::local): Likewise.
(Target_aarch64::Scan::global): Likewise.
(Target_aarch64::Relocate::relocate): Likewise.
(Target_aarch64::Relocate::relocate_tls): Likewise.

6 years agox86: drop VecESize
Jan Beulich [Wed, 28 Mar 2018 12:25:07 +0000 (14:25 +0200)]
x86: drop VecESize

It again can be inferred from other information.

The vpopcntd templates all need to have Dword added to their memory
operands; the lack thereof was actually a bug preventing certain Intel
syntax code to assemble, so test cases get extended.

6 years agox86: convert broadcast insn attribute to boolean
Jan Beulich [Wed, 28 Mar 2018 12:24:05 +0000 (14:24 +0200)]
x86: convert broadcast insn attribute to boolean

The (only) valid broadcast type for an insn can be inferred from other
information.

6 years agox86: fold to-scalar-int conversion insns
Jan Beulich [Wed, 28 Mar 2018 12:22:56 +0000 (14:22 +0200)]
x86: fold to-scalar-int conversion insns

6 years agox86: don't show suffixes for to-scalar-int conversion insns
Jan Beulich [Wed, 28 Mar 2018 12:22:00 +0000 (14:22 +0200)]
x86: don't show suffixes for to-scalar-int conversion insns

In the course of folding their patterns (possible now that the pointless
and partly even bogus VecESize are no longer in the way) I've noticed
that vcvt*2usi, other than their vcvt*2si counterparts, don't allow for
any suffixes. As that is supposedly intentional, make the disassembler
consistently omit suffixes for all to-scalar-int conversion insns.

6 years agoPR ld/22972 on SPARC.
Eric Botcazou [Wed, 28 Mar 2018 10:17:15 +0000 (12:17 +0200)]
PR ld/22972 on SPARC.

This is a regression for the corner case of a hidden symbol in a PIC/PIE
binary which is subject to both a new-style GOTDATA relocation and an
old-style GOT relocation.  In this case, depending  on the link order,
the R_SPARC_RELATIVE dynamic relocation for the GOT slot needed because
of the old-style relocation can be replaced with R_SPARC_NONE coming
from the GOTDATA relocation.

The fix simply records whether an old-style GOT relocation is seen for a
symbol and prevents the R_SPARC_NONE from being generated in this case.

bfd/
* elfxx-sparc.c (struct _bfd_sparc_elf_link_hash_entry): Add new flag
has_old_style_got_reloc.
(_bfd_sparc_elf_check_relocs) <GOT relocations>: Set it for old-style
relocations.  Fix a couple of long lines.
(_bfd_sparc_elf_relocate_section) <R_SPARC_GOTDATA_OP>: Do not generate
a R_SPARC_NONE for the GOT slot if the symbol is also subject to
old-style GOT relocations.
ld/
* testsuite/ld-sparc/sparc.exp: Add test for mixed GOTDATA/GOT relocs.
* testsuite/ld-sparc/gotop-hidden.c: New file.
* testsuite/ld-sparc/got-hidden32.s: Likewise.
* testsuite/ld-sparc/got-hidden64.s: Likewise.
* testsuite/ld-sparc/pass.out: Likewise.

6 years agoEnhance the AARCH64 assembler to support LDFF1xx instructions which use REG+REG addre...
Nick Clifton [Wed, 28 Mar 2018 08:44:45 +0000 (09:44 +0100)]
Enhance the AARCH64 assembler to support LDFF1xx instructions which use REG+REG addressing with an assumed offset register.

PR 22988
opcode * opcode/aarch64.h (enum aarch64_opnd): Add
AARCH64_OPND_SVE_ADDR_R.

opcodes * aarch64-tbl.h (aarch64_opcode_table): Add entries for LDFF1xx
instructions with only a base address register.
* aarch64-opc.c (operand_general_constraint_met_p): Add code to
handle AARHC64_OPND_SVE_ADDR_R.
(aarch64_print_operand): Likewise.
* aarch64-asm-2.c: Regenerate.
* aarch64_dis-2.c: Regenerate.
* aarch64-opc-2.c: Regenerate.

gas * config/tc-aarch64.c (parse_operands): Add code to handle
AARCH64_OPN_SVE_ADDR_R.
* testsuite/gas/aarch64/sve.s: Add tests for LDFF1xx instructions
with an assumed XZR offset address register.
* testsuite/gas/aarch64/sve.d: Update expected disassembly.

6 years agogold/testsuite: Fix bad regexp in split_x86_64.sh
Roland McGrath [Tue, 27 Mar 2018 23:27:03 +0000 (16:27 -0700)]
gold/testsuite: Fix bad regexp in split_x86_64.sh

gold/
* testsuite/split_x86_64.sh: Fix bad regexp.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 28 Mar 2018 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in

6 years agoRemove cleanups from prompt_for_continue
Tom Tromey [Thu, 22 Mar 2018 16:41:58 +0000 (10:41 -0600)]
Remove cleanups from prompt_for_continue

This removes the cleanups from prompt_for_continue by the use of
unique_xmalloc_ptr.

gdb/ChangeLog
2018-03-27  Tom Tromey  <tom@tromey.com>

* utils.c (prompt_for_continue): Use unique_xmalloc_ptr.

6 years agoRemove cleanups from gdb_readline_wrapper
Tom Tromey [Thu, 22 Mar 2018 16:31:41 +0000 (10:31 -0600)]
Remove cleanups from gdb_readline_wrapper

This removes some cleanups from gdb_readline_wrapper by changing the
existing gdb_readline_wrapper_cleanup struct to have a constructor and
destructor, and then changing gdb_readline_wrapper to simply
instantiate it on the stack.

gdb/ChangeLog
2018-03-27  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tom@tromey.com>

* top.c (class gdb_readline_wrapper_cleanup): Add constructor,
destructor.  Now a class.
(gdb_readline_wrapper_cleanup): Remove function.
(gdb_readline_wrapper): Remove cleanups.

6 years agoC++-ify typedef hash
Tom Tromey [Wed, 14 Mar 2018 22:38:02 +0000 (16:38 -0600)]
C++-ify typedef hash

This changes the typedef_hash_table structure to be a C++ class.  It
adds constructors and destructors and changes some functions to be
methods of the class.  Then it changes the various users of this class
to adapt.  This allows for the removal of some cleanups.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-27  Tom Tromey  <tom@tromey.com>

* typeprint.h (struct type_print_options) <local_typedefs,
global_typedefs>: Remove "struct" keyword.
(class typedef_hash_table): New class.
(recursively_update_typedef_hash, add_template_parameters)
(create_typedef_hash, free_typedef_hash, copy_typedef_hash)
(find_typedef_in_hash): Don't declare.
* typeprint.c (struct typedef_hash_table): Move to typeprint.h.
(typedef_hash_table::recursively_update): Rename from
recursively_update_typedef_hash.  Now a member.
(typedef_hash_table::add_template_parameters): Rename from
add_template_parameters.  Now a member.
(typedef_hash_table::typedef_hash_table): Now a constructor;
rename from create_typedef_hash.
(typedef_hash_table::~typedef_hash_table): Now a destructor;
rename from free_typedef_hash.
(do_free_typedef_hash, make_cleanup_free_typedef_hash)
(do_free_global_table): Remove.
(typedef_hash_table::typedef_hash_table): New constructor; renamed
from copy_type_recursive.
(create_global_typedef_table): Remove.
(typedef_hash_table::find_global_typedef): Now a member of
typedef_hash_table.
(typedef_hash_table::find_typedef): Rename from
find_typedef_in_hash; now a member.
(whatis_exp): Update.
* extension.h (struct ext_lang_type_printers): Add constructor and
destructor.
(start_ext_lang_type_printers, free_ext_lang_type_printers): Don't
declare.
* extension.c (ext_lang_type_printers::ext_lang_type_printers):
Now a constructor; rename from start_ext_lang_type_printers.
(ext_lang_type_printers): Now a destructor; rename from
free_ext_lang_type_printers.
* c-typeprint.c (find_typedef_for_canonicalize, c_print_type_1):
Update.
(c_type_print_base_struct_union): Update.  Remove cleanups.

6 years agoInclude <cmath> in dwarf-index-write.c
Tom Tromey [Tue, 27 Mar 2018 14:55:13 +0000 (08:55 -0600)]
Include <cmath> in dwarf-index-write.c

On x86-64 Fedora 26, when building with the system gcc, I get:

../../binutils-gdb/gdb/dwarf-index-write.c: In member function ‘void debug_names::build()’:
../../binutils-gdb/gdb/dwarf-index-write.c:705:13: error: ‘pow’ is not a member of ‘std’

There are actually more messages, but this is sufficient to show the
problem.

The fix is to include <cmath>.

I'm checking this in as obvious.  Tested by building.

gdb/ChangeLog
2018-03-27  Tom Tromey  <tom@tromey.com>

* dwarf-index-write.c: Include <cmath>.

6 years agoset varsize-limit: New GDB setting for maximum dynamic object size
Joel Brobecker [Tue, 27 Mar 2018 14:17:45 +0000 (09:17 -0500)]
set varsize-limit: New GDB setting for maximum dynamic object size

This is a command we somehow forgot to contribute at the time the Ada
language was first contributed to the FSF. This command allows
the user to change the maximum size we allow when reading memory
from dynamic objects (the default is 65536 bytes).

At the moment, this limit is only used by Ada, and so the implementation
is kept inside ada-lang.c. However, it is conceivable that other language
might want to use it also to handle the same kind of issues; for instance,
this might be useful when handling dynamic types in C. So the name
of the setting was made language-neutral, to allow for this.

Note that an alias for "set var" needs to be introduced as well.
We are not adding a test for that, since this is a feature that is
already exercized by numerous existing tests.

gdb/ChangeLog

        * NEWS: Add entry describing new "set|show varsize-limit" command.
        * ada-lang.c (_initialize_ada_language): Add "set/show varsize-limit"
        command.
        * printcmd.c (_initialize_printcmd): Add "set var" alias of
        "set variable".

gdb/doc/ChangeLog:

        * gdb.texinfo (Ada Settings): New subsubsection.

gdb/testsuite/ChangeLog:

        * gdb.ada/varsize_limit: New testcase.

Tested on x86_64-linux.

6 years agoMove DWARF index-related things to a separate file
Simon Marchi [Tue, 27 Mar 2018 14:07:44 +0000 (10:07 -0400)]
Move DWARF index-related things to a separate file

I want to add a DWARF index-related feature (automatically produce index
files when loading objfiles in GDB), but I don't want to add many
hundred lines to the already too big dwarf2read.c.  I thought it would
be a logical split to move everything related to the DWARF index to its
own file.

I first tried to move everything that reads and writes DWARF indices to
a separate file, but found that the "read" part is a little bit
entangled with the rest of dwarf2read.c, so the line is hard to draw
about where to split.  The write part is quite isolated though, so I
moved this part to a new file, dwarf-index-write.c.  Some things are
necessary to both reading and writing indices, so I placed them in
dwarf-index-common.{c,h}.  The idea would be to have a
dwarf-index-read.c eventually that would use it too (for now that code
is still in dwarf2read.c).

This required moving some things to a new dwarf2read.h header, so they
can be read by the code that writes the index.

The patch is big in number of lines, but it's all existing code being
moved around.  The only changes are that some functions are not static
anymore, a declaration is added in a .h file, and therefore the comment
is moved there.

I built-tested it with a little and big endian target.

This patch is also available on the users/simark/split-dwarf2read
branch.

gdb/ChangeLog:

* Makefile.in (COMMON_SFILES): Add dwarf-index-common.c and
dwarf-index-write.c
(HFILES_NO_SRCDIR): Add dwarf-index-common.h and dwarf2read.h.
* dwarf-index-common.c: New file.
* dwarf-index-common.h: New file.
* dwarf-index-write.c: New file.
* dwarf2read.c: Include dwarf2read.h and dwarf-index-common.h.
(struct dwarf2_section_info): Move from here.
(dwarf2_section_info_def): Likewise.
(DEF_VEC_O (dwarf2_section_info_def)): Likewise.
(offset_type): Likewise.
(DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE): Likewise.
(DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE): Likewise.
(DW2_GDB_INDEX_CU_SET_VALUE): Likewise.
(byte_swap): Likewise.
(MAYBE_SWAP): Likewise.
(dwarf2_per_cu_ptr): Likewise.
(DEF_VEC_P (dwarf2_per_cu_ptr)): Likewise.
(struct tu_stats): Likewise.
(struct dwarf2_per_objfile): Likewise.
(struct dwarf2_per_cu_data): Likewise.
(struct signatured_type): Likewise.
(sig_type_ptr): Likewise.
(DEF_VEC_P (sig_type_ptr)): Likewise.
(INDEX4_SUFFIX): Likewise.
(INDEX5_SUFFIX): Likewise.
(DEBUG_STR_SUFFIX): Likewise.
(dwarf2_read_section): Make non-static.
(mapped_index_string_hash): Move from here.
(dwarf5_djb_hash): Likewise.
(file_write): Likewise.
(class data_buf): Likewise.
(struct symtab_index_entry): Likewise.
(struct mapped_symtab): Likewise.
(find_slot): Likewise.
(hash_expand): Likewise.
(add_index_entry): Likewise.
(uniquify_cu_indices): Likewise.
(class c_str_view): Likewise.
(class c_str_view_hasher): Likewise.
(class vector_hasher): Likewise.
(write_hash_table): Likewise.
(psym_index_map): Likewise.
(struct addrmap_index_data): Likewise.
(add_address_entry): Likewise.
(add_address_entry_worker): Likewise.
(write_address_map): Likewise.
(symbol_kind): Likewise.
(write_psymbols): Likewise.
(struct signatured_type_index_data): Likewise.
(write_one_signatured_type): Likewise.
(recursively_count_psymbols): Likewise.
(recursively_write_psymbols): Likewise.
(class debug_names): Likewise.
(check_dwarf64_offsets): Likewise.
(psyms_seen_size): Likewise.
(write_gdbindex): Likewise.
(write_debug_names): Likewise.
(assert_file_size): Likewise.
(write_psymtabs_to_index): Likewise.
(save_gdb_index_command): Likewise.
(_initialize_dwarf2_read): Don't register the "save gdb-index"
command.
* dwarf2read.h: New file.

6 years agoproblem looking up some symbols when they have a linkage name
Joel Brobecker [Tue, 27 Mar 2018 13:57:16 +0000 (08:57 -0500)]
problem looking up some symbols when they have a linkage name

This patch fixes a known failure in gdb.ada/maint_with_ada.exp
(maintenance check-psymtabs). Another way to witness the same
issue is by considering the following Ada declarations...

   type Wrapper is record
      A : Integer;
   end record;
   u00045 : constant Wrapper := (A => 16#060287af#);
   pragma Export (C, u00045, "symada__cS");

... which declares a variable name "u00045" but with a linkage
name which is "symada__cS". This variable is a record with one
component, the Ada equivalent of a struct with one field in C.
Trying to print that variable's value currently yields:

    (gdb) p /x <symada__cS>
    'symada(char, signed)' has unknown type; cast it to its declared type

This indicates that GDB was only able to find the minimal symbol,
but not the full symbol. The expected output is:

    (gdb) print /x <symada__cS>
    $1 = (a => 0x60287af)

The error message gives a hint about what's happening: We processed
the symbol through gdb_demangle, which in the case of this particular
symbol name, ends up matching the C++ naming scheme. As a result,
the demangler transforms our symbol name into 'symada(char, signed)',
thus breaking Ada lookups.

This patch fixes the issue by first introducing a new language_defn
attribute called la_store_sym_names_in_linkage_form_p, which is a boolean
to be set to true for the few languages that do not want their symbols
to have their names stored in demangled form, and false otherwise.
We then use this language attribute to skip the call to gdb_demangle
for all languages whose la_store_sym_names_in_linkage_form_p is true.

In terms of the selection of languages for which the new attribute
is set to true, the selection errs on the side of preserving the
existing behavior, and only changes the behavior for the languages
where we are certain storing symbol names in demangling form is not
needed. It is conceivable that other languages might be in the same
situation, but I not knowing in detail the symbol name enconding
strategy, I decided to play it safe and let other language maintainers
potentially adjust their language if it makes sense to do so.

gdb/ChangeLog:

        PR gdb/22670
        * dwarf2read.c (dwarf2_physname): Do not return the demangled
        symbol name if the CU's language stores symbol names in linkage
        format.
        * language.h (struct language_defn)
        <la_store_sym_names_in_linkage_form_p>: New field.  Adjust
        all instances of this struct.

gdb/testsuite/ChangeLog:

        * gdb.ada/maint_with_ada.exp: Remove PR gdb/22670 setup_kfail.

        * gdb.ada/notcplusplus: New testcase.

        * gdb.base/c-linkage-name.c: New file.
        * gdb.base/c-linkage-name.exp: New testcase.

Tested on x86_64-linux.
This also passes AdaCore's internal GDB testsuite.

6 years agoRemove verbose code from backtrace command
Tom Tromey [Fri, 23 Mar 2018 16:40:00 +0000 (10:40 -0600)]
Remove verbose code from backtrace command

In https://sourceware.org/ml/gdb-patches/2017-06/msg00741.html,
Pedro asks:

> Doesn't the "info verbose on" bit affect frame filters too?

The answer is that yes, it could.  However, it's not completely
effective, because the C code can't guess how many frames might need
to be unwound to satisfy the request -- a frame filter will request as
many frames as it needs.

Also, I tried removing this code from backtrace, and I think the
result is better without it.  In particular, now the expansion line
occurs just before the frame that caused the expansion, like:

    (gdb) bt no-filters
    #0  0x00007ffff576cecd in poll () from /lib64/libc.so.6
    Reading in symbols for ../../binutils-gdb/gdb/event-loop.c...done.
    #1  0x00000000007ecc33 in gdb_wait_for_event (block=1)
at ../../binutils-gdb/gdb/event-loop.c:772
    #2  0x00000000007ec006 in gdb_do_one_event ()
at ../../binutils-gdb/gdb/event-loop.c:347
    #3  0x00000000007ec03e in start_event_loop ()
at ../../binutils-gdb/gdb/event-loop.c:371
    Reading in symbols for ../../binutils-gdb/gdb/main.c...done.
    #4  0x000000000086693d in captured_command_loop (
Reading in symbols for ../../binutils-gdb/gdb/exceptions.c...done.
    data=0x0) at ../../binutils-gdb/gdb/main.c:325

So, I am proposing this patch to simply remove this code.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* stack.c (backtrace_command_1): Remove verbose code.

6 years agoSimplify exception handling in py-framefilter.c
Tom Tromey [Fri, 23 Mar 2018 16:32:26 +0000 (10:32 -0600)]
Simplify exception handling in py-framefilter.c

This patch changes py-framefilter.c as suggested by Pedro in:
https://sourceware.org/ml/gdb-patches/2017-06/msg00748.html

In particular, gdb exceptions are now caught at the outermost layer,
rather than in each particular function.  This simplifies much of the
code.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* python/py-framefilter.c (py_print_type): Don't catch
exceptions.  Return void.
(py_print_value): Likewise.
(py_print_single_arg): Likewise.
(enumerate_args): Don't catch exceptions.
(py_print_args): Likewise.
(py_print_frame): Likewise.
(gdbpy_apply_frame_filter): Catch exceptions here.

6 years agoImprove "backtrace" help text
Tom Tromey [Fri, 23 Mar 2018 16:29:28 +0000 (10:29 -0600)]
Improve "backtrace" help text

This improves help text in stack.c in two ways.  First, it removes
trailing newlines from various help strings.  I think these are never
needed.  Second, it adds a "Usage" line to the "backtrace" text, as
suggested by Pedro.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* stack.c (_initialize_stack): Remove trailing newlines from help
text.  Add "Usage" line to "backtrace" help.

6 years agoCall wrap_hint in one more spot in py-framefilter.c
Tom Tromey [Tue, 25 Apr 2017 03:59:43 +0000 (21:59 -0600)]
Call wrap_hint in one more spot in py-framefilter.c

PR python/16486 notes that "bt" output is still wrapped differently
when a frame filter is in use.  This patch brings it a bit closer by
adding one more wrap_hint call, in a place where stack.c does this as
well.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

PR python/16486:
* python/py-framefilter.c (py_print_args): Call wrap_hint.

6 years agoReturn EXT_LANG_BT_ERROR in one more spot in py-framefilter.c
Tom Tromey [Tue, 25 Apr 2017 03:41:56 +0000 (21:41 -0600)]
Return EXT_LANG_BT_ERROR in one more spot in py-framefilter.c

While reading py-framefilter.c, I found one spot where an exception
could be caught but then not be turned into EXT_LANG_BT_ERROR.  This
patch fixes this spot.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* python/py-framefilter.c (py_print_single_arg): Return
EXT_LANG_BT_ERROR from catch.

6 years agoMove some code later in backtrace_command_1
Tom Tromey [Tue, 25 Apr 2017 03:03:22 +0000 (21:03 -0600)]
Move some code later in backtrace_command_1

PR backtrace/15584 notes that some code in backtrace_command_1 is not
useful when frame filters are in use.  This patch moves this code into
the no-frame-filters "if".  This also removes the unused local
"trailing_level", which I noticed while moving the code around.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

PR backtrace/15584:
* stack.c (backtrace_command_1): Move some code into no-filters
"if".

6 years agoThrow a "quit" on a KeyboardException in py-framefilter.c
Tom Tromey [Tue, 25 Apr 2017 03:47:59 +0000 (21:47 -0600)]
Throw a "quit" on a KeyboardException in py-framefilter.c

If a C-c comes while the Python code for a frame filter is running, it
will be turned into a Python KeyboardException.  It seems good for
this to be treated like a GDB quit, so this patch changes
py-framefilter.c to notice this situation and call throw_quit in this
case.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* python/py-framefilter.c (throw_quit_or_print_exception): New
function.
(gdbpy_apply_frame_filter): Use it.

gdb/testsuite/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* gdb.python/py-framefilter.exp: Add test for KeyboardInterrupt.
* gdb.python/py-framefilter.py (name_error): New global.
(ErrorInName.function): Use name_error.

6 years agoAllow C-c to work in backtrace in more cases
Tom Tromey [Tue, 25 Apr 2017 02:59:37 +0000 (20:59 -0600)]
Allow C-c to work in backtrace in more cases

PR cli/17716 notes that it is difficult to C-c (or "q" at a pagination
prompt) while backtracing using a frame filter.  One reason for this
is that many places in py-framefilter.c use RETURN_MASK_ALL in a
try/catch.

This patch changes these spots to use RETURN_MASK_ERROR instead.  This
is safe to do because this entire file is exception safe now.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

PR cli/17716:
* python/py-framefilter.c (py_print_type, py_print_value)
(enumerate_args, py_print_args, gdbpy_apply_frame_filter): Use
RETURN_MASK_ERROR.

6 years agoAvoid manual resource management in py-framefilter.c
Tom Tromey [Sun, 23 Apr 2017 17:23:43 +0000 (11:23 -0600)]
Avoid manual resource management in py-framefilter.c

This patch removes the last bit of manual resource management from
py-framefilter.c.  This will be useful in the next patch.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* python/py-framefilter.c (enumerate_args): Use
gdb::unique_xmalloc_ptr.

6 years agoRemove EXT_LANG_BT_COMPLETED
Tom Tromey [Sun, 23 Apr 2017 17:07:26 +0000 (11:07 -0600)]
Remove EXT_LANG_BT_COMPLETED

While looking at the frame filter code, I noticed that
EXT_LANG_BT_COMPLETED is not really needed.  Semantically there is no
difference between the "completed" and "ok" results.  So, this patch
removes this constant.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* python/py-framefilter.c (py_print_frame): Return
EXT_LANG_BT_OK.
(gdbpy_apply_frame_filter): Update comment.
* extension.h (enum ext_lang_bt_status) <EXT_LANG_BT_COMPLETED>:
Remove.
<EXT_LANG_BT_NO_FILTERS>: Change value.

6 years agoAllow hiding of some filtered frames
Tom Tromey [Sun, 23 Apr 2017 17:03:57 +0000 (11:03 -0600)]
Allow hiding of some filtered frames

When a frame filter elides some frames, they are still printed by
"bt", indented a few spaces.  PR backtrace/15582 notes that it would
be nice for users if elided frames could simply be dropped.  This
patch adds this capability.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

PR backtrace/15582:
* stack.c (backtrace_command): Parse "hide" argument.
* python/py-framefilter.c (py_print_frame): Handle PRINT_HIDE.
* extension.h (enum frame_filter_flags) <PRINT_HIDE>: New
constant.

gdb/doc/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

PR backtrace/15582:
* gdb.texinfo (Backtrace): Mention "hide" argument.

gdb/testsuite/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

PR backtrace/15582:
* gdb.python/py-framefilter.exp: Add "bt hide" test.

6 years agoChange backtrace_command_1 calling to use flags
Tom Tromey [Sun, 23 Apr 2017 17:02:52 +0000 (11:02 -0600)]
Change backtrace_command_1 calling to use flags

The next patch will add more flags to backtrace_command_1; and rather
than add another boolean argument, this patch changes it to accept a
flags value.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* stack.c (backtrace_command_1): Remove "show_locals" parameter,
add "flags".
(backtrace_command): Remove "fulltrace", add "flags".

6 years agoRationalize "backtrace" command line parsing
Tom Tromey [Sun, 23 Apr 2017 16:54:33 +0000 (10:54 -0600)]
Rationalize "backtrace" command line parsing

The backtrace command has peculiar command-line parsing.  In
particular, it splits the command line, then loops over the arguments.
If it sees a word it recognizes, like "full", it effectively drops
this word from the argument vector.  Then, it pastes together the
remaining arguments, passing them on to backtrace_command_1, which in
turn passes the resulting string to parse_and_eval_long.

The documentation doesn't mention the parse_and_eval_long at all, so
it is a bit of a hidden feature that you can "bt 3*2".  The strange
algorithm above also means you can "bt 3 * no-filters 2" and get 6
frames...

This patch changes backtrace's command line parsing to be a bit more
rational.  Now, special words like "full" are only recognized at the
start of the command.

This also updates the documentation to describe the various bt options
individually.

gdb/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* stack.c (backtrace_command): Rewrite command line parsing.

gdb/doc/ChangeLog
2018-03-26  Tom Tromey  <tom@tromey.com>

* gdb.texinfo (Backtrace): Describe options individually.

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