Pedro Franco de Carvalho [Fri, 9 Aug 2019 19:49:46 +0000 (16:49 -0300)]
Fix access to uninitialized variable in fill_in_stop_func
This patch changes find_pc_partial_function so that *block is set to
nullptr when it fails, so that fill_in_stop_func won't access an
uninitialized variable.
gdb/ChangeLog:
2019-08-09 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* blockframe.c (find_pc_partial_function): Set *block to nullptr
when the function fails.
Andreas Arnez [Fri, 9 Aug 2019 18:27:03 +0000 (20:27 +0200)]
s390: Implement 'type_align' gdbarch method
The align.exp test case yields many FAILs on s390x, since GDB's _Alignoff
doesn't always agree with the compiler's. On s390x, the maximum alignment
is 8, but GDB returns an alignment of 16 for 16-byte data types such as
"long double".
This is fixed by implementing the type_align gdbarch method. The new
method returns an alignment of 8 for all integer, floating-point, and
vector types larger than 8 bytes. With this change, all align.exp tests
pass.
gdb/ChangeLog:
* s390-tdep.c (s390_type_align): New function.
(s390_gdbarch_init): Set it as type_align gdbarch method.
Nick Clifton [Fri, 9 Aug 2019 15:16:18 +0000 (16:16 +0100)]
Synchronize libiberty sources with gcc mainline.
* libiberty: Sync with gcc. Bring in:
2019-08-08 Martin Liska <mliska@suse.cz>
PR bootstrap/91352
* lrealpath.c (is_valid_fd): New function.
2019-07-24 Martin Liska <mliska@suse.cz>
PR lto/91228
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Find first '\0' starting from gnu_lto + 1.
2019-07-12 Ren Kimura <rkx1209dev@gmail.com>
* simple-object-elf.c (simple_object_elf_match): Check zero value shstrndx.
This fixes a Bug 90924.
2019-07-22 Martin Liska <mliska@suse.cz>
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
Do not search for gnu_lto_v1, but search for first '\0'.
2019-07-18 Eduard-Mihai Burtescu <eddyb@lyken.rs>
* cplus-dem.c: Include rust-demangle.h.
* rust-demangle.c: Include rust-demangle.h.
* rust-demangle.h: New file.
2019-05-31 Michael Forney <mforney@mforney.org>
* cp-demangle.c: Don't define CP_DYNAMIC_ARRAYS if __STDC_NO_VLA__
is non-zero.
2019-04-30 Ben L <bobsayshilol@live.co.uk>
* d-demangle.c (dlang_parse_assocarray): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.
* d-demangle.c (dlang_parse_tuple): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.
* d-demangle.c (dlang_parse_structlit): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.
* d-demangle.c (dlang_parse_arrayliteral): Correctly handle error result.
* testsuite/d-demangle-expected: Add testcase.
* d-demangle.c (dlang_parse_integer): Fix stack underflow.
* testsuite/d-demangle-expected: Add testcase.
* cp-demangle (d_print_comp_inner): Guard against a NULL 'typed_name'.
* testsuite/demangle-expected: Add testcase.
* cp-demangle.c (d_encoding): Guard against NULL return values from
d_right (dc).
* testsuite/demangle-expected: Add testcase.
2019-04-29 Ben L <bobsayshilol@live.co.uk>
* cp-demangle.c (d_expression_1): Don't peek ahead unless the current
char is valid.
* testsuite/demangle-expected: Add testcase.
2019-04-10 Nick Clifton <nickc@redhat.com>
PR 89394
* cp-demangle.c (cplus_demangle_fill_name): Reject negative
lengths.
(d_count_templates_scopes): Replace num_templates and num_scopes
parameters with a struct d_print_info pointer parameter. Adjust
body of the function accordingly. Add recursion counter and check
that the recursion limit is not reached.
(d_print_init): Pass dpi parameter to d_count_templates_scopes.
Reset recursion counter afterwards, unless the recursion limit was
reached.
Mihailo Stojanovic [Fri, 9 Aug 2019 10:06:37 +0000 (11:06 +0100)]
Add support for a MIPS specific .MIPS.xhash section.
This patch is a reimplementation of [1] which was submitted in 2015 by
Neil Schellenberger. Copyright issue was sorted out [2] last year.
It proposed a new section (.gnu.xhash) and related dynamic tag
(DT_GNU_XHASH). The new section would be virtually identical to the
existing .gnu.hash except for the translation table (xlat) which would
contain correct MIPS .dynsym indexes corresponding to the hashvals in
chains. This is because MIPS ABI imposes a different ordering on the
dynsyms than the one expected by the .gnu.hash section. Another addition
would be a leading word (ngnusyms) which would contain the number of
entries in the translation table.
In this patch, the new section name and dynamic tag are changed to
reflect the fact that the section should be treated as MIPS-specific
(.MIPS.xhash and DT_MIPS_XHASH).
This patch addresses the alignment issue as reported in [3], which is
caused by the leading word added to the .MIPS.xhash section. Leading word
is removed in this patch, and the number of entries in the translation
table is now calculated using DT_MIPS_SYMTABNO dynamic tag (this is
addressed by the corresponding glibc patch).
Suggestions on coding style in [4] were taken into account. Existing
GNU hash testcase was covered, and another one was added in the MIPS
part of the testsuite.
The other major change is reserving MIPS ABI version 5 for .MIPS.xhash,
marking the need of support for .MIPS.xhash in the dynamic linker (again,
addressed in the corresponding glibc patch). This is something which I
am not sure of, especially after reading [5]. I am confused on whether
this ABI version is reserved for IFUNC, or it can be used for this
purpose.
Already mentioned glibc patch is submitted at:
https://sourceware.org/ml/libc-alpha/2019-06/msg00456.html
[1] https://sourceware.org/ml/binutils/2015-10/msg00057.html
[2] https://sourceware.org/ml/binutils/2018-03/msg00025.html
[3] https://sourceware.org/ml/binutils/2016-01/msg00006.html
[4] https://sourceware.org/ml/binutils/2016-02/msg00097.html
[5] https://sourceware.org/ml/libc-alpha/2016-12/msg00853.html
ld * emulparams/elf32bmip.sh: Add .MIPS.xhash section.
* emulparams/elf32bmipn32-defs.sh: Add .MIPS.xhash section.
* emulparams/elf64bmip-defs.sh: Add .MIPS.xhash section.
* emultempl/mipself.em: Remove mips_after_parse function.
* testsuite/ld-elf/hash.d: Update comment.
* testsuite/ld-mips-elf/hash1.d: New test.
* testsuite/ld-mips-elf/hash1.s: Ditto.
* testsuite/ld-mips-elf/hash1a.d: Remove.
* testsuite/ld-mips-elf/hash1b.d: Ditto.
* testsuite/ld-mips-elf/hash1c.d: Ditto
* testsuite/ld-mips-elf/hash2.d: New test.
* testsuite/ld-mips-elf/mips-elf.exp: New tests.
* testsuite/ld-mips-elf/start.s: New test.
bfd * elf-bfd.h (struct elf_backend_data): New members.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Create
.gnu.hash section if necessary.
(struct collect_gnu_hash_codes): New member.
(elf_gnu_hash_process_symidx): New function name.
(elf_renumber_gnu_hash_syms): Ignore local and undefined
symbols. Record xlat location for every symbol which should have
a .MIPS.xhash entry.
(bfd_elf_size_dynamic_sections): Add DT_GNU_HASH dynamic tag to
dynamic section if necessary.
(GNU_HASH_SECTION_NAME): New define.
(bfd_elf_size_dynsym_hash_dynstr): Get .MIPS.xhash section.
Update the section size info.
* elfxx-mips.c (struct mips_elf_hash_sort_data): New members.
(struct mips_elf_link_hash_entry): New member.
(mips_elf_link_hash_newfunc): Initialize .MIPS.xhash translation
table location.
(mips_elf_sort_hash_table): Initialize the pointer to the
.MIPS.xhash section.
(mips_elf_sort_hash_table_f): Populate the .MIPS.xhash
translation table entry with the symbol dynindx.
(_bfd_mips_elf_section_from_shdr): Add SHT_MIPS_XHASH.
(_bfd_mips_elf_fake_sections): Initialize .MIPS.xhash section
info.
(_bfd_mips_elf_create_dynamic_sections): Create .MIPS.xhash
section.
(_bfd_mips_elf_size_dynamic_sections): Add DT_MIPS_XHASH tag to
dynamic section.
(_bfd_mips_elf_finish_synamic_sections): Add DT_MIPS_XHASH.
(_bfd_mips_elf_final_write_processing): Set .MIPS.xhash section
sh_link info.
(_bfd_mips_elf_get_target_dtag): Get DT_MIPS_XHASH tag.
(MIPS_LIBC_ABI_XHASH): New ABI version enum value.
(_bfd_mips_post_process_headers): Mark the ABI version as
MIPS_LIBC_ABI_XHASH if there exists a .MIPS.xhash section,
but not a .hash section.
(_bfd_mips_elf_record_xhash_symbol): New function. Record a
position in the translation table, associated with the hash
entry.
* elfxx-mips.h (literal_reloc_p): Define
elf_backend_record_xhash_symbol backend hook.
* elfxx-target.h: Initialize elf_backend_record_xhash_symbol
backend hook.
include * elf/mips.h (SHT_GNU_XHASH): New define.
(DT_GNU_XHASH): New define.
binutils * readelf.c (get_mips_dynamic_type): Return MIPS_XHASH dynamic type.
(get_mips_section_type_name): Return MI{S_XHASH name string.
(dynamic_section_mips_val): Initialize the .MIPS.xhash dynamic
info.
(process_symbol_table): Initialize the .MIPS.xhash section
pointer. Adjust the readelf output to support the new section.
(process_object): Set the .MIPS.xhash dynamic info to zero.
Alan Hayward [Thu, 8 Aug 2019 08:01:12 +0000 (09:01 +0100)]
doc: fix PAC typo
gdb/doc/ChangeLog:
* gdb.texinfo (AArch64 Pointer Authentication): Fix typo.
Tamar Christina [Fri, 9 Aug 2019 08:06:50 +0000 (09:06 +0100)]
Arm: Skip tests on WINCE that require mapping symbols
The following tests fail on wince as they rely on mapping symbols to
give them a fixed order.
This skips them on platforms that don't have mapping symbols.
binutils/ChangeLog:
* testsuite/binutils-all/arm/in-order-all.d: Skip on pe, wince, coff.
* testsuite/binutils-all/arm/in-order.d: Likewise.
* testsuite/binutils-all/arm/out-of-order-all.d: Likewise.
* testsuite/binutils-all/arm/out-of-order.d: Likewise.
Jan Beulich [Fri, 9 Aug 2019 07:57:57 +0000 (09:57 +0200)]
x86-64: generalize SIMD test expectations
In order to be able to add/remove insns to/from the middle of these
tests, generalize the patterns for the symbol reference comments of RIP-
relative operands.
Tom de Vries [Fri, 9 Aug 2019 04:49:04 +0000 (06:49 +0200)]
[gdb] Fix gdb.dwarf2/varval.exp with -fPIE/-pie
With target board unix/-fPIE/-pie, we get:
...
FAIL: gdb.dwarf2/varval.exp: print varval2
...
This is due comparing a get_frame_pc result (which includes the for PIE
non-zero relocation offset) with pc_high and pc_low obtained using
get_scope_pc_bounds (which do not include the relocation offset).
Fix this by adjusting pc_high and pc_low with the relocation offset.
Tested on x86_64-linux with target board unix/-fPIE/-pie.
gdb/ChangeLog:
2019-08-09 Tom de Vries <tdevries@suse.de>
PR gdb/24591
* dwarf2read.c (dwarf2_fetch_die_loc_sect_off): Adjust pc_high and
pc_low with relocation offset.
GDB Administrator [Fri, 9 Aug 2019 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Thu, 8 Aug 2019 20:26:28 +0000 (22:26 +0200)]
[gdb/testsuite] Fix gdb.tui/basic.exp with check-read1
With gdb.tui/basic.exp and check-read1, we run into (using -v for
verbose log):
...
^[[0+++ _csi_0 <<<>>>
ERROR: (DejaGnu) proc "_csi_0" does not exist.
...
In contrast, without check-read1, we have:
...
^[[0;10m<SNIP>+++ _csi_m <<<0;10>>>
...
The problem is that this regexp in _accept:
...
-re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" {
...
while matching the longer sequence '^[' '[' '0' ';' '1' '0' 'm', also matches
the shorter sequence '^[' '[' '0'.
The regexp attempts to match a CSI (Control Sequence Introducer) sequence, and
the final byte of such a sequence cannot be a digit.
Fix the regexp accordingly:
...
- -re "^\x1b\\\[(\[0-9;\]*)(\[0-9a-zA-Z@\])" {
+ -re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" {
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-08 Tom de Vries <tdevries@suse.de>
PR testsuite/24862
* lib/tuiterm.exp (_accept): Fix CSI regexp.
Nick Clifton [Thu, 8 Aug 2019 16:04:31 +0000 (17:04 +0100)]
Change the output of readelf's note display so that the "Data size" column header is left justified.
PR 24887
binutils* readelf.c (process_notes_at): Left justify the "Data size"
column heading.
* testsuite/binutils-all/i386/empty.d: Adjust for new output format.
* testsuite/binutils-all/i386/ibt.d: Likewise.
* testsuite/binutils-all/i386/pr21231a.d: Likewise.
* testsuite/binutils-all/i386/pr21231b.d: Likewise.
* testsuite/binutils-all/i386/shstk.d: Likewise.
* testsuite/binutils-all/note-2-32.d: Likewise.
* testsuite/binutils-all/note-2-64.d: Likewise.
* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
* testsuite/binutils-all/x86-64/empty.d: Likewise.
* testsuite/binutils-all/x86-64/ibt-x32.d: Likewise.
* testsuite/binutils-all/x86-64/ibt.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231a.d: Likewise.
* testsuite/binutils-all/x86-64/pr21231b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
* testsuite/binutils-all/x86-64/shstk-x32.d: Likewise.
* testsuite/binutils-all/x86-64/shstk.d: Likewise.
ld * testsuite/ld-aarch64/bti-plt-2.d: Adjust for new output format
from readelf.
* testsuite/ld-aarch64/bti-plt-4.d: Likewise.
* testsuite/ld-aarch64/bti-plt-6.d: Likewise.
* testsuite/ld-aarch64/bti-plt-7.d: Likewise.
* testsuite/ld-aarch64/bti-warn.d: Likewise.
* testsuite/ld-aarch64/property-bti-pac1.d: Likewise.
* testsuite/ld-aarch64/property-bti-pac2.d: Likewise.
* testsuite/ld-aarch64/property-bti-pac3.d: Likewise.
* testsuite/ld-elf/x86-feature-1a.rd: Likewise.
* testsuite/ld-elf/x86-feature-1b.rd: Likewise.
* testsuite/ld-elf/x86-feature-1c.rd: Likewise.
* testsuite/ld-elf/x86-feature-1d.rd: Likewise.
* testsuite/ld-elf/x86-feature-1e.rd: Likewise.
* testsuite/ld-i386/ibt-plt-2d.d: Likewise.
* testsuite/ld-i386/ibt-plt-3d.d: Likewise.
* testsuite/ld-i386/pr23372a.d: Likewise.
* testsuite/ld-i386/pr23372c.d: Likewise.
* testsuite/ld-i386/pr23486a.d: Likewise.
* testsuite/ld-i386/pr23486b.d: Likewise.
* testsuite/ld-i386/pr23486c.d: Likewise.
* testsuite/ld-i386/pr23486d.d: Likewise.
* testsuite/ld-i386/pr24322a.d: Likewise.
* testsuite/ld-i386/pr24322b.d: Likewise.
* testsuite/ld-i386/property-x86-3.d: Likewise.
* testsuite/ld-i386/property-x86-4a.d: Likewise.
* testsuite/ld-i386/property-x86-5.d: Likewise.
* testsuite/ld-i386/property-x86-cet1.d: Likewise.
* testsuite/ld-i386/property-x86-cet2a.d: Likewise.
* testsuite/ld-i386/property-x86-cet5a.d: Likewise.
* testsuite/ld-i386/property-x86-cet5b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt1b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt2.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
* testsuite/ld-i386/property-x86-ibt4.d: Likewise.
* testsuite/ld-i386/property-x86-ibt5.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk1b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk2.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk4.d: Likewise.
* testsuite/ld-i386/property-x86-shstk5.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2d.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
* testsuite/ld-x86-64/pr23372a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372a.d: Likewise.
* testsuite/ld-x86-64/pr23372c-x32.d: Likewise.
* testsuite/ld-x86-64/pr23372c.d: Likewise.
* testsuite/ld-x86-64/pr23486a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486a.d: Likewise.
* testsuite/ld-x86-64/pr23486b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486b.d: Likewise.
* testsuite/ld-x86-64/pr23486c-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486c.d: Likewise.
* testsuite/ld-x86-64/pr23486d-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486d.d: Likewise.
* testsuite/ld-x86-64/pr24322a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24322a.d: Likewise.
* testsuite/ld-x86-64/pr24322b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24322b.d: Likewise.
* testsuite/ld-x86-64/pr24458a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458a.d: Likewise.
* testsuite/ld-x86-64/pr24458b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458b.d: Likewise.
* testsuite/ld-x86-64/pr24458c-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458c.d: Likewise.
* testsuite/ld-x86-64/property-1.r: Likewise.
* testsuite/ld-x86-64/property-1a.r: Likewise.
* testsuite/ld-x86-64/property-2.r: Likewise.
* testsuite/ld-x86-64/property-2a.r: Likewise.
* testsuite/ld-x86-64/property-3.r: Likewise.
* testsuite/ld-x86-64/property-3a.r: Likewise.
* testsuite/ld-x86-64/property-4.r: Likewise.
* testsuite/ld-x86-64/property-4a.r: Likewise.
* testsuite/ld-x86-64/property-5.r: Likewise.
* testsuite/ld-x86-64/property-5a.r: Likewise.
* testsuite/ld-x86-64/property-6.r: Likewise.
* testsuite/ld-x86-64/property-7.r: Likewise.
* testsuite/ld-x86-64/property-7a.r: Likewise.
* testsuite/ld-x86-64/property-x86-3-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-3.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-4a.d: Likewise.
* testsuite/ld-x86-64/property-x86-5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-5.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet1-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet1.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet2a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5a.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-cet5b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt2.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt4.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt5.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk1b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk2.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk4.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk5.d: Likewise.
gas * testsuite/gas/i386/property-1.d: Adjust for new output format
from readelf.
* testsuite/gas/i386/property-2.d: Likewise.
* testsuite/gas/i386/x86-64-property-1.d: Likewise.
* testsuite/gas/i386/x86-64-property-2.d: Likewise.
Yoshinori Sato [Thu, 8 Aug 2019 12:59:17 +0000 (13:59 +0100)]
Update the handling of shift rotate and load/store multiple instructions in the H8300 assembler.
incldue * opcode/h8300.h (EXPAND_UNOP_EXTENDED_B): Add MODEL.
(EXPAND_UNOP_EXTENDED_W): Likewise.
(EXPAND_UNOP_EXTENDED_L): Likewise.
(struct h8_opcode h8_opcodes): Likewise.
(struct h8_opcode h8_opcodes): tas / ldm / stm supported H8S or
later.
Yoshinori Sato [Thu, 8 Aug 2019 12:43:13 +0000 (13:43 +0100)]
Move the h8300 assembler's MOVFPE and MOVTPE tests to the correct location.
* gas/testsuite/gas/h8300/h8300.exp: Fix movfpe and movtpe tests.
* gas/testsuite/gas/h8300/misc.s: Likewise.
* gas/testsuite/gas/h8300/misch.s: Likewise.
* gas/testsuite/gas/h8300/miscs.s: Likewise.
Nick Clifton [Thu, 8 Aug 2019 09:24:08 +0000 (10:24 +0100)]
Fix problem building PE DLL test generator with compilers that do not support c99/c11.
* testsuite/gentestdlls.c (main): Move declaration of loop
variable outside of the for() statement.
Jordan Rupprecht via binutils [Wed, 7 Aug 2019 20:48:14 +0000 (13:48 -0700)]
readelf: mask unknown description data bytes.
When printing unknown note types, readelf prints the raw description
section byte-by-byte. However, it does not mask appropriately, e.g. it
prints the byte 'ba' as '
ffffffba'.
* readelf.c (process_note): Mask unknown description data bytes.
GDB Administrator [Thu, 8 Aug 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Phillipe Antoine [Wed, 7 Aug 2019 16:22:29 +0000 (17:22 +0100)]
Prevent objdump from aborting when asked to disassemble an unknown type of ARC binary file.
PR 24854
* arc-dis.c (arc_insn_length): Return 0 rather than aborting when
encountering an unknown machine type.
(print_insn_arc): Handle arc_insn_length returning 0. In error
cases return -1 rather than calling abort.
Alan Modra [Wed, 7 Aug 2019 14:07:49 +0000 (23:37 +0930)]
Integer overflows in readelf get_data
I noticed the test for overflow of amt = size * nmemb in get_data
wasn't effective. An obvious example of nmemb = 3 and size = half max
value overflows but doesn't result in amt < nmemb. This patch fixes
this problem and reports a size truncation or overflow rather than out
of memory in more cases.
* readelf.c (get_data): Improve overflow checks.
Nick Clifton [Wed, 7 Aug 2019 14:15:59 +0000 (15:15 +0100)]
Improve the formatting of the title strings of the binutils manual pages.
PR 24777
* doc/binutils.texi: Ensure consistent formating of title strings
for man pages. Extend the title of the size man page to be more
informative.
Tom Tromey [Tue, 6 Aug 2019 19:50:03 +0000 (13:50 -0600)]
Make struct frame_arg self-managing
This changes struct frame_arg to be self-managing and then fixes the
various users.
Tested by the buildbot.
gdb/ChangeLog
2019-08-07 Tom Tromey <tromey@adacore.com>
* stack.c (print_frame_arg, read_frame_local, read_frame_arg)
(print_frame_args): Update.
* python/py-framefilter.c (py_print_single_arg, enumerate_args):
Update.
* mi/mi-cmd-stack.c (list_arg_or_local): Update.
* frame.h (struct frame_arg): Add initializers.
<error>: Now a unique_xmalloc_ptr.
Alan Hayward [Wed, 7 Aug 2019 08:47:57 +0000 (09:47 +0100)]
AArch64 pauth: Indicate unmasked addresses in backtrace
Armv8.3-a Pointer Authentication causes the function return address to be
obfuscated on entry to some functions. GDB must unmask the link register in
order to produce a backtrace.
The following patch adds markers of [PAC] to the bracktrace, to indicate
which addresses needed unmasking. This includes the backtrace when using MI.
For example, consider the following backtrace:
(gdb) bt
0 0x0000000000400490 in puts@plt ()
1 0x00000000004005dc in foo ("hello") at cbreak-lib.c:6
2 0x0000000000400604 [PAC] in bar () at cbreak-lib.c:12
3 0x0000000000400620 [PAC] in main2 () at cbreak.c:17
4 0x00000000004005b4 in main () at cbreak-3.c:10
The functions in cbreak-lib use pointer auth, which masks the return address
to the previous function, causing the addresses of bar (in the library) and main2
(in the main binary) to require unmasking in order to unwind the backtrace.
An extra bool is added alongside the prev_pc in the frame structure. At the
point at which the link register is unmasked, the AArch64 port calls into frame
to sets the bool. This is the most efficient way of doing it.
The marker is also added to the python frame printer, which is always printed if
set. The marker is not explicitly exposed to the python code.
I expect this will potentially cause issues with some tests in the testsuite
when Armv8.3 pointer authentication is used. This should be fixed up in the
the future once real hardware is available for full testsuite testing.
gdb/ChangeLog:
* NEWS: Expand the Pointer Authentication entry.
* aarch64-tdep.c (aarch64_frame_unmask_address): Rename from this.
(aarch64_frame_unmask_lr): ... to this.
(aarch64_prologue_prev_register, aarch64_dwarf2_prev_register):
Call aarch64_frame_unmask_lr.
* frame.c (struct frame_info): Add "masked" variable.
(frame_set_previous_pc_masked) (frame_get_pc_masked): New functions.
(fprint_frame): Check for masked pc.
* frame.h (frame_set_previous_pc_masked) (frame_get_pc_masked): New
declarations.
* python/py-framefilter.c (py_print_frame): Check for masked pc.
* stack.c (print_frame): Check for masked pc.
gdb/doc/ChangeLog:
* gdb.texinfo (AArch64 Pointer Authentication): New subsection.
Jose E. Marchesi [Wed, 7 Aug 2019 09:40:55 +0000 (11:40 +0200)]
ld: use a specific linker script in BPF targets
This patch makes the elf64bpf emulation to use it's own linker script,
based on elf.sc. At the moment, the only change is that the BPF
executable doesn't define an entry symbol (BPF programs feature
several entry points scattered in several sections.)
This is a step towards the goal of generating proper ELF executables
that would be loaded by the kernel's libbpf. We are not there yet:
BPF "programs" should still be linked with -r.
This change removes a warning while linking executables, decreases the
number of unsupported tests in the target from 47 to 29, and increases
the number of expected passes from 104 to 145.
Regtested in x86_64 for all targets.
No regressions.
ld/ChangeLog:
2019-08-07 Jose E. Marchesi <jose.marchesi@oracle.com>
* scripttempl/elf64bpf.sc: Adapted from elf.sc.
* emulparams/elf64bpf.sh (SCRIPT_NAME): Use elf64bpf.
(EMBEDDED): Define.
* testsuite/ld-bpf/call-1.d: Do not expect a warning regarding an
undefined entry symbol.
* testsuite/ld-bpf/jump-1.d: Likewise.
* testsuite/ld-undefined/undefined.exp: Do not pass '-e entry' to
ld in BPF targets, and do not expect line number information.
* testsuite/ld-srec/srec.exp (run_srec_test): xfail s-record tests
in BPF targets.
Jose E. Marchesi [Wed, 7 Aug 2019 09:33:13 +0000 (11:33 +0200)]
bfd: use the ELF linker to perform relocations in BPF targets
This patch changes the eBPF linker to provide a relocate_section
function instead of relying on using special functions in relocation
howtos.
Tested in x86_64 host.
No regressions.
bfd/ChangeLog:
2019-08-07 Jose E. Marchesi <jose.marchesi@oracle.com>
* elf64-bpf.c (bpf_elf_relocate_section): New function.
(bpf_elf_insn_disp_reloc): Delete function.
(elf_backend_relocate_section): Define.
Alan Modra [Wed, 7 Aug 2019 09:23:09 +0000 (18:53 +0930)]
PR24644, OOM-Bug in _bfd_archive_64_bit_slurp_armap
PR 24644
* archive64.c (_bfd_archive_64_bit_slurp_armap): Properly check
for overflow in expressions involving nsymz.
Omair Majid [Wed, 7 Aug 2019 09:20:56 +0000 (10:20 +0100)]
Fix the binutils test for .NET assembly support so that it distinguishing between targets which do not support the x86 PE format at all, and those that do support it, but which do not recognise the .NET assembly variants.
* testsuite/binutils-all/objdump.exp
(test_objdump_dotnet_assemblies): Fix test to distinguish errors
in parsing simple pei-i386 and pei-x86-64 vs parsing the newly
introduced machine types.
* testsuite/gentestdlls.c (write_simple_dll): New function.
(main): Generate simple and Linux-specific variants of pei-i386
and pei-x86-64 files so both can be used by tests.
Jan Beulich [Wed, 7 Aug 2019 08:46:52 +0000 (10:46 +0200)]
x86: drop stray FloatMF
The flag is supposed to be used in templates which allow for both a
"short" and a "long" format memory operand. Drop it from templates not
matching this pattern. In the control/status word cases it was (ab)used
in place of the intended IgnoreSize.
Alan Modra [Wed, 7 Aug 2019 02:20:28 +0000 (11:50 +0930)]
PR24876, readelf: heap-buffer-overflow in dump_ia64_unwind
PR 24876
* readelf.c (dump_ia64_unwind): Check that buffer is large
enough for "stamp" before reading.
Tom Tromey [Sat, 13 Jul 2019 18:13:15 +0000 (12:13 -0600)]
Introduce obstack_strndup
This introduces obstack_strndup and changes gdb to use it.
Note that obstack_strndup works like savestring, and not exactly like
xstrndup. The difference is that obstack_strndup uses the passed-in
length, while xstrndup uses strnlen to choose the length.
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* stabsread.c (patch_block_stabs, read_one_struct_field)
(read_enum_type): Use obstack_strndup.
* rust-exp.y (rust_parser::copy_name): Use obstack_strndup.
* gdb_obstack.h (obstack_strndup): Use obstack_strndup.
* dwarf2read.c (guess_full_die_structure_name)
(anonymous_struct_prefix): Use obstack_strndup.
* dbxread.c (cp_set_block_scope): Use obstack_strndup.
* c-exp.y (yylex): Use obstack_strndup.
* ada-exp.y (write_object_renaming, write_ambiguous_var)
(write_var_or_type): Use obstack_strndup.
Tom Tromey [Sat, 13 Jul 2019 18:09:51 +0000 (12:09 -0600)]
Add obstack_strdup overload taking a std::string
This adds an obstack_strdup overload that takes a std::string, and
changes a few spots in gdb to use it.
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Use obstack_strdup.
* stabsread.c (read_type): Use obstack_strdup.
* gdb_obstack.h (obstack_strdup): New overload.
* dwarf2read.c (dwarf2_compute_name, create_dwo_unit_in_dwp_v1)
(create_dwo_unit_in_dwp_v2, build_error_marker_type)
(dwarf2_canonicalize_name): Use obstack_strdup.
* dbxread.c (read_dbx_symtab): Use obstack_strdup.
* cp-support.c (inspect_type, replace_typedefs_qualified_name):
Use obstack_strdup.
Tom Tromey [Sat, 13 Jul 2019 18:03:07 +0000 (12:03 -0600)]
Make obstack_strdup inline
This changes obstack_strdup to be an inline function. This seems
better to me, considering how small it is; but also it follows what
the code did before the previous patch.
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* gdb_obstack.h (obstack_strdup): Define.
* gdb_obstack.c (obstack_strdup): Don't define.
Tom Tromey [Sat, 18 May 2019 21:56:03 +0000 (15:56 -0600)]
Use obstack_strdup more
This changes gdb to use obstack_strdup when appropriate, rather than
the wordier obstack_copy0.
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* xcoffread.c (SYMNAME_ALLOC, process_xcoff_symbol): Use
obstack_strdup.
* typeprint.c (typedef_hash_table::find_global_typedef): Use
obstack_strdup.
* symfile.c (allocate_compunit_symtab): Use obstack_strdup.
* stabsread.c (common_block_start): Use obstack_strdup.
* objfiles.c (set_objfile_main_name, objfile): Use
obstack_strdup.
* namespace.c (add_using_directive): Use obstack_strdup.
* mdebugread.c (parse_symbol, parse_type): Use obstack_strdup.
* jit.c (finalize_symtab): Use obstack_strdup.
* dwarf2read.c (fixup_go_packaging, dwarf2_physname)
(guess_partial_die_structure_name, partial_die_info::fixup)
(dwarf2_name): Use obstack_strdup.
* coffread.c (coff_read_struct_type, coff_read_enum_type): Use
obstack_strdup.
* c-exp.y (scan_macro_expansion): Use obstack_strdup.
* buildsym.c (buildsym_compunit::end_symtab_with_blockvector): Use
obstack_strdup.
* ada-lang.c (ada_decode_symbol): Use obstack_strdup.
GDB Administrator [Wed, 7 Aug 2019 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Wed, 31 Jul 2019 20:44:13 +0000 (22:44 +0200)]
Add a selftest that checks documentation invariants.
Several approaches were discussed (mail or irc) to verify the invariants of
the GDB help documentation : checking with apropos ., modifying add_cmd
to do the check and output a warning, implement maintenance check-doc.
A selftest was finally chosen as:
* this can be run on demand, including by users if they want
to check user defined commands.
* it does not interact with the normal behaviour of apropos, define,
python, ...
(such as output warnings when a user defines a command help that
does not respect the doc).
* when the selftest runs, it checks the user defined and python
defined commands currently defined.
gdb/ChangeLog
* unittests/help-doc-selftests.c: New file.
* Makefile.in: Add the new file.
Philippe Waroquiers [Sun, 9 Jun 2019 09:16:20 +0000 (11:16 +0200)]
Make first and last lines of 'command help documentation' consistent.
With this patch, the help docs now respect 2 invariants:
* The first line of a command help is terminated by a '.' character.
* The last character of a command help is not a newline character.
Note that the changes for the last invariant were done by Tom, as part of :
[PATCH] Remove trailing newlines from help text
https://sourceware.org/ml/gdb-patches/2019-06/msg00050.html
but some occurrences have been re-introduced since then.
Some help docs had to be rephrased/restructured to respect the above
invariants.
Before this patch, print_doc_line was printing the first line
of a command help documentation, but stopping at the first '.'
or ',' character.
This was giving inconsistent results :
* The first line of command helps was sometimes '.' terminated,
sometimes not.
* The first line of command helps was not always designed to be
readable/understandable/unambiguous when stopping at the first
'.' or ',' character.
This e.g. created the following inconsistencies/problems:
< catch exception -- Catch Ada exceptions
< catch handlers -- Catch Ada exceptions
< catch syscall -- Catch system calls by their names
< down-silently -- Same as the `down' command
while the new help is:
> catch exception -- Catch Ada exceptions, when raised.
> catch handlers -- Catch Ada exceptions, when handled.
> catch syscall -- Catch system calls by their names, groups and/or numbers.
> down-silently -- Same as the `down' command, but does not print anything.
Also, the command help doc should not be terminated by a newline
character, but this was not respected by all commands.
The cli-option -OPT framework re-introduced some occurences.
So, the -OPT build help framework was changed to not output newlines at the
end of %OPTIONS% replacement.
This patch changes the help documentations to ensure the 2 invariants
given above.
It implied to slightly rephrase or restructure some help docs.
Based on the above invariants, print_doc_line (called by
'apropos' and 'help' commands to print the first line of a command
help) now outputs the full first line of a command help.
This all results in a lot of small changes in the produced help docs.
There are less code changes than changes in the help docs, as a lot
of docs are produced by some code (e.g. the remote packet usage settings).
gdb/ChangeLog
2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* cli/cli-decode.h (print_doc_line): Add for_value_prefix argument.
* cli/cli-decode.c (print_doc_line): Likewise. It now prints
the full first line, except when FOR_VALUE_PREFIX. In this case,
the trailing '.' is not output, and the first character is uppercased.
(print_help_for_command): Update call to print_doc_line.
(print_doc_of_command): Likewise.
* cli/cli-setshow.c (deprecated_show_value_hack): Likewise.
* cli/cli-option.c (append_indented_doc): Do not append newline.
(build_help_option): Append newline after first appended_indented_doc
only if a second call is done.
(build_help): Append 2 new lines before each option, except the first
one.
* compile/compile.c (_initialize_compile): Add new lines after
%OPTIONS%, when not at the end of the help.
Change help doc or code
producing the help doc to respect the invariants.
* maint-test-options.c (_initialize_maint_test_options): Likewise.
Also removed the new line after 'Options:', as all other commands
do not put an empty line between 'Options:' and the first option.
* printcmd.c (_initialize_printcmd): Likewise.
* stack.c (_initialize_stack): Likewise.
* interps.c (interpreter_exec_cmd): Fix "Usage:" line that was
incorrectly telling COMMAND is optional.
* ada-lang.c (_initialize_ada_language): Change help doc or code
producing the help doc to respect the invariants.
* ada-tasks.c (_initialize_ada_tasks): Likewise.
* breakpoint.c (_initialize_breakpoint): Likewise.
* cli/cli-cmds.c (_initialize_cli_cmds): Likewise.
* cli/cli-logging.c (_initialize_cli_logging): Likewise.
* cli/cli-setshow.c (_initialize_cli_setshow): Likewise.
* cli/cli-style.c (cli_style_option::add_setshow_commands,
_initialize_cli_style): Likewise.
* corelow.c (core_target_info): Likewise.
* dwarf-index-cache.c (_initialize_index_cache): Likewise.
* dwarf2read.c (_initialize_dwarf2_read): Likewise.
* filesystem.c (_initialize_filesystem): Likewise.
* frame.c (_initialize_frame): Likewise.
* gnu-nat.c (add_task_commands): Likewise.
* infcall.c (_initialize_infcall): Likewise.
* infcmd.c (_initialize_infcmd): Likewise.
* interps.c (_initialize_interpreter): Likewise.
* language.c (_initialize_language): Likewise.
* linux-fork.c (_initialize_linux_fork): Likewise.
* maint-test-settings.c (_initialize_maint_test_settings): Likewise.
* maint.c (_initialize_maint_cmds): Likewise.
* memattr.c (_initialize_mem): Likewise.
* printcmd.c (_initialize_printcmd): Likewise.
* python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq,
_RegEx): Likewise.
* ravenscar-thread.c (_initialize_ravenscar): Likewise.
* record-btrace.c (_initialize_record_btrace): Likewise.
* record-full.c (_initialize_record_full): Likewise.
* record.c (_initialize_record): Likewise.
* regcache-dump.c (_initialize_regcache_dump): Likewise.
* regcache.c (_initialize_regcache): Likewise.
* remote.c (add_packet_config_cmd, init_remote_threadtests,
_initialize_remote): Likewise.
* ser-tcp.c (_initialize_ser_tcp): Likewise.
* serial.c (_initialize_serial): Likewise.
* skip.c (_initialize_step_skip): Likewise.
* source.c (_initialize_source): Likewise.
* stack.c (_initialize_stack): Likewise.
* symfile.c (_initialize_symfile): Likewise.
* symtab.c (_initialize_symtab): Likewise.
* target-descriptions.c (_initialize_target_descriptions): Likewise.
* top.c (init_main): Likewise.
* tracefile-tfile.c (tfile_target_info): Likewise.
* tracepoint.c (_initialize_tracepoint): Likewise.
* tui/tui-win.c (_initialize_tui_win): Likewise.
* utils.c (add_internal_problem_command): Likewise.
* valprint.c (value_print_option_defs): Likewise.
gdb/testsuite/ChangeLog
2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/style.exp: Update tests for help doc new invariants.
* gdb.base/help.exp: Likewise.
Frank Ch. Eigler [Tue, 6 Aug 2019 15:23:48 +0000 (11:23 -0400)]
[PR build/24886] disable glibc mcheck support
This patch drops gdb's configury support for glibc's mcheck function.
It has been observed to cause false abort()s, because it is
thread-unsafe yet interposes every malloc/free operation. So if any
library transitively used by gdb also uses threads, then these
functions can easily corrupt their own checking data. These days, gcc
ASAN and valgrind provide high quality checking, and mcheck is
apparently itself being slowly deprecated.
So, let's stop linking to it. Attached patch drops the
autoconf/Makefile machinery for both gdb and gdbserver. No
testsuite-visible impact. IMHO not worth mentioning in NEWS.
See also: https://sourceware.org/bugzilla/show_bug.cgi?id=9939
gdb/ChangeLog
PR build/24886
* configure.ac: Drop enable-libmcheck support.
* configure, config.in: Rebuild.
* libmcheck.m4: Remove.
* acinclude.m4: Don't include it.
* Makefile.in: Don't distribute it.
* top.c (print_gdb_configuration): Don't mention it.
gdb/gdbserver/ChangeLog
PR build/24886
* configure.ac: Drop enable-libmcheck support.
* configure, config.in: Rebuild.
* acinclude.m4: Don't include it.
Tom Tromey [Fri, 19 Jul 2019 04:07:10 +0000 (22:07 -0600)]
Add more styling to "disassemble"
This adds more styling to the disassemble command. In particular,
addresses and function names in the disassembly are now styled.
This required fixing a small latent bug in set_output_style. This
function always passed NULL to emit_style_escape; but when writing to
a file other than gdb_stdout, it should emit the style escape
directly. (FWIW this is another argument for better integrating the
pager with ui_file and getting rid of this entire layer.)
gdb/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* utils.c (set_output_style): Sometimes pass stream to
emit_style_escape.
* ui-out.h (class ui_out) <can_emit_style_escape>: Declare.
* record-btrace.c (btrace_insn_history): Update.
* mi/mi-out.h (class mi_ui_out) <can_emit_style_escape>: New
method.
* disasm.h (gdb_pretty_print_disassembler): Add uiout parameter.
Update initializers.
<m_uiout>: New field.
<m_di>: Move lower.
* disasm.c (gdb_pretty_print_disassembler::pretty_print_insn):
Remove "uiout" parameter.
(dump_insns): Update.
* cli-out.h (class cli_ui_out) <can_emit_style_escape>: Declare.
* cli-out.c (cli_ui_out::can_emit_style_escape): New method.
gdb/testsuite/ChangeLog
2019-08-06 Tom Tromey <tom@tromey.com>
* gdb.base/style.exp: Add disassemble test.
* gdb.base/style.c (some_called_function): New function.
(main): Use it.
Christian Biesinger [Tue, 6 Aug 2019 16:50:52 +0000 (11:50 -0500)]
Replace int with enum block_enum where appropriate.
For better readability and type safety.
gdb/ChangeLog:
2019-08-06 Christian Biesinger <cbiesinger@google.com>
* symtab.c (symbol_cache_lookup): Change int to enum block_enum.
(error_in_psymtab_expansion): Likewise.
(lookup_symbol_via_quick_fns): Likewise.
(basic_lookup_transparent_type_quick): Likewise.
(basic_lookup_transparent_type_1): Likewise.
Tom Tromey [Mon, 22 Jul 2019 21:20:24 +0000 (15:20 -0600)]
Clean up source file error reporting
print_source_lines_base reopens the source file every time that a
source line is to be printed. However, there's no need to do this so
frequently -- it's enough to do it when switching source files, and
otherwise rely on the cache.
The code seems to try to avoid these multiple opens; at a guess I'd
say something just got confused along the way.
This patch fixes the problem by reorganizing the code both to make it
more clear, and to ensure that reopens only occur when the "last
source visited" changes.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* source.c (last_source_error): Now bool.
(print_source_lines_base): Make "noprint" bool. Only open
source file when last_source_visited changes.
Tom Tromey [Mon, 22 Jul 2019 20:31:43 +0000 (14:31 -0600)]
Add file offsets to the source cache
Currently, gdb stores the number of lines and an array of file offsets
for the start of each line in struct symtab. This patch moves this
information to the source cache. This has two benefits.
First, it allows gdb to read a source file less frequently.
Currently, a source file may be read multiple times: once when
computing the file offsets, once when highlighting, and then pieces
may be read again while printing source lines. With this change, the
file is read once for its source text and file offsets; and then
perhaps read again if it is evicted from the cache.
Second, if multiple symtabs cover the same source file, then this will
share the file offsets between them. I'm not sure whether this
happens in practice.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* annotate.c (annotate_source_line): Use g_source_cache.
* source-cache.c (source_cache::get_plain_source_lines): Change
parameters. Populate m_offset_cache.
(source_cache::ensure): New method.
(source_cache::get_line_charpos): New method.
(extract_lines): Move lower. Change parameters.
(source_cache::get_source_lines): Move lower.
* source-cache.h (class source_cache): Update comment.
<get_line_charpos>: New method.
<get_source_lines>: Update comment.
<clear>: Clear m_offset_cache.
<get_plain_source_lines>: Change parameters.
<ensure>: New method
<m_offset_cache>: New member.
* source.c (forget_cached_source_info_for_objfile): Update.
(info_source_command): Use g_source_cache.
(find_source_lines, open_source_file_with_line_charpos): Remove.
(print_source_lines_base, search_command_helper): Use g_source_cache.
* source.h (open_source_file_with_line_charpos): Don't declare.
* symtab.h (struct symtab) <nlines, line_charpos>: Remove.
* tui/tui-source.c (tui_source_window::do_scroll_vertical):
Use g_source_cache.
Tom Tromey [Mon, 22 Jul 2019 18:41:23 +0000 (12:41 -0600)]
Save plain text in the source cache
Currently the source cache will only store highlighted text. However,
there's no reason it could not also store plain text, when styling is
turned off.
This patch makes this change. This also simplifies the source cache
code somewhat.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* source-cache.c (source_cache::get_plain_source_lines):
Remove "first_line" and "last_line" parameters.
(source_cache::get_source_lines): Cache plain text.
* source-cache.h (class source_cache)
<get_plain_source_lines>: Update.
Tom Tromey [Tue, 23 Jul 2019 14:22:50 +0000 (08:22 -0600)]
Fix latent bug in source cache
The source cache was not returning the final \n of the requested range
of lines. This caused regressions with later patches in this series,
so this patch pre-emptively fixes the bug.
This adds a self-test of "extract_lines" to the source cache code. To
make it simpler to test, I changed extract_lines to be a static
function, and changed it's API a bit.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* source-cache.c (extract_lines): No longer a method.
Changed type of parameter. Include final newline.
(selftests::extract_lines_test): New function.
(_initialize_source_cache): Likewise.
* source-cache.h (class source_cache)
<extract_lines>: Don't declare.
Tom Tromey [Tue, 23 Jul 2019 18:41:02 +0000 (12:41 -0600)]
Change breakpoint::filter to be a unique_xmalloc_ptr
This changes breakpoint::filter to be a unique_xmalloc_ptr, removing
an explicit xfree, as well as a use of a "release" method.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* breakpoint.c (init_breakpoint_sal): Update.
(breakpoint): Update.
* breakpoint.h (struct breakpoint) <filter>: Now a
unique_xmalloc_ptr.
Alan Modra [Tue, 6 Aug 2019 06:10:08 +0000 (15:40 +0930)]
LTO object insertion point
This is a mostly cosmetic fix for cases like PR24873 where LTO
recompiled objects were supposed to be inserted inside a group. The
specific case handled by this patch is when the first file inside a
group is an archive, the first file claimed by the plugin. Prior to
this patch we would have inserted the recompiled objects before the
group, which doesn't matter really since the entire group will be
reloaded, but it looks a little wrong in map files.
PR 24873
* ldlang.c (find_replacements_insert_point): Return "before" flag.
(find_next_input_statement): New function.
(lang_process): When placing recompiled LTO objects before a
claimed archive, place them immediately before in the statement
list.
Alan Modra [Tue, 6 Aug 2019 05:53:28 +0000 (15:23 +0930)]
PR24873, gcc -flto objects result in --start-group .. --end-group failure to include --as-needed libraries
Reloading of archives (and checking --as-needed DSOs again) is
disabled until we hit the plugin insert point. It's necessary to do
that because in a case like lib1.a lto.o lib2.a where lib1.a and
lib2.a contain duplicate symbols, we want the lto.o recompiled object
to pull in objects from lib2.a as necessary, but not from lib1.a.
Unfortunately this heuristic fails when the insert point is inside a
group, because ld actually loads the symbols from the recompiled
object before running over the contours of the script, thus missing
the fact that new undefs appeared in the group.
PR 24873
* ldlang.c (plugin_undefs): New static var.
(open_input_bfds <lang_group_statement_enum>): Loop on
plugin_undefs and hitting plugin_insert point.
(lang_process <lto_plugin_active>): Set plugin_undefs.
GDB Administrator [Tue, 6 Aug 2019 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Thu, 1 Aug 2019 22:22:28 +0000 (17:22 -0500)]
Add block['var'] accessor
Currently we support iteration on blocks; this patch extends that to make
subscript access work as well.
gdb/ChangeLog:
2019-08-05 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention dictionary access on blocks.
* python/py-block.c (blpy_getitem): New function.
(block_object_as_mapping): New struct.
(block_object_type): Use new struct for tp_as_mapping field.
gdb/doc/ChangeLog:
2019-08-05 Christian Biesinger <cbiesinger@google.com>
* python.texi (Blocks In Python): Document dictionary access on blocks.
gdb/testsuite/ChangeLog:
2019-08-05 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-block.exp: Test dictionary access on blocks.
Christian Biesinger [Wed, 31 Jul 2019 22:10:50 +0000 (17:10 -0500)]
Add a comment briefly explaining partial symbols
Based on an explanation by tromey on IRC.
gdb/ChangeLog:
2019-08-05 Christian Biesinger <cbiesinger@google.com>
* objfiles.h (objfile): Add a comment describing partial symbols.
Nick Clifton [Mon, 5 Aug 2019 15:15:14 +0000 (16:15 +0100)]
Fix objcopy's note merging capabilities so that they no longer insist on the first note being a version note.
PR 24874
* objcopy.c (merge_gnu_build_notes): Do not insist on the first
note being a version note.
Simon Marchi [Mon, 5 Aug 2019 14:21:22 +0000 (10:21 -0400)]
Increase timeout in gdb.mi/list-thread-groups-available.exp
Running
make check-read1 TESTS="gdb.mi/list-thread-groups-available.exp"
on my machine results in timeout failures. Running it while having
`tail -F testsuite/gdb.log` on the side shows that the test is never
really blocked, it is just slow at consuming the large output generated
by `-list-thread-groups --available` (which lists all the processes on
the system).
If I increase the timeout to a large value, the test passes in ~30
seconds (compared to under 1 second normally).
Increase the timeout for the particular mi_gdb_test that is long to
execute under read1. The new timeout value is a bit arbitrary. The
default timeout is 10 seconds, so I set the new timeout to be
"old-timeout * 10", so 100 seconds in the typical case.
gdb/testsuite/ChangeLog:
PR gdb/24863
* gdb.mi/list-thread-groups-available.exp: Increase timeout for
-list-thread-groups --available test when running under
check-read1.
Tom de Vries [Mon, 5 Aug 2019 13:41:04 +0000 (15:41 +0200)]
[gdb/testsuite] Run read1 timeout tests with with_read1_timeout_factor
When running tests with check-read1, we run into some timeouts where the tests
are not easy to rewrite using gdb_test_sequence:
...
FAIL: gdb.base/help.exp: help data (timeout)
FAIL: gdb.base/help.exp: help files (timeout)
FAIL: gdb.base/help.exp: help internals (timeout)
FAIL: gdb.base/help.exp: help user-defined (timeout)
FAIL: gdb.base/help.exp: help breakpoint "b" abbreviation (timeout)
FAIL: gdb.base/help.exp: help breakpoint "br" abbreviation (timeout)
FAIL: gdb.base/help.exp: help breakpoint "bre" abbreviation (timeout)
FAIL: gdb.base/info-macros.exp: info macros 2 (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: info macros 3 (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: info macros (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: next (timeout)
FAIL: gdb.base/info-macros.exp: info macros 7 (timeout)
FAIL: gdb.cp/nested-types.exp: ptype S10 (limit = -1) // parse failed (timeout)
FAIL: gdb.cp/nested-types.exp: set print type nested-type-limit 1 (timeout)
...
Fix these by increasing the timeout by a factor 10.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-05 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* lib/gdb.exp (with_read1_timeout_factor): New proc.
* gdb.base/help.exp: Use with_read1_timeout_factor.
* gdb.base/info-macros.exp: Same.
* gdb.cp/nested-types.exp: Same.
Tom Tromey [Fri, 2 Aug 2019 14:12:31 +0000 (08:12 -0600)]
Use _() in calls to build_help
Currently some code in gdb uses build_help with N_(), like:
static const std::string compile_print_help
= gdb::option::build_help (N_("\
I believe this is incorrect. The N_ macro is used to mark text that
should end up in the message catalog, but which will be translated by
a later call to gettext.
However, in this case, there is no later call to gettext, so (if gdb
had translations), this text would remain untranslated.
Instead, I think using the ordinary _() macro is correct here.
Translators will have to know to preserve "%OPTIONS%" in the text --
but that seems both unavoidable and fine.
Tested by rebuilding as there's not much else to do.
gdb/ChangeLog
2019-08-05 Tom Tromey <tromey@adacore.com>
* compile/compile.c (_initialize_compile): Use _(), not N_().
* thread.c (_initialize_thread): Use _(), not N_().
* stack.c (_initialize_stack): Use _(), not N_().
* printcmd.c (_initialize_printcmd): Use _(), not N_().
Barnaby Wilks [Mon, 5 Aug 2019 11:43:38 +0000 (12:43 +0100)]
Removes support in the ARM assembler for the unsigned variants of the VQ(R)DMLAH and VQ(R)DMLASH MVE instructions.
Previously GAS would accept .u32, .u16 and .u8 suffixes to the VQ(R)DMLAH and VQ(R)DMLASH
instructions, however the Armv8.1-M Mainline specification states that these functions only
have signed variations (.s32, .s16 and .s8 suffixes).
This is documented here:
https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf?_ga=2.
143079093.
1892401233.
1563295591-
999473562.
1560847439#page=1183
gas * config/tc-arm.c (do_mve_vqdmlah): Use N_S_32 macro.
(do_neon_qrdmlah): Use N_S_32 macro.
* testsuite/gas/arm/mve-vqdmlah-bad.d: New test.
* testsuite/gas/arm/mve-vqdmlah-bad.l: New test.
* testsuite/gas/arm/mve-vqdmlah-bad.s: New test.
* testsuite/gas/arm/mve-vqdmlah.d: Remove unsigned instruction tests.
* testsuite/gas/arm/mve-vqdmlah.s: Remove unsigned instruction tests.
* testsuite/gas/arm/mve-vqdmlash-bad.d: New test.
* testsuite/gas/arm/mve-vqdmlash-bad.l: New test.
* testsuite/gas/arm/mve-vqdmlash-bad.s: New test.
* testsuite/gas/arm/mve-vqdmlash.d: Remove unsigned instruction tests.
* testsuite/gas/arm/mve-vqdmlash.s: Remove unsigned instruction tests.
opcodes * arm-dis.c: Only accept signed variants of VQ(R)DMLAH and VQ(R)DMLASH
instructions.
Tom de Vries [Mon, 5 Aug 2019 10:51:58 +0000 (12:51 +0200)]
[gdb/testsuite] Fail in gdb_compile if pie results in non-PIE executable
When running gdb.base/break-idempotent.exp with
--target_board=unix/-fno-PIE/-no-pie, we get:
...
nr of expected passes 140
...
The test-case is compiled once with nopie and once with pie, but in both cases
we end up with a non-PIE executable. The "-fno-PIE -no-pie" options specified
using the target_board are interpreted by dejagnu as multilib_flags, and end up
overriding the pie flags.
Fix this by checking in gdb_compile if the resulting exec is non-PIE despite of
a pie setting, and if so return an error:
...
Running gdb/testsuite/gdb.base/break-idempotent.exp ...
gdb compile failed, pie failed to generate PIE executable
=== gdb Summary ===
nr of expected passes 70
nr of untested testcases 1
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-05 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (version_at_least): Factor out of ...
(tcl_version_at_least): ... here.
(gdb_compile): Fail if pie results in non-PIE executable.
(readelf_version, readelf_prints_pie): New proc.
(exec_is_pie): Return -1 if unknown.
Tom de Vries [Mon, 5 Aug 2019 10:51:58 +0000 (12:51 +0200)]
[gdb/testsuite] Fix typo in tcl_version_at_least
In tcl_version_at_least we compare a minor against a major version number:
...
} elseif { $tcl_version_major == $major \
&& $tcl_version_major >= $minor } {
...
Fix this by using $tcl_version_minor in the comparison instead.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-05 Tom de Vries <tdevries@suse.de>
* lib/gdb.exp (tcl_version_at_least): Fix typo.
Nick Clifton [Mon, 5 Aug 2019 09:40:35 +0000 (10:40 +0100)]
Catch potential integer overflow in readelf when processing corrupt binaries.
PR 24829
* readelf.c (apply_relocations): Catch potential integer overflow
whilst checking reloc location against section size.
Simon Marchi [Mon, 5 Aug 2019 02:44:05 +0000 (22:44 -0400)]
Remove some variables in favor of using gdb::optional
While reading that code, I noticed that some variables essentially meant
whether to consider some other variable or not. I think using
gdb::optional (which was not available when this code was written) is
clearer, as it embeds the used/not used predicate directly in the type
of the variable, making it harder to miss.
gdb/ChangeLog:
* dwarf2read.c (struct dw2_symtab_iterator):
<want_specific_block>: Remove.
<block_index>: Change type to gdb::optional.
(dw2_symtab_iter_init): Remove WANT_SPECIFIC_BLOCK parameter,
change type of BLOCK_INDEX parameter to gdb::optional.
(dw2_symtab_iter_next): Re-write in function of gdb::optional.
(dw2_lookup_symbol): Don't pass argument for
WANT_SPECIFIC_BLOCK.
(dw2_expand_symtabs_for_function): Don't pass argument for
WANT_SPECIFIC_BLOCK, pass empty optional for BLOCK_INDEX.
(class dw2_debug_names_iterator)
<dw2_debug_names_iterator>: Remove WANT_SPECIFIC_BLOCK
parameter, change BLOCK_INDEX type to gdb::optional.
<m_want_specific_block>: Remove.
<m_block_index>: Change type to gdb::optional.
(dw2_debug_names_iterator::next): Change type of IS_STATIC to
gdb::optional. Re-write in function of gdb::optional.
(dw2_debug_names_lookup_symbol): Don't pass argument for
WANT_SPECIFIC_BLOCK.
(dw2_debug_names_expand_symtabs_for_function): Don't pass
argument for WANT_SPECIFIC_BLOCK, pass empty optional for
BLOCK_INDEX.
GDB Administrator [Mon, 5 Aug 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Sandra Loosemore [Sun, 4 Aug 2019 21:34:31 +0000 (14:34 -0700)]
Skip GDB test reconnect-ctrl-c.exp if nointerrupts is set.
2019-08-04 Sandra Loosemore <sandra@codesourcery.com>
gdb/testsuite/
* gdb.server/reconnect-ctrl-c.exp: Skip if nointerrupts.
Sandra Loosemore [Sun, 4 Aug 2019 21:26:39 +0000 (14:26 -0700)]
Add check for readline support to more GDB tab-completion tests.
2019-08-04 Sandra Loosemore <sandra@codesourcery.com>
gdb/testsuite/
* lib/completion-support.exp (test_gdb_complete_none): Skip
tab completion tests if no readline support.
(test_gdb_complete_unique_re): Likewise.
(test_gdb_complete_multiple): Likewise.
GDB Administrator [Sun, 4 Aug 2019 00:01:03 +0000 (00:01 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Sat, 3 Aug 2019 19:20:44 +0000 (21:20 +0200)]
NEWS and documentation for info sources [-dirname | -basename] [--] [REGEXP].
gdb/ChangeLog
2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention changes to "info sources" command.
gdb/doc/ChangeLog
2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Symbols): Document new args -dirname and -basename
of "info sources" command.
Philippe Waroquiers [Sun, 31 Mar 2019 18:12:22 +0000 (20:12 +0200)]
New test for 'info sources [-dirname | -basename] [--] [REGEXP]'.
This patch introduces a test for the 'info sources' command
and its new arguments [-dirname | -basename] [--] [REGEXP].
gdb/testsuite/ChangeLog
2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/info_sources.exp: New file.
* gdb.base/info_sources.c: New file.
* gdb.base/info_sources_base.c: New file.
Philippe Waroquiers [Sun, 31 Mar 2019 18:06:39 +0000 (20:06 +0200)]
New "info sources" args [-dirname | -basename] [--] [REGEXP]
gdb/ChangeLog
2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* symtab.c (filename_partial_match_opts): New struct type.
(struct output_source_filename_data): New members
regexp, c_regexp, partial_match.
(output_source_filename): Use new members to decide to print file.
(info_sources_option_defs): New variable.
(make_info_sources_options_def_group, print_info_sources_header,
info_sources_command_completer):
New functions.
(info_sources_command): Read new optional arguments.
(_initialize_symtab): Update info sources help.
GDB Administrator [Sat, 3 Aug 2019 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
Alexandre Oliva [Fri, 2 Aug 2019 18:40:32 +0000 (15:40 -0300)]
support Ada EH ABI v1
A new pair of hooks used by Ada exception handlers, for correct
release of reraised exception occurrences, involves the introduction
of new v1 symbols that GDB should use when available. The older, v0
ABI remains available in newer runtimes for bootstrapping purposes
only.
for gdb/ChangeLog
* ada-lang.c (exception_support_info_v0): Renamed from...
(default_exception_support_info): ... this. Create new
definition for v1.
(ada_has_this_exception_support): Look up catch_handlers_sym.
(ada_exception_support_info_sniffer): Try v0 after default.
Alan Modra [Thu, 1 Aug 2019 02:20:55 +0000 (11:50 +0930)]
[GOLD] PowerPC64 pc-relative TLS support
Gold version of git commit
c213164ad2.
elfcpp/
* powerpc.h (R_PPC64_TPREL34, R_PPC64_DTPREL34),
(R_PPC64_GOT_TLSGD34, R_PPC64_GOT_TLSLD34),
(R_PPC64_GOT_TPREL34, R_PPC64_GOT_DTPREL34): Define.
gold/
* powerpc.cc (Target_powerpc::Scan::get_reference_flags): Set
flags for new relocations, and some missing older relocs.
(Target_powerpc::Scan::local): Handle new pcrel tls relocs.
Call set_has_static_tls for tprel relocs.
(Target_powerpc::Scan::global): Likewise.
(Target_powerpc::Relocate::relocate): Handle new pcrel tls relocs.
Alan Modra [Thu, 1 Aug 2019 08:13:29 +0000 (17:43 +0930)]
[GOLD] PowerPC relocation signed overflow check
Relocations with right shifts were calculating wrong overflow status.
Since the addr34 split-field reloc is implemented as an 18-bit high
part with value shifted right by 16 and a 16-bit low part, most of the
pc-relative relocs were affected.
* powerpc.cc (Powerpc_relocate_functions::rela, rela_ua): Perform
signed right shift for signed overflow check.
Alan Modra [Fri, 2 Aug 2019 03:05:39 +0000 (12:35 +0930)]
PR24871, readelf segv in dump_ia64_unwind
PR 24871
* readelf.c (ABSADDR): Delete.
(dump_ia64_unwind): Expand ABSADDR. Check validity of info.section.
Alan Modra [Fri, 2 Aug 2019 03:04:55 +0000 (12:34 +0930)]
PowerPC tlsie test fix
* testsuite/ld-powerpc/tlsie.s: Correct medium model ELF sequence.
GDB Administrator [Fri, 2 Aug 2019 00:00:28 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Thu, 1 Aug 2019 23:40:15 +0000 (16:40 -0700)]
RISC-V: Fix lui relax failure with relro.
bfd/ChangeLog
Ilia Diachkov <ilia.diachkov@optimitech.com>
* elfnn-riscv.c (_bfd_riscv_relax_lui): Set lui relax safety area to
two pages in relro presence.
Pedro Franco de Carvalho [Thu, 1 Aug 2019 19:51:44 +0000 (16:51 -0300)]
Remove directory names from gdb.base/batch-exit-status.exp
Adjust gdb.base/batch-exit-status.exp so that test prefixes don't show
directory names for the source scripts passed with -x, to make test
results from different build directories comparable.
gdb/testsuite/ChangeLog:
2019-08-01 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
* gdb.base/batch-exit-status.exp: Call test_exit_status with
prefix argument.
(test_exit_status): Add prefix argument.
Max Filippov [Mon, 22 Apr 2019 20:35:13 +0000 (12:35 -0800)]
xtensa: bfd: add special case to loop alignment check
check_loop_aligned is used during link time relaxation to only allow
transformations that don't violate loop body alignment requirements.
Assembler can relax loops that have too long body by adding instructions
between the loop instruction and the loop body. check_loop_aligned must
check alignment of the first instruction of the actual loop body.
Detect loop / rsr.lend / wsr.lbeg sequence used in assembly time
relaxation and adjust alignment check when it's detected.
bfd/
2019-08-01 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (insn_num_slots, get_rsr_lend_opcode)
(get_wsr_lbeg_opcode): New functions.
(check_loop_aligned): Detect relaxed loops and adjust loop_len
and insn_len for the first actual instruction of the loop.
Tom Tromey [Wed, 31 Jul 2019 17:50:23 +0000 (11:50 -0600)]
Fix the ia64 libunwind build
This fixes the ia64 libunwind build.
gdb/ChangeLog
2019-08-01 Tom Tromey <tromey@adacore.com>
* ia64-libunwind-tdep.h (struct libunwind_descr): Include
gdbarch.h.
Christian Biesinger [Thu, 1 Aug 2019 16:49:41 +0000 (11:49 -0500)]
Include s12z-opc.h using ../opcodes.
This file exists in binutils-gdb/opcodes, and nothing in Makefile.in adds this
to the include path. Default builds work because in-tree readline adds
binutils-gdb/ to the include path (!). However, this is broken when compiling
with system readline.
Other files already use this way to include files in opcodes:
./gdb/lm32-tdep.c:#include "../opcodes/lm32-desc.h"
./gdb/or1k-tdep.h:#include "../opcodes/or1k-desc.h"
./gdb/mep-tdep.c:#include "../opcodes/mep-desc.h"
etc.
gdb/ChangeLog:
2019-08-01 Christian Biesinger <cbiesinger@google.com>
* s12z-tdep.c: Fix include path for s12z-opc.h.
Alan Hayward [Thu, 1 Aug 2019 15:51:15 +0000 (16:51 +0100)]
Require GNU make 3.82
Gdbserver has failed to build with GNU make 3.81 since commit
08f10e02be.
Update the NEWS file to state that versions earlier than 3.82 are not
supported.
3.82 was released in 2010, 3.81 was released 2006. A quick investigation
of the default GNU make version provided across various distros found the
earliest provided version to be 3.82:
*RHEL 7, Centos 6 - make 3.82
*Fedora 27 - make 4.2.1
*OpenSuse 42.2, SLES11 - make 4.2.1
*Ubuntu 16.04/18.04 - make 4.1
*Debian Jessie - make 4.0
Note that Glibc requires at least 4.0, whereas GCC still allows 3.81.
gdb/ChangeLog:
* NEWS: Require GNU make 3.82.
Tom de Vries [Thu, 1 Aug 2019 08:48:11 +0000 (10:48 +0200)]
[gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp timeout with check-run1
With gdb.threads/fork-plus-threads.exp and check-run1 we get:
...
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
inferior 1 exited (timeout)
...
Fix this by calling exp_continue for new thread and thread exited messages.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-01 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* gdb.threads/fork-plus-threads.exp: Fix check-run1 timeout by
calling exp_continue for new thread and thread exited messages.
Tom de Vries [Thu, 1 Aug 2019 08:48:11 +0000 (10:48 +0200)]
[gdb/testsuite] Fix gdb.base/structs.exp timeout with check-read1
With gdb.base/structs.exp and check-read1 we get:
...
FAIL: gdb.base/structs.exp: p chartest (timeout)
...
Fix this by using gdb_test_sequence.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-01 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* gdb.base/structs.exp: Fix check-read1 timeout using
gdb_test_sequence.
* lib/gdb.exp (tcl_version_at_least, lrepeat): New proc.
Tom de Vries [Thu, 1 Aug 2019 08:48:11 +0000 (10:48 +0200)]
[gdb/testsuite] Fix gdb.base/break-interp.exp timeout with check-read1
With gdb.base/break-interp.exp and check-read1, we run get:
...
FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugNO: \
BINprelinkNOdebugNOpieNO: symbol-less: info files (timeout)
FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugNO: \
BINprelinkNOdebugNOpieYES: symbol-less: info files (timeout)
FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugIN: \
BINprelinkNOdebugNOpieNO: symbol-less: info files (timeout)
FAIL: gdb.base/break-interp.exp: LDprelinkNOdebugIN: \
BINprelinkNOdebugNOpieYES: symbol-less: info files (timeout)
...
Fix this by calling exp_continue after each "info files" line.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-01 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* gdb.base/break-interp.exp: Use exp_continue after each "info files"
line.
Tom de Vries [Thu, 1 Aug 2019 08:48:11 +0000 (10:48 +0200)]
[gdb/testsuite] Fix gdb.base/signals.exp timeout with check-read1
With gdb.base/signals.exp and check-read1 we get:
...
FAIL: gdb.base/signals.exp: info signals (timeout)
...
Fix this by using gdb_test_sequence.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-08-01 Tom de Vries <tdevries@suse.de>
PR testsuite/24863
* gdb.base/signals.exp: Fix check-read1 timeout using gdb_test_sequence.
Alan Modra [Wed, 31 Jul 2019 13:40:40 +0000 (23:10 +0930)]
PR24806, Linking with -T inside --start-group/--end-group
This patch processes INSERT AFTER and INSERT BEFORE in a user -T
script when such a script is invoked on the command line inside
--start-group/--end-group. Also, ld now warns when the user simply
forgot --end-group.
PR 24806
* ldlang.c (process_insert_statements): Add start of list
parameter. Use rather than lang_os_list.head. Process insert
statements inside group statements with a recursive call.
(lang_process): Adjust process_insert_statements call.
* lexsup.c (parse_args): Warn when adding missing --end-group.
Alan Modra [Wed, 31 Jul 2019 07:15:14 +0000 (16:45 +0930)]
Rename lang_output_section_statement to lang_os_list
The idea is to make it a little easier to find uses of this list,
so searches don't hit occurrences of lang_output_section_statement_type
and lang_output_section_statement_enum.
* ldlang.h (lang_os_list): Rename from lang_output_section_statement.
* ldlang.c: Likewise throughout file.
* emultempl/alphaelf.em: Likewise.
* emultempl/elf32.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
GDB Administrator [Thu, 1 Aug 2019 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 31 Jul 2019 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sat, 6 Jul 2019 14:31:57 +0000 (08:31 -0600)]
Don't declare tui_copy_win or tui_box_win
tui_copy_win and tui_box_win are not implemented, so don't declare
them.
gdb/ChangeLog
2019-07-16 Tom Tromey <tom@tromey.com>
* tui/tui-wingeneral.h (tui_copy_win, tui_box_win): Don't
declare.
Jim Wilson [Tue, 30 Jul 2019 21:42:16 +0000 (14:42 -0700)]
RISC-V: Fix minor issues with FP csr instructions.
Mel Chen <mel.chen@sifive.com>
gas/
* testsuite/gas/riscv/alias-csr.s: Add testcase for CSR-access
alias instructions.
* testsuite/gas/riscv/no-aliases-csr.d: Run testcase alias-csr.s with
-Mno-aliases.
* testsuite/gas/riscv/alias-csr.d: Run testcase alias-csr.s.
* testsuite/gas/riscv/priv-reg.d: Update.
opcodes/
* riscv-opc.c (riscv_opcodes): Set frsr, fssr, frcsr, fscsr, frrm,
fsrm, fsrmi, frflags, fsflags, fsflagsi to alias instructions.
* riscv-opc.c (riscv_opcodes): Adjust order of frsr, frcsr, fssr,
fscsr.
Tom Tromey [Thu, 6 Jun 2019 17:20:51 +0000 (11:20 -0600)]
Allow nested function displays
In Ada, it's possible to have nested functions. However,
block.c:contained_in does not recognize this. Normally, this is no
problem, but if gdb is stopped inside a nested function, then you can
end up in the unexpected situation that "print" of an expression will
work, whereas "display" of the same expression will not -- because
contained_in returns 0.
This patch simply removes the BLOCK_FUNCTION check from contained_in.
The rationale here is that in languages without nested functions, this
will not cause any issues.
gdb/ChangeLog
2019-07-30 Tom Tromey <tromey@adacore.com>
* block.c (contained_in): Remove BLOCK_FUNCTION check.
gdb/testsuite/ChangeLog
2019-07-30 Tom Tromey <tromey@adacore.com>
* gdb.ada/display_nested.exp: New file.
* gdb.ada/display_nested/foo.adb: New file.
* gdb.ada/display_nested/pack.adb: New file.
* gdb.ada/display_nested/pack.ads: New file.
Kevin Buettner [Mon, 3 Jun 2019 01:12:28 +0000 (18:12 -0700)]
Allow display of negative offsets in print_address_symbolic()
When examining addresses associated with blocks with non-contiguous
address ranges, it's not uncommon to see large positive offsets which,
for some address width, actually represent a smaller negative offset.
Here's an example taken from the test case (using the
dw2-ranges-func-lo-cold executable):
(gdb) x/5i foo_cold
0x40110d <foo+
4294967277>: push %rbp
0x40110e <foo+
4294967278>: mov %rsp,%rbp
0x401111 <foo+
4294967281>: callq 0x401106 <baz>
0x401116 <foo+
4294967286>: nop
0x401117 <foo+
4294967287>: pop %rbp
This commit, in conjuction with an earlier patch from this series, causes
cases like the above to be displayed like this (below) instead:
(gdb) x/5i foo_cold
0x40110d <foo_cold>: push %rbp
0x40110e <foo-18>: mov %rsp,%rbp
0x401111 <foo-15>: callq 0x401106 <baz>
0x401116 <foo-10>: nop
0x401117 <foo-9>: pop %rbp
Note that the address of foo_cold is now (due to another patch) being
displayed as <foo_cold> instead of <foo+BigOffset>. The subsequent
lines are shown as negative offsets from foo.
Disassembly using the "disassemble" command is somewhat affected by
these changes:
Before:
(gdb) disassemble foo_cold
Dump of assembler code for function foo:
Address range 0x401120 to 0x40113b:
0x0000000000401120 <+0>: push %rbp
0x0000000000401121 <+1>: mov %rsp,%rbp
0x0000000000401124 <+4>: callq 0x401119 <bar>
0x0000000000401129 <+9>: mov 0x2ef1(%rip),%eax # 0x404020 <e>
0x000000000040112f <+15>: test %eax,%eax
0x0000000000401131 <+17>: je 0x401138 <foo+24>
0x0000000000401133 <+19>: callq 0x40110d <foo+
4294967277>
0x0000000000401138 <+24>: nop
0x0000000000401139 <+25>: pop %rbp
0x000000000040113a <+26>: retq
Address range 0x40110d to 0x401119:
0x000000000040110d <+-19>: push %rbp
0x000000000040110e <+-18>: mov %rsp,%rbp
0x0000000000401111 <+-15>: callq 0x401106 <baz>
0x0000000000401116 <+-10>: nop
0x0000000000401117 <+-9>: pop %rbp
0x0000000000401118 <+-8>: retq
End of assembler dump.
After:
(gdb) disassemble foo_cold
Dump of assembler code for function foo:
Address range 0x401120 to 0x40113b:
0x0000000000401120 <+0>: push %rbp
0x0000000000401121 <+1>: mov %rsp,%rbp
0x0000000000401124 <+4>: callq 0x401119 <bar>
0x0000000000401129 <+9>: mov 0x2ef1(%rip),%eax # 0x404020 <e>
0x000000000040112f <+15>: test %eax,%eax
0x0000000000401131 <+17>: je 0x401138 <foo+24>
0x0000000000401133 <+19>: callq 0x40110d <foo_cold>
0x0000000000401138 <+24>: nop
0x0000000000401139 <+25>: pop %rbp
0x000000000040113a <+26>: retq
Address range 0x40110d to 0x401119:
0x000000000040110d <-19>: push %rbp
0x000000000040110e <-18>: mov %rsp,%rbp
0x0000000000401111 <-15>: callq 0x401106 <baz>
0x0000000000401116 <-10>: nop
0x0000000000401117 <-9>: pop %rbp
0x0000000000401118 <-8>: retq
End of assembler dump.
Note that negative offsets are now displayed without the leading "+".
Also, the callq to foo_cold is now displayed as such instead of a callq
to foo with a large positive offset.
gdb/ChangeLog:
* printcmd.c (print_address_symbolic): Print negative offsets.
(build_address_symbolic): Force signed arithmetic when computing
offset.
Christian Biesinger [Tue, 30 Jul 2019 16:04:37 +0000 (11:04 -0500)]
[PR/24474] Add gdb.lookup_static_symbol to the python API
Similar to lookup_global_symbol, except that it checks the
STATIC_SCOPE.
gdb/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
PR/24474: Add a function to lookup static variables.
* NEWS: Mention this new function.
* python/py-symbol.c (gdbpy_lookup_static_symbol): New function.
* python/python-internal.h (gdbpy_lookup_static_symbol): New function.
* python/python.c (python_GdbMethods): Add new function.
gdb/doc/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
* python.texi (Symbols In Python): Document new function
gdb.lookup_static_symbol.
gdb/testsuite/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-symbol.c: Add a static variable and one in an anonymous
namespace.
* gdb.python/py-symbol.exp: Test gdb.lookup_static_symbol.
Christian Biesinger [Tue, 30 Jul 2019 15:32:01 +0000 (10:32 -0500)]
Add missing changelog entry
I forgot to commit the change before pushing commit
25ec8924842a215e7f684d3a5076607409ac822f
Tom de Vries [Tue, 30 Jul 2019 14:15:46 +0000 (16:15 +0200)]
[gdb/testsuite] Work around tcl bug in libsegfault.exp with check-read1
When running libsegfault.exp with check-read1, I get:
...
Running gdb/testsuite/gdb.base/libsegfault.exp ...
ERROR: tcl error sourcing gdb/testsuite/gdb.base/libsegfault.exp.
ERROR: no such variable
(read trace on "env(LD_PRELOAD)")
invoked from within
"set env(LD_PRELOAD)"
("uplevel" body line 1)
invoked from within
"uplevel 1 [list set $var]"
invoked from within
"if [uplevel 1 [list array exists $var]] {
set saved_arrays($var) [uplevel 1 [list array get $var]]
} else {
set saved_scalars($var) [uplevel ..."
invoked from within
"if [uplevel 1 [list info exists $var]] {
if [uplevel 1 [list array exists $var]] {
set saved_arrays($var) [uplevel 1 [list array get $var]]
..."
(procedure "save_vars" line 11)
invoked from within
"save_vars { env(LD_PRELOAD) } {
if { ![info exists env(LD_PRELOAD) ]
|| $env(LD_PRELOAD) == "" } {
set env(LD_PRELOAD) "$lib"
} else {
..."
(procedure "gdb_spawn_with_ld_preload" line 4)
invoked from within
"gdb_spawn_with_ld_preload $libsegfault """
...
There are several things here interacting with environment variable
LD_PRELOAD:
- the expect "binary" build/gdb/testsuite/expect-read1 with does
export LD_PRELOAD=build/gdb/testsuite/read1.so before calling native expect
- read1.so which does unsetenv ("LD_PRELOAD") upon first call to read
- the test-case, which wants to set or append libSegFault.so to LD_PRELOAD
The error occurs when accessing $env(LD_PRELOAD), in a branch where
"info exists env(LD_PRELOAD)" returns true. AFAIU, this is
https://core.tcl-lang.org/tcl/tktview?name=
67fd4f973a "incorrect results of
'info exists' when unset env var in one interp and check for existence from
another interp".
Work around the tcl bug by not unsetting the variable, but setting it to ""
instead:
...
- unsetenv ("LD_PRELOAD");
+ setenv ("LD_PRELOAD", "", 1);
...
Verified that reverting commit
de28a3b72e "[gdb/testsuite, 2/2] Fix
gdb.linespec/explicit.exp with check-read1" reintroduced the check-read1
failure in gdb.linespec/explicit.exp.
This fixes a similar error in attach-slow-waitpid.exp, which also sets
LD_PRELOAD.
Tested on x86_64-linux with check-read1.
gdb/testsuite/ChangeLog:
2019-07-30 Tom de Vries <tdevries@suse.de>
* lib/read1.c (read): Don't use unsetenv (v), use setenv (v, "", 1)
instead.
Tom de Vries [Tue, 30 Jul 2019 07:42:07 +0000 (09:42 +0200)]
[gdb/testsuite] Fail in gdb_compile if nopie results in PIE executable
When running gdb.base/dump.exp with --target_board=unix/-fPIE/-pie, we get:
...
Running gdb/testsuite/gdb.base/dump.exp ...
FAIL: gdb.base/dump.exp: dump array as value, intel hex
...
The FAIL happens because although the test specifies nopie, the exec is
in fact compiled as PIE. The "-fPIE -pie" options specified using the
target_board are interpreted by dejagnu as multilib_flags, and end up
overriding the nopie flags.
Fix this by checking in gdb_compile if the resulting exec is PIE despite of
a nopie setting, and if so return an error:
...
Running gdb/testsuite/gdb.base/dump.exp ...
gdb compile failed, nopie failed to prevent PIE executable
=== gdb Summary ===
nr of untested testcases 1
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-07-30 Tom de Vries <tdevries@suse.de>
PR testsuite/24834
* lib/gdb.exp (gdb_compile): Fail if nopie results in PIE executable.
(exec_is_pie): New proc.
Alan Modra [Tue, 30 Jul 2019 03:44:36 +0000 (13:14 +0930)]
Re: Support .gnu.lto_.lto section in ELF files
PR 24768
* bfd.c (struct bfd): Add lto_slim_object flag.
* bfd-in2.h: Regenerate.
Christian Biesinger [Tue, 30 Jul 2019 02:00:21 +0000 (21:00 -0500)]
Fix misspelling (nonexistant -> nonexistent)
gdb/testsuite/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-objfile.exp: Fix misspelling (nonexistant -> nonexistent)
Christian Biesinger [Tue, 25 Jun 2019 20:45:41 +0000 (15:45 -0500)]
Add Objfile.lookup_{global,static}_symbol functions
This is essentially the inverse of Symbol.objfile. This allows
handling different symbols with the same name (but from different
objfiles) and can also be faster if the objfile is known.
gdb/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention new functions Objfile.lookup_{global,static}_symbol.
* python/py-objfile.c (objfpy_lookup_global_symbol): New function.
(objfpy_lookup_static_symbol): New function.
(objfile_object_methods): Add new functions.
gdb/doc/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* python.texi (Objfiles In Python): Document new functions
Objfile.lookup_{global,static}_symbol.
gdb/testsuite/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-objfile.c: Add global and static vars.
* gdb.python/py-objfile.exp: Test new functions Objfile.
lookup_global_symbol and lookup_static_symbol.
GDB Administrator [Tue, 30 Jul 2019 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Sun, 28 Jul 2019 21:02:35 +0000 (15:02 -0600)]
Two fixes for test suite's terminal
Exactly which escape sequences are emitted by gdb in TUI mode are
determined largely by the curses implementation. Testing my latest
(as yet unsubmitted) series to refactor the TUI showed a couple of
failures that I tracked to the test suite's terminal implementation.
In particular, the CSI "@" sequence was not implemented; and the CSI
"X" sequence was implemented incorrectly.
This patch fixes both of these problems. Tested on x86-64 Fedora 28.
gdb/testsuite/ChangeLog
2019-07-29 Tom Tromey <tom@tromey.com>
* lib/tuiterm.exp (Term::_csi_@): New proc.
(Term::_csi_X): Don't move cursor.
Philippe Waroquiers [Sat, 4 May 2019 21:48:36 +0000 (23:48 +0200)]
Document 'set print frame-info|frame-arguments presence'.
gdb/ChangeLog
2019-06-19 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention 'set|show print frame-info'. Mention new
'presence' value for 'frame-arguments'. Mention new '-frame-info'
backtrace argument. Mention that python frame filtering code
is now consistent with what 'backtrace' command prints.
gdb/doc/ChangeLog
2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Backtrace): Document the new '-frame-info'
backtrace option. Reference 'set print frame-info'.
(Print Settings): Document 'set|show print frame-info'.
Document new 'presence' value for 'set print frame-arguments.
Philippe Waroquiers [Sat, 4 May 2019 21:47:57 +0000 (23:47 +0200)]
Test 'set print frame-info|frame-arguments presence'.
Updated tests to test the new options and new values.
Test the default for print_what in python frame filtering.
Updated the tests impacted by the default in python frame filtering
which is now consistent with the backtrace command.
gdb/testsuite/ChangeLog
2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/options.exp: Update backtrace - completion to
new option -frame-info.
* gdb.base/frame-args.exp: Test new 'frame-arguments presence'.
Test new 'set print frame-info'. Test backtrace -frame-info
overriding 'set print frame-info'.
* gdb.python/py-framefilter.exp: Test new 'frame-arguments presence'.
Test new 'set print frame-info'.
Verify consistency of backtrace with and without filters, with and
without -no-filters.
* gdb.python/py-framefilter-invalidarg.exp: Update to new print_what
default.
Philippe Waroquiers [Sat, 4 May 2019 21:40:56 +0000 (23:40 +0200)]
Implement 'set print frame-info|frame-arguments presence'.
New settings allow to better control what frame information is printed.
'set print frame-info' allows to override the default frame information
printed when a GDB command prints a frame.
The backtrace command has a new option -frame-info to override
this global setting.
It is now possible to have very short frame information by using the
new 'set print frame-arguments presence' and
'set print frame-info short-location'.
Combined with 'set print address off', a backtrace will only show
the essential information to see the function call chain, e.g.:
(gdb) set print address off
(gdb) set print frame-arguments presence
(gdb) set print frame-info short-location
(gdb) bt
#0 break_me ()
#1 call_me (...)
#2 main ()
(gdb)
This is handy in particular for big backtraces with functions having
many arguments.
Python frame filter printing logic has been updated to respect the new
setting in non MI mode.
Also, the default frame information printed was inconsistent when
backtrace was printing the frame information itself, or when the python
frame filtering code was printing the frame information.
This patch changes the default of python frame filtering to have a
consistent behaviour regarding printed frame-information, whatever
the presence/activity/matches of python filters.
2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* frame.h (enum print_what): New value 'SHORT_LOCATION', update
comments.
(print_frame_info_auto, print_frame_info_source_line,
print_frame_info_location, print_frame_info_source_and_location,
print_frame_info_location_and_address, print_frame_info_short_location):
New declarations.
(struct frame_print_options): New member print_frame_info.
* extension.h (enum ext_lang_frame_args): New value CLI_PRESENCE.
* stack.h (get_user_print_what_frame_info): New declaration.
(frame_show_address): New declaration.
* stack.c (print_frame_arguments_choices): New value 'presence'.
(print_frame_info_auto, print_frame_info_source_line,
print_frame_info_location, print_frame_info_source_and_location,
print_frame_info_location_and_address, print_frame_info_short_location,
print_frame_info_choices, print_frame_info_print_what): New definitions.
(print_frame_args): Only print dots for args if print frame-arguments
is 'presence'.
(frame_print_option_defs): New element for "frame-info".
(get_user_print_what_frame_info): New function.
(frame_show_address): Make non static. Move comment to stack.h.
(print_frame_info_to_print_what): New function.
(print_frame_info): Update comment. Use fp_opts.print_frame_info
to decide what to print.
(backtrace_command_1): Handle the new print_frame_arguments_presence
value.
(_initialize_stack): Call add_setshow_enum_cmd for frame-info.
* python/py-framefilter.c (py_print_args): Handle CLI_PRESENCE.
(py_print_frame): In non-mi mode, use LOCATION as default for
print_what, similarly to frame information printed directly by
backtrace command. Handle frame-info user option in non MI mode.