Tom de Vries [Wed, 23 Oct 2019 07:33:46 +0000 (09:33 +0200)]
[gdb/breakpoints] Fix fullname.exp when run from symlink dir
I run into this error with gdb.base/fullname.exp:
...
(gdb) file /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/fullname
Reading symbols from /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/fullname...
(gdb) break /data/gdb_versions/devel/build/gdb/testsuite/\
outputs/gdb.base/fullname/tmp-fullname.c:21
No source file named /data/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/tmp-fullname.c.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) FAIL: gdb.base/fullname.exp: set breakpoint by full path before loading symbols - built relative
...
The FAIL is due to this comparison in iterate_over_some_symtabs failing:
...
481 if (FILENAME_CMP (real_path, fullname) == 0)
(gdb) p real_path
$2 = 0x1a201f0 "/data/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/tmp-fullname.c"
(gdb) p fullname
$3 = 0x1a1de80 "/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/\
gdb.base/fullname/tmp-fullname.c"
...
The difference in pathnames is due to having a symlink dir:
...
$ ls -la /home/vries/gdb_versions
lrwxrwxrwx 1 vries users 18 26 jun 2018 /home/vries/gdb_versions -> /data/gdb_versions
...
and the test passses when eliminating it:
...
$ ( cd $(pwd -P); make check RUNTESTFLAGS=gdb.base/fullname.exp )
...
The FAIL is a regression from commit
a0c1ffedcf1 "Only compute realpath when
basenames_may_differ is set". Before, find_and_open_source was returning a
real-path, resulting in variable 'fullname' being the same as varible
'real_path' in the comparison listed above. But after, that's no longer the
case.
Fix the FAIL by applying gdb_realpath on the fullname variable before the
comparison.
Tested on x86_64-linux.
I wasn't able to write a test-case. The FAIL starts at:
...
$ cd build/gdb
$ mv testsuite testsuite.bla
$ ln -s testsuite.bla testsuite
...
but already this doesn't trigger it anymore:
...
$ cd build/gdb/outputs
$ mv outputs outputs.bla
$ ln -s outputs.bla outputs
...
gdb/ChangeLog:
2019-10-23 Tom de Vries <tdevries@suse.de>
PR breakpoints/24687
* symtab.c (iterate_over_some_symtabs): Apply gdb_realpath on fullname.
Change-Id: I1ace62a234458781e958980f3b425edf1490df27
GDB Administrator [Wed, 23 Oct 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Tue, 22 Oct 2019 19:58:45 +0000 (14:58 -0500)]
Make demangled_name_entry::language not a bitfield
Having it as a bitfield causes extra work, and this is not memory-sensitive.
Furthermore, once https://sourceware.org/ml/gdb-patches/2019-10/msg00812.html
lands, the bitfield won't even save any memory at all.
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* symtab.c (struct demangled_name_entry) <language>: Change from
bitfield to regular variable.
Change-Id: I4ea31d1cfcbe0f09a09bd058cd304862308dc388
Christian Biesinger [Tue, 22 Oct 2019 18:37:37 +0000 (13:37 -0500)]
Fix compile error & incorrect push
I accidentally pushed the wrong version of the patch for commit
7bb43059820c5febb4509b15202a93efde442bc6 (where the review
comments were not fixed), and I did a bad conflict resolution
for
ccb1ba62299edce72053dd567b9d384814e11885 leading to a
compile error when libxxhash is available. This fixes both
issues.
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* symtab.c (struct demangled_name_entry): Add a constructor.
(free_demangled_name_entry): New function to call the destructor
for demangled_name_entry.
(create_demangled_names_hash): Pass free_demangled_name_entry to
htab_create_alloc.
(symbol_set_names): Call placement new for demangled_name_entry.
* utils.c: No longer include xxhash.h here, now that fast_hash
is inlined in the header.
* utils.h: Instead, include it here.
Change-Id: If776099d39a65a12733d42efcb859feca1b07a39
Christian Biesinger [Fri, 27 Sep 2019 18:32:07 +0000 (13:32 -0500)]
Use libxxhash for hashing, if present
XXHash is faster than htab_hash_string:
------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------
BM_xxh3 11 ns 11 ns
65887249
BM_xxh32 19 ns 19 ns
36511877
BM_xxh64 16 ns 16 ns
42964585
BM_hash_string 182 ns 182 ns
3853125
BM_iterative_hash 77 ns 77 ns
9087638
Unfortunately, XXH3 is still experimental (see
https://github.com/Cyan4973/xxHash#user-content-new-experimental-hash-algorithm)
However, regular XXH64 is still a lot faster than
htab_hash_string per my benchmark above. I used the
following string for the benchmark:
static constexpr char str[] = "_ZZZL13make_gdb_typeP7gdbarchP10tdesc_typeEN16gdb_type_creator19make_gdb_type_flagsEPK22tdesc_type_with_fieldsE19__PRETTY_FUNCTION__";
htab_hash_string is currently 4.35% + 7.98% (rehashing) of gdb
startup when attaching to Chrome's content_shell.
An additional 5.21% is spent in msymbol_hash, which does not use
this hash function. Unfortunately, since it has to lowercase the
string, it can't use this hash function.
BM_msymbol_hash 52 ns 52 ns
13281495
It may be worth investigating if strlen+XXHash is still faster than
htab_hash_string, which would make it easier to use in more places.
Debian ships xxhash as libxxhash{0,-dev}. Fedora ships it as xxhash-devel.
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* Makefile.in: Link with libxxhash.
* config.in: Regenerate.
* configure: Regenerate.
* configure.ac: Search for libxxhash.
* utils.c (fast_hash): Use xxhash if present.
Change-Id: Icab218388b9f829522ed3977f04301ae6d4fc4ca
Christian Biesinger [Fri, 27 Sep 2019 18:08:25 +0000 (13:08 -0500)]
Add a fast_hash function in common-utils
Also updates a caller in symtab.c. For now this just calls htab_hash_string
but the next patch will change it to xxhash, if available.
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* utils.h (fast_hash): New function.
* symtab.c (hash_demangled_name_entry): Call new function
fast_hash.
Change-Id: I77cac0d9aa78fc65316a2af449f52edcae72dc9b
Christian Biesinger [Fri, 27 Sep 2019 17:40:04 +0000 (12:40 -0500)]
Store the mangled name as a string_view
This should be a bit faster (because we can compare the size first),
but it is also a dependency for the next patch.
(3.47% of gdb startup time is spent in eq_demangled_name_entry when
attaching to Chrome's content_shell binary)
gdb/ChangeLog:
2019-10-22 Christian Biesinger <cbiesinger@google.com>
* symtab.c (struct demangled_name_entry): Change type of mangled
to gdb::string_view. Also adds a constructor that takes the
mangled name.
(hash_demangled_name_entry): Update.
(eq_demangled_name_entry): Update.
(free_demangled_name_entry): New function to call the destructor
now that this is not a POD anymore.
(create_demangled_names_hash): Pass free_demangled_name_entry to
htab_create_alloc.
(symbol_set_names): Update.
Change-Id: I24711ae2bcaa9e79ca89a6f8fda385d400419175
Nick Clifton [Tue, 22 Oct 2019 11:01:45 +0000 (12:01 +0100)]
Prevent more potential illegal memory accesses in the RX disassembler.
* rx-dis.c (get_size_name): New function. Provides safe
access to name array.
(get_opsize_name): Likewise.
(print_insn_rx): Use the accessor functions.
Alan Modra [Mon, 21 Oct 2019 21:12:58 +0000 (07:42 +1030)]
Don't allow RELATIVE relocs in pr22269 testcase
At least, not in the GOT. R_PPC64_RELATIVE is fine for powerpc64 in
the .opd section.
PR 22269
* testsuite/ld-elf/pr22269-1.rd: Look for GOT section NONE and
RELATIVE relocs.
* testsuite/ld-elf/shared.exp (pr22269-1): Give test a better
name. Use -z nocombreloc.
GDB Administrator [Tue, 22 Oct 2019 00:00:22 +0000 (00:00 +0000)]
Automatic date update in version.in
Ali Tamur [Tue, 27 Aug 2019 02:22:09 +0000 (19:22 -0700)]
DWARF 5 support: Handle line table and file indexes
* Fix handling of file and directory indexes in line tables; in DWARF 5 the
indexes are zero-based. Make file_names field private to abstract this detail
from the clients. Introduce file_names, is_valid_file_index and
file_names_size methods. Reflect these changes in clients.
* Handle DW_FORM_data16 in read_formatted_entries; it is used to record MD5
of the file entries in DWARF 5.
* Fix a bug in line header parsing that calculates the length of the header
incorrectly. (Seemingly this manifests itself only in DWARF 5).
Tested with CC=/usr/bin/gcc (version 8.3.0) against master branch (also with
-gsplit-dwarf and -gdwarf-4 flags) and there was no increase in the set of
tests that fails. (gdb still cannot debug a 'hello world' program with DWARF 5,
so for the time being, this is all we care about).
This is part of an effort to support DWARF 5 in gdb.
gdb/ChangeLog:
* dwarf2read.c (dir_index): Change type.
(file_name_index): Likewise.
(line_header::include_dir_at): Change comment and implementation on
whether it is DWARF 5.
(line_header::is_valid_file_index): New function.
(line_header::file_name_at): Change comment and implementation on
whether it is DWARF 5.
(line_header::file_names): Change to private field renamed as
m_file_names and introduce a new accessor method.
(line_header::file_names_size): New method.
(line_header::include_dirs): Change to private field and rename as
m_include_dirs.
(dw2_get_file_names_reader): Define local var at a smaller scope and
reflect API change.
(dwarf2_cu::setup_type_unit_groups): Reflect API change.
(process_structure_scope): Likewise.
(line_header::add_include_dir): Change message and reflect renaming.
(line_header::add_file_name): Likewise.
(read_formatted_entries): Handle DW_FORM_data16.
(dwarf_decode_line_header): Fix line header length calculation.
(psymtab_include_file_name): Change comment and API.
(lnp_state_machine::m_file): Update comment and reflect type change.
(lnp_state_machine::record_line): Reflect type change.
(dwarf_decode_lines): Reflect API change.
(file_file_name): Likewise.
(file_full_name): Likewise.
Andrew Burgess [Mon, 21 Oct 2019 15:39:51 +0000 (16:39 +0100)]
gdb: Ensure that !(a < a) is true in sort_cmp on obj_section objects
After the switch to use std::sort, if GDB is compiled with the
-D_GLIBCXX_DEBUG=1 flag then we see an error when using sort_cmp (in
objfiles.c) to sort obj_section objects.
The problem is that std::sort checks that the condition !(a < a)
holds, and currently this is not true. GDB's sort_cmp is really
designed to sort lists in which no obj_section repeats, however, there
is some code in place to try and ensure we get a stable sort order if
there is a bug in GDB, unfortunately this code fails the above check.
By reordering some of the checks inside sort_cmp, it is pretty easy to
ensure that the !(a < a) condition holds.
I've not bothered to make this condition check optimal, like I said
this code is only in place to ensure that we get stable results if GDB
goes wrong, so I've made the smallest change needed to get the correct
behaviour.
After this commit I see no regressions when running GDB compiled with
-D_GLIBCXX_DEBUG=1.
gdb/ChangeLog:
* objfiles.c (sort_cmp): Ensure that !(a < a) holds true.
Change-Id: I4b1e3e1640865104c0896cbb6c3fdbbc04d9645b
Tom Tromey [Mon, 21 Oct 2019 15:26:39 +0000 (09:26 -0600)]
Remove tui_exec_info_content
I happened to notice that the tui_exec_info_content typedef is unused.
This patch removes it. Tested by rebuilding.
gdb/ChangeLog
2019-10-21 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_exec_info_content): Remove typedef.
Change-Id: I768edc482366e830eb4528c799686bb27518cdcb
Andrew Burgess [Mon, 21 Oct 2019 13:52:37 +0000 (14:52 +0100)]
contrib: Update dg-extract-results.* from gcc
The dg-extract-results scripts have been updated in the gcc
repository. This commit copies the updated versions of the scripts in
to the binutils-gdb repository.
There are two changes, these are:
1. Improved detection of timeout lines, though I suspect this only
applies to gcc results, and
2. Detection of KPASS results, this is of interest to gdb, where
these results would not be included in the final .sum file.
A grep over binutils-gdb shows the dg-extract-results is not used by
ld, gas, or binutils, however I tested these anyway and saw no changes
in the final .sum files (tested on x86-64 GNU/Linux).
On gdb when running tests in parallel dg-extract-results is used, and
the final .sum file now includes the KPASS results.
contrib/ChangeLog:
* dg-extract-results.py: Update from gcc repo.
* dg-extract-results.sh: Likewise.
Change-Id: I54abd07f4e8f5cf88a6db74519674f6939860157
Tom Tromey [Sat, 19 Oct 2019 21:42:34 +0000 (15:42 -0600)]
Fix creation of nm.h when configure is changed
My earlier patch -- commit
c5adaa192 ("Fix creation of stamp-h by
gdb's configure script") -- broke the creation of nm.h. In
particular, configure removes nm.h, so if you touch configure and
rebuild, nothing will re-create the link, breaking the build.
This patch fixes the bug, and also updates configure.ac to use
AC_CONFIG_LINKS, rather than the obsolete AC_LINK_FILES.
Finally, I noticed that gcore is in generated_files in the
Makefile.in. I think this is incorrect, as generated_files is only
needed for files that can be the target of a #include. So, this patch
removes it.
gdb/ChangeLog
2019-10-21 Tom Tromey <tom@tromey.com>
* configure.ac (nm.h): Conditionally create nm.h link. Subst
NM_H. Use AC_CONFIG_LINKS.
* configure: Rebuild.
* Makefile.in (NM_H): New variable.
(generated_files): Add NM_H. Remove gcore.
(nm.h, stamp-nmh): New targets.
Change-Id: I8dd539785d52455e85389425e4bb996c8a127a0e
Tom de Vries [Mon, 21 Oct 2019 13:08:54 +0000 (15:08 +0200)]
[gdb/testsuite] Compile infcall-nested-structs.exp with -O2
As mentioned in commit
745ff14e6e1 "[gdb/tdep] Fix 'Unexpected register class'
assert in amd64_push_arguments", of the 12 KFAILs added there, 3 are KPASSing
with g++ 4.8.5.
The KPASSes are due to:
- gdb incorrectly expecting the second half of the result of function
rtn_str_struct_02_01 in register %rdx.
- rtn_str_struct_02_01 using %rdx as a temporary, thereby accidentally setting
it to the expected value.
Reduce the chance of hiding errors due accidental register settings by
compiling the test-case with -O2.
This fixes the KPASSes when applied on top of commit
745ff14e6e1.
Tested on x86_64-linux.
Tested with g++ 4.8.5, 7.4.1, 8.3.1, 9.2.1.
gdb/testsuite/ChangeLog:
2019-10-21 Tom de Vries <tdevries@suse.de>
* gdb.base/infcall-nested-structs.c: Add
__attribute__((noinline,noclone)) to all functions.
(call_all): Add missing variable initialization. Simplify return value.
(breakpt): Increment volatile variable, to prevent call from being
optimized out.
* gdb.base/infcall-nested-structs.exp: Compile with -O2.
Change-Id: Ic027e1c957fecd6686345639db99f5eaee3cdf05
Alan Modra [Mon, 21 Oct 2019 02:24:06 +0000 (12:54 +1030)]
ar P support
This patch extends "ar P" to allow creation of normal (as distinct
from thin) archives with full path names.
PR 452
PR 25104
bfd/
* archive.c (normalize): Return file unchanged when
BFD_ARCHIVE_FULL_PATH.
(_bfd_construct_extended_name_table): Pass abfd, the output
bfd, to normalize.
(_bfd_archive_bsd44_construct_extended_name_table): Likewise.
* bfd.c (struct bfd): Make flags a full flagword.
(BFD_ARCHIVE_FULL_PATH): Define.
* bfd-in2.h: Regenerate.
binutils/
* ar.c (write_archive): Set BFD_ARCHIVE_FULL_PATH.
* doc/binutils.texi (extract from archive): Mention
restrictions when extracting from archives with full paths.
(ar P): Update to current P support.
(ar -X32_64): Fix spelling.
Tom Tromey [Mon, 21 Oct 2019 02:41:20 +0000 (20:41 -0600)]
Make unlink_objfile and put_objfile_before static
I noticed an obsolete comment just before unlink_objfile, and then I
noticed that both unlink_objfile and put_objfile_before could be
static. This patch makes these changes, and also moves unlink_objfile
earlier, so that a forward declaration is not needed.
Tested by rebuilding.
gdb/ChangeLog
2019-10-20 Tom Tromey <tom@tromey.com>
* objfiles.h (unlink_objfile, put_objfile_before): Don't declare.
* objfiles.c (unlink_objfile): Move earlier. Now static. Remove
obsolete comment.
(put_objfile_before): Now static.
Change-Id: I1b5927a60fd1cc59bfc9c6761f61652a01ef13e0
GDB Administrator [Mon, 21 Oct 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
John David Anglin [Sun, 20 Oct 2019 16:01:58 +0000 (12:01 -0400)]
[bfd] Provide 8-byte minimum alignment for .plt section
This change increases the default alignment for the .plt section
from 4 bytes to 8 bytes. When function descriptors are 8-byte
aligned, they can be updated atomically on 32-bit hppa. This
helps with ordering issues on SMP machines. It also ensures
that descriptors reside on the same cache line. This reduces
the probability of a double TLB miss in a call.
2019-10-20 John David Anglin <danglin@gcc.gnu.org>
* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Provide 8-byte
minimum alignment for .plt section.
GDB Administrator [Sun, 20 Oct 2019 00:01:57 +0000 (00:01 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 19 Oct 2019 21:00:35 +0000 (17:00 -0400)]
gdb: Make startswith return a bool
gdb/ChangeLog:
* gdbsupport/common-utils.h (startswith): Change return type to
bool.
Change-Id: I1c11b9bb7f89b3885c1bb55097adb5be6d333ad4
Christian Biesinger [Thu, 3 Oct 2019 05:36:35 +0000 (00:36 -0500)]
Replace some more qsort calls with std::sort
This has better typesafety, avoids a function pointer indirection,
and can benefit from inlining.
gdb/ChangeLog:
2019-10-19 Christian Biesinger <cbiesinger@google.com>
* bcache.c (bcache::print_statistics): Use std::sort instead of qsort.
* breakpoint.c (bp_locations_compare): Rename to...
(bp_location_is_less_than): ...this, and change to std::sort semantics.
(update_global_location_list): Use std::sort instead of qsort.
* buildsym.c (compare_line_numbers): Rename to...
(lte_is_less_than): ...this, and change to std::sort semantics.
(buildsym_compunit::end_symtab_with_blockvector): Use std::sort
instead of qsort.
* disasm.c (compare_lines): Rename to...
(line_is_less_than): ...this, and change to std::sort semantics.
(do_mixed_source_and_assembly_deprecated): Call std::sort instead
of qsort.
* dwarf2-frame.c (qsort_fde_cmp): Rename to...
(fde_is_less_than): ...this, and change to std::sort semantics.
(dwarf2_build_frame_info): Call std::sort instead of qsort.
* mdebugread.c (compare_blocks):
(block_is_less_than): ...this, and change to std::sort semantics.
(sort_blocks): Call std::sort instead of qsort.
* objfiles.c (qsort_cmp): Rename to...
(sort_cmp): ...this, and change to std::sort semantics.
(update_section_map): Call std::sort instead of qsort.
* remote.c (compare_pnums): Remove.
(map_regcache_remote_table): Call std::sort instead of qsort.
* utils.c (compare_positive_ints): Remove.
* utils.h (compare_positive_ints): Remove.
* xcoffread.c (compare_lte): Remove.
(arrange_linetable): Call std::sort instead of qsort.
Change-Id: Ibcddce12a3d07448701e731b7150fa23611d86de
John David Anglin [Sat, 19 Oct 2019 17:41:36 +0000 (13:41 -0400)]
[bfd] Revise import stubs on hppa.
This commit updates the import stubs to leave the pointer to the
function descriptor in register %r22. This provides a backup
mechanism for _dl_runtime_resolve to fixup descriptors during
lazy binding.
bfd/ChangeLog
2019-10-19 John David Anglin <danglin@gcc.gnu.org>
* elf32-hppa.c: Revise import stub sequences.
(LONG_BRANCH_STUB_SIZE): Define.
(LONG_BRANCH_SHARED_STUB_SIZE): Define.
(IMPORT_STUB_SIZE): Define.
(IMPORT_SHARED_STUB_SIZE): Define.
(EXPORT_STUB_SIZE): Define.
(plt_stub): Revise to not use register %r22.
(LDO_R1_R22): Define.
(LDW_R22_R21): Define.
(LDW_R22_R19): Define.
(hppa_build_one_stub): Update stub generation and use new defines.
(hppa_size_one_stub): Likewise.
John David Anglin [Sat, 19 Oct 2019 17:01:29 +0000 (13:01 -0400)]
[ld] Fix failure of pr19161 on hppa*-*linux*.
ld/ChangeLog
2019-10-19 Alan Modra <amodra@gmail.com>
PR ld/25110
* testsuite/ld-gc/gc.exp: Adjust LDFLAGS for pr19161 dump test on
hppa*-*-linux*.
Sergio Durigan Junior [Sat, 19 Oct 2019 04:59:59 +0000 (00:59 -0400)]
Fix typos in symfile.c and i386-darwin-tdep.c
This commit fixes two simple typos, one in gdb/symfile.c and the other
in gdb/i386-darwin-tdep.c. s/wether/whether/.
2019-10-19 Sergio Durigan Junior <sergiodj@redhat.com>
* symfile.c (init_entry_point_info): Fix typo.
* i386-darwin-tdep.c (darwin_dwarf_signal_frame_p): Fix typo.
Change-Id: I1fbb39c32009c61c862b6bd56ce12f24a9edb2c4
GDB Administrator [Sat, 19 Oct 2019 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Fri, 18 Oct 2019 00:48:08 +0000 (02:48 +0200)]
[gdb] Fix more typos in comments
Fix typos in comments. NFC.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-10-18 Tom de Vries <tdevries@suse.de>
* aarch64-tdep.c: Fix typos in comments.
* ada-lang.c: Same.
* ada-tasks.c: Same.
* alpha-tdep.c: Same.
* alpha-tdep.h: Same.
* amd64-nat.c: Same.
* amd64-windows-tdep.c: Same.
* arc-tdep.c: Same.
* arc-tdep.h: Same.
* arch-utils.c: Same.
* arm-nbsd-tdep.c: Same.
* arm-tdep.c: Same.
* ax-gdb.c: Same.
* blockframe.c: Same.
* btrace.c: Same.
* c-varobj.c: Same.
* coff-pe-read.c: Same.
* coffread.c: Same.
* cris-tdep.c: Same.
* darwin-nat.c: Same.
* dbxread.c: Same.
* dcache.c: Same.
* disasm.c: Same.
* dtrace-probe.c: Same.
* dwarf-index-write.c: Same.
* dwarf2-frame-tailcall.c: Same.
* dwarf2-frame.c: Same.
* dwarf2read.c: Same.
* eval.c: Same.
* exceptions.c: Same.
* fbsd-tdep.c: Same.
* findvar.c: Same.
* frame.c: Same.
* frv-tdep.c: Same.
* gnu-v3-abi.c: Same.
* go32-nat.c: Same.
* h8300-tdep.c: Same.
* hppa-tdep.c: Same.
* i386-linux-tdep.c: Same.
* i386-tdep.c: Same.
* ia64-libunwind-tdep.c: Same.
* ia64-tdep.c: Same.
* infcmd.c: Same.
* infrun.c: Same.
* linespec.c: Same.
* linux-nat.c: Same.
* linux-thread-db.c: Same.
* machoread.c: Same.
* mdebugread.c: Same.
* mep-tdep.c: Same.
* mn10300-tdep.c: Same.
* namespace.c: Same.
* objfiles.c: Same.
* opencl-lang.c: Same.
* or1k-tdep.c: Same.
* osabi.c: Same.
* ppc-linux-nat.c: Same.
* ppc-linux-tdep.c: Same.
* ppc-sysv-tdep.c: Same.
* printcmd.c: Same.
* procfs.c: Same.
* record-btrace.c: Same.
* record-full.c: Same.
* remote-fileio.c: Same.
* remote.c: Same.
* rs6000-tdep.c: Same.
* s12z-tdep.c: Same.
* score-tdep.c: Same.
* ser-base.c: Same.
* ser-go32.c: Same.
* skip.c: Same.
* sol-thread.c: Same.
* solib-svr4.c: Same.
* solib.c: Same.
* source.c: Same.
* sparc-nat.c: Same.
* sparc-sol2-tdep.c: Same.
* sparc-tdep.c: Same.
* sparc64-tdep.c: Same.
* stabsread.c: Same.
* stack.c: Same.
* symfile.c: Same.
* symtab.c: Same.
* target-descriptions.c: Same.
* target-float.c: Same.
* thread.c: Same.
* utils.c: Same.
* valops.c: Same.
* valprint.c: Same.
* value.c: Same.
* varobj.c: Same.
* windows-nat.c: Same.
* xcoffread.c: Same.
* xstormy16-tdep.c: Same.
* xtensa-tdep.c: Same.
Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
GDB Administrator [Fri, 18 Oct 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Thu, 17 Oct 2019 22:38:27 +0000 (15:38 -0700)]
RISC-V: Report unresolved relocation error via linker's callback function.
Two patches from Nelson Chu.
It is better to use the linker's callback functions to handle the link time
error when relocating. The unresolved relocation error can be regarded as
an unsupported relocation. To make user easier to understand different errors,
we need to extend the current error message format of the callback function
since the format is fixed.
bfd/
* elfnn-riscv.c (riscv_elf_relocate_section): Use asprintf to extend
the error message if needed, and then store the result into the
`msg_buf`. Finally, remember to free the unused `msg_buf`. All error
message for the dangerous relocation should be set before we call the
callback function. If we miss the error message since linker runs out
of memory, we should set the default error message for the error.
ld/
* testsuite/ld-riscv-elf/lib-nopic-01a.s: Create the shared library
lib-nopic-01a.so, it will be linked with lib-nopic-01b.s.
* testsuite/ld-riscv-elf/lib-nopic-01b.s: Add new test for the
unresolved relocation. Link the non-pic code into a shared library
may cause the error.
* testsuite/ld-riscv-elf/lib-nopic-01b.d: Likewise.
* testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run the new test only when
the shared library is supported.
R_RISCV_CALL, R_RISCV_JAL and R_RISCV_RVC_JUMP are pc-relative relocation.
For now, we do not allow the object with these relocation links into a shared
library since the referenced symbols may be loaded to the places that too far
from the pc. We can improve the error message for these unsupported relocation
to notice user that they should recompile their code with `fPIC`.
bfd/
* elfnn-riscv.c (riscv_elf_relocate_section): Report the error message
that user should recompile their code with `fPIC` when linking non-pic
code into shared library.
ld/
* testsuite/ld-riscv-elf/lib-nopic-01b.d: Update the error message.
Change-Id: Ib3347a0a6fa1c2b20a9647c314d5bec2c322ff04
Tom Tromey [Thu, 29 Aug 2019 14:39:57 +0000 (10:39 -0400)]
Fix creation of stamp-h by gdb's configure script
I happened to notice that "make" would always print:
CONFIG_HEADERS=config.h:config.in \
CONFIG_COMMANDS="default depdir" \
CONFIG_FILES= \
CONFIG_LINKS= \
/bin/sh config.status
config.status: creating config.h
config.status: config.h is unchanged
on every rebuild. This seems to have changed due to an autoconf
upgrade at some point in the past. In the autoconf gdb uses now, it
works to use AC_CONFIG_HEADERS and then create the stamp file via the
"commands" argument.
This patch also fixes up Makefile.in to use the new-style
config.status invocation. It's no longer necessary to pass the output
file names via environment variables.
gdb/ChangeLog
2019-10-17 Tom Tromey <tromey@adacore.com>
* configure: Rebuild.
* configure.ac: Use AC_CONFIG_HEADERS. Create stamp-h there, not
in AC_CONFIG_FILES invocation.
* Makefile.in (Makefile, data-directory/Makefile, stamp-h): Use
new-style config.status invocation.
gdb/gdbserver/ChangeLog
2019-10-17 Tom Tromey <tromey@adacore.com>
* configure: Rebuild.
* configure.ac: Use AC_CONFIG_HEADERS. Create stamp-h there, not
in AC_CONFIG_FILES invocation.
* Makefile.in (stamp-h, Makefile): Use new-style config.status
invocation.
Change-Id: Ia0530d1c5b9756812d29ddb8dc1062326155e61e
Sergio Durigan Junior [Wed, 16 Oct 2019 20:47:33 +0000 (16:47 -0400)]
Add libctf to src-release.sh:GDB_SUPPORT_DIRS
We're forgetting to include the libctf directory when creating the
snapshot. This commit changes src-release.sh and adds it to
GDB_SUPPORT_DIRS.
2019-10-17 Sergio Durigan Junior <sergiodj@redhat.com>
* src-release.sh (GDB_SUPPORT_DIRS): Add libctf.
Change-Id: Iada82e5c9e4f8d5a0a5e467d2a628f1fba66002e
Tom de Vries [Thu, 17 Oct 2019 16:06:36 +0000 (18:06 +0200)]
[gdb] Fix typos in comments
Fix typos in comments. NFC.
Tested on x86_64-linux.
gdb/ChangeLog:
2019-10-17 Tom de Vries <tdevries@suse.de>
* arm-nbsd-nat.c: Fix typos in comments.
* arm-tdep.c: Same.
* darwin-nat-info.c: Same.
* dwarf2read.c: Same.
* elfread.c: Same.
* event-top.c: Same.
* findvar.c: Same.
* gdbtypes.c: Same.
* hppa-tdep.c: Same.
* i386-tdep.c: Same.
* jit.c: Same.
* main.c: Same.
* mdebugread.c: Same.
* moxie-tdep.c: Same.
* nto-procfs.c: Same.
* osabi.c: Same.
* ppc-linux-tdep.c: Same.
* remote.c: Same.
* riscv-tdep.c: Same.
* s390-tdep.c: Same.
* sh-tdep.c: Same.
* sparc-linux-tdep.c: Same.
* sparc-nat.c: Same.
* stack.c: Same.
* target-descriptions.c: Same.
* top.c: Same.
* varobj.c: Same.
Change-Id: I6047967abd2d51c9000dea15184d19f4e952c3ff
Tom de Vries [Thu, 17 Oct 2019 08:07:05 +0000 (10:07 +0200)]
[gdb/testsuite] Fix gdb.fortran/module.exp for debug info from other files
On openSUSE Leap 15.1, I get:
...
FAIL: gdb.fortran/module.exp: info variables -n
...
because the info variables command prints info also for init.c:
...
File init.c:^M
24: const int _IO_stdin_used;^M
...
while the regexps in the test-case only expect info for module.f90.
Fix this by extending the regexps.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-17 Tom de Vries <tdevries@suse.de>
* gdb.fortran/module.exp: Allow info variables to print info for files
other than module.f90.
Change-Id: I401d8018b121fc7343f6bc8b671900349462457f
Alan Modra [Thu, 17 Oct 2019 05:55:38 +0000 (16:25 +1030)]
PR29, Coreutils POSIX2_VERSION as 200112L
As of today we have just the following oddities left
./gnulib/update-gnulib.sh:ver=`autoconf --version 2>&1 | head -1 | sed 's/.*) //'`
./gnulib/update-gnulib.sh:ver=`automake --version 2>&1 | head -1 | sed 's/.*) //'`
./gnulib/update-gnulib.sh:ver=`aclocal --version 2>&1 | grep -v "called too early to check prototype" | head -1 | sed 's/.*) //'`
./src-release.sh: head -1 $tool/version.in
./contrib/dg-extract-results.sh:tail -2 $FIRST_SUM | $GREP '^#' > /dev/null || tail -2 $FIRST_SUM
gnulib and contrib (from gcc) are outside of binutils control, so with
this patch I'm going to declare this 15 year old bug fixed.
PR 29
* src-release.sh (getver): Replace "head -1" with "head -n 1".
Tom Tromey [Thu, 17 Oct 2019 00:46:43 +0000 (18:46 -0600)]
Constify objfile::original_name
I noticed that objfile::original_name could be a "const char *" rather
than a plain "char *". This patch implements this change. Tested by
rebuilding.
gdb/ChangeLog
2019-10-16 Tom Tromey <tom@tromey.com>
* objfiles.h (struct objfile) <original_name>: Now const.
GDB Administrator [Thu, 17 Oct 2019 00:00:23 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Wed, 24 Jul 2019 13:00:07 +0000 (14:00 +0100)]
gdb/fortran: Add test for module variables in 'info variables' output
Recent work from Tom Tromey to better handle variables with associated
copy relocations has fixed a Fortran issue where module variables
wouldn't show up in the output of 'info variables'.
This commit adds a test for this functionality to ensure it doesn't
get broken in the future.
gdb/testsuite/ChangeLog:
* gdb.fortran/module.exp: Extend with 'info variables' test.
Change-Id: I7306b1d0a9a72947fd48ad7a03f49df774d6573b
Andrew Burgess [Thu, 29 Aug 2019 15:07:01 +0000 (16:07 +0100)]
gdb/testsuite: Allow cc-with-tweaks board file to be used with Fortran
The board file cc-with-tweaks is used as the core for lots of other
board files, for example cc-with-gdb-index and cc-with-debug-names.
This commit extends cc-with-tweaks so that it will wrap the Fortran
compiler, allowing for more test coverage.
I tested all of the board files that make use of cc-with-tweaks
running the gdb.fortran/*.exp test set, and in some cases I did see
extra failures. The "standard" results are:
=== gdb Summary ===
# of expected passes 953
# of known failures 2
With board file 'cc-with-dwz-m':
=== gdb Summary ===
# of expected passes 903
# of unexpected failures 1
# of known failures 2
# of untested testcases 4
With board file 'dwarf4-gdb-index':
=== gdb Summary ===
# of expected passes 950
# of unexpected failures 3
# of known failures 2
With board file 'fission-dwp':
=== gdb Summary ===
# of expected passes 949
# of unexpected failures 4
# of known failures 2
Despite these extra failure I don't think this should prevent this
change going in as these failures presumably already exist in GDB.
gdb/testsuite/ChangeLog:
* boards/cc-with-tweaks.exp: Setup F90_FOR_TARGET and
F77_FOR_TARGET.
Change-Id: I06d412f94d0e119ad652dd6c20829f6705a54622
Christian Biesinger [Tue, 15 Oct 2019 15:02:33 +0000 (10:02 -0500)]
Allow not saving the signal state in SIGSETJMP
Saving the signal state is very slow (this patch is a 14% speedup). The
reason we need this code is because signal handler will leave the
signal blocked when we longjmp out of it. But in this case we can
just manually unblock the signal instead of taking the unconditional
perf hit.
gdb/ChangeLog:
2019-10-16 Christian Biesinger <cbiesinger@google.com>
* gdbsupport/gdb_setjmp.h (SIGSETJMP): Allow passing in the value to
pass on to sigsetjmp's second argument.
* cp-support.c (gdb_demangle): Unblock SIGSEGV if we caught a crash.
Change-Id: Ib3010966050c64b4cc8b47d8cb45871652b0b3ea
Keith Seitz [Wed, 16 Oct 2019 18:33:59 +0000 (11:33 -0700)]
DWARF reader: Reject sections with invalid sizes
This is another fuzzer bug, gdb/23567. This time, the fuzzer has
specifically altered the size of .debug_str:
$ eu-readelf -S objdump
Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[31] .debug_str PROGBITS
0000000000000000 0057116d ffffffffffffffff 1 MS 0 0 1
When this file is loaded into GDB, the DWARF reader crashes attempting
to access the string table (or it may just store a bunch of nonsense):
[gdb-8.3-6-fc30]
$ gdb -nx -q objdump
BFD: warning: /path/to/objdump has a corrupt section with a size (
ffffffffffffffff) larger than the file size
Reading symbols from /path/to/objdump...
Segmentation fault (core dumped)
Nick has already committed a BFD patch to issue the warning seen above.
[gdb master
6acc1a0b]
$ gdb -BFD: warning: /path/to/objdump has a corrupt section with a size (
ffffffffffffffff) larger than the file size
Reading symbols from /path/to/objdump...
(gdb) inf func
All defined functions:
File ./../include/dwarf2.def:
186: const
8 *>(.:
;'@�B);
747: const
8 *�(.:
;'@�B);
701: const
8 *�D �
(.:
;'@�B);
71: const
8 *(.:
;'@�B);
/* and more gibberish */
Consider read_indirect_string_at_offset_from:
static const char *
read_indirect_string_at_offset_from (struct objfile *objfile,
bfd *abfd, LONGEST str_offset,
struct dwarf2_section_info *sect,
const char *form_name,
const char *sect_name)
{
dwarf2_read_section (objfile, sect);
if (sect->buffer == NULL)
error (_("%s used without %s section [in module %s]"),
form_name, sect_name, bfd_get_filename (abfd));
if (str_offset >= sect->size)
error (_("%s pointing outside of %s section [in module %s]"),
form_name, sect_name, bfd_get_filename (abfd));
gdb_assert (HOST_CHAR_BIT == 8);
if (sect->buffer[str_offset] == '\0')
return NULL;
return (const char *) (sect->buffer + str_offset);
}
With sect_size being ginormous, the code attempts to access
sect->buffer[GINORMOUS], and depending on the layout of memory,
GDB either stores a bunch of gibberish strings or crashes.
This is an attempt to mitigate this by implementing a similar approach
used by BFD. In our case, we simply reject the section with the invalid
length:
$ ./gdb -nx -q objdump
BFD: warning: /path/to/objdump has a corrupt section with a size (
ffffffffffffffff) larger than the file size
Reading symbols from /path/to/objdump...
warning: Discarding section .debug_str which has a section size (
ffffffffffffffff) larger than the file size [in module /path/to/objdump]
DW_FORM_strp used without .debug_str section [in module /path/to/objdump]
(No debugging symbols found in /path/to/objdump)
(gdb)
Unfortunately, I have not found a way to regression test this, since it
requires poking ELF section headers.
gdb/ChangeLog:
2019-10-16 Keith Seitz <keiths@redhat.com>
PR gdb/23567
* dwarf2read.c (dwarf2_per_objfile::locate_sections): Discard
sections whose size is greater than the file size.
Change-Id: I896ac3b4eb2207c54e8e05c16beab3051d9b4b2f
Jim Wilson [Wed, 16 Oct 2019 17:58:37 +0000 (10:58 -0700)]
Add initial compile command support to RISC-V port.
This adds initial compile command support to the RISC-V port. This fixes
about 228 testsuite failures on a riscv64-linux machine. We need to get
the triplet right which is normally riscv64 or riscv32 instead of the
default riscv. Also, we need to get the compiler options right, since we
don't accept the default -m64 and -mcmodel=large options, so we need to
construct -march and -mabi options which are correct for the target. We
currently don't have info about all extensions used by the target, so this
may need to be adjusted later. For now, I'm assuming that we have all
extensions required by the linux platform spec.
gdb/
* riscv-tdep.c (riscv_gcc_target_options): New.
(riscv_gnu_triplet_regexp): New.
(riscv_gdbarch_init): Call set_gdbarch_gcc_triplet_options and
set_gdbarch_gnu_triplet_regexp.
Change-Id: I315ce8de7789ddf7bdd3b532f917519464941294
Christian Biesinger [Thu, 10 Oct 2019 01:08:13 +0000 (20:08 -0500)]
Create xml-builtin.h to declare xml_builtins
xml-builtin.c only has character arrays and no dependencies, so this
creates a simple header file for that purpose so that gdbserver
can include that instead of re-declaring xml_builtin.
Despite the name, feature_to_c.sh is already specific to xml_builtins
(it hardcodes the variable name), so making it always output the
include for xml-builtin.h seems fine.
gdb/ChangeLog:
2019-10-16 Christian Biesinger <cbiesinger@google.com>
* Makefile.in: Add xml-builtin.h.
* features/feature_to_c.sh: Add an include for xml-builtin.h
to ensure that the compiler checks that the types match.
* xml-builtin.h: New file.
* xml-support.c (fetch_xml_builtin): Add missing const.
* xml-support.h: Remove declaration of xml_builtins.
gdb/gdbserver/ChangeLog:
2019-10-16 Christian Biesinger <cbiesinger@google.com>
* server.c: Include xml-builtin.h.
(get_xml_features): Don't declare xml_builtins here.
Change-Id: I806ef0851c43ead90b545a11794e41f5e5178436
Simon Marchi [Wed, 16 Oct 2019 15:11:28 +0000 (11:11 -0400)]
libctf: mark swap.h inline functions as static
When building binutils with mingw-w64, I get the following errors:
make[4]: Entering directory '/home/simark/build/binutils-gdb-mingw/binutils'
/bin/sh ./libtool --tag=CC --mode=link ccache x86_64-w64-mingw32-gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wno-format -Werror -I/home/simark/src/binutils-gdb/binutils/../zlib -g3 -O0 -D__USE_MINGW_ACCESS -Wl,--stack,
12582912 -o objdump.exe objdump.o dwarf.o prdbg.o rddbg.o debug.o stabs.o rdcoff.o bucomm.o version.o filemode.o elfcomm.o ../opcodes/libopcodes.la ../libctf/libctf.la ../bfd/libbfd.la ../libiberty/libiberty.a -lintl
libtool: link: ccache x86_64-w64-mingw32-gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -Wno-format -Werror -I/home/simark/src/binutils-gdb/binutils/../zlib -g3 -O0 -D__USE_MINGW_ACCESS -Wl,--stack -Wl,
12582912 -o .libs/objdump.exe objdump.o dwarf.o prdbg.o rddbg.o debug.o stabs.o rdcoff.o bucomm.o version.o filemode.o elfcomm.o ../opcodes/.libs/libopcodes.a ../libctf/.libs/libctf.a -L/home/simark/build/binutils-gdb-mingw/zlib ../bfd/.libs/libbfd.a -lz ../libiberty/libiberty.a -lintl
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o): in function `flip_header':
/home/simark/src/binutils-gdb/libctf/ctf-open.c:964: undefined reference to `bswap_16'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:967: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:968: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:969: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:970: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:971: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o):/home/simark/src/binutils-gdb/libctf/ctf-open.c:972: more undefined references to `bswap_32' follow
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o): in function `flip_types':
/home/simark/src/binutils-gdb/libctf/ctf-open.c:1112: undefined reference to `bswap_16'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1113: undefined reference to `bswap_16'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1132: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1133: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1134: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1135: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: /home/simark/src/binutils-gdb/libctf/ctf-open.c:1144: undefined reference to `bswap_32'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o):/home/simark/src/binutils-gdb/libctf/ctf-open.c:1145: more undefined references to `bswap_32' follow
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open.o): in function `ctf_bufopen_internal':
/home/simark/src/binutils-gdb/libctf/ctf-open.c:1342: undefined reference to `bswap_16'
/usr/lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld: ../libctf/.libs/libctf.a(ctf-open-bfd.o): in function `ctf_fdopen':
/home/simark/src/binutils-gdb/libctf/ctf-open-bfd.c:268: undefined reference to `bswap_16'
Apparently [1], if we have a function with `inline` but not `static`,
there should be a compilation unit defining the symbol too.
Alternatively, making those functions `static` fixes that.
[1] https://stackoverflow.com/questions/
16245521/c99-inline-function-in-c-file/
16254679#
16254679
libctf/ChangeLog:
* swap.h (bswap_16, bswap_32, bswap_64): Make static.
Change-Id: I8fd12aedf6c90f9b7418af948e5e0bae0c32eead
Tom de Vries [Wed, 16 Oct 2019 15:11:56 +0000 (17:11 +0200)]
[gdb/tdep] Fix inferior call arg passing for amd64
We currently have 12 KFAILS in gdb.base/infcall-nested-structs.exp for
PR tdep/25096.
A minimal version of the failure looks like this. Consider test.c:
...
struct s { int c; struct { int a; float b; } s1; };
struct s ref = { 0, { 'a', 'b' } };
int __attribute__((noinline,noclone)) check (struct s arg)
{ return arg.s1.a == 'a' && arg.s1.b == 'b' && arg.c == 0; }
int main (void)
{ return check (ref); }
...
When calling 'check (ref)' from main, we have '1' as expected:
...
$ g++ test.c -g ; ./a.out ; echo $?
1
...
But when calling 'check (ref)' from the gdb prompt, we get '0':
...
$ gdb a.out -batch -ex start -ex "p check (ref)"
Temporary breakpoint 1 at 0x400518: file test.c, line 8.
Temporary breakpoint 1, main () at test.c:8
8 { return check (ref); }
$1 = 0
...
The layout of struct s is this:
- the field c occupies 4 bytes at offset 0,
- the s1.a field occupies 4 bytes at offset 4, and
- the s1.b field occupies 4 bytes at offset 8.
When compiling at -O2, we can see from the disassembly of main:
...
4003f0: 48 8b 3d 31 0c 20 00 mov 0x200c31(%rip),%rdi \
# 601028 <ref>
4003f7: f3 0f 10 05 31 0c 20 movss 0x200c31(%rip),%xmm0 \
# 601030 <ref+0x8>
4003fe: 00
4003ff: e9 ec 00 00 00 jmpq 4004f0 <_Z5check1s>
...
that check is called with fields c and s1.a passed in %rdi, and s1.b passed
in %xmm0.
However, the classification in theclass (a variable representing the first and
second eightbytes, to put it in SYSV X86_64 psABI terms) in
amd64_push_arguments is incorrect:
...
(gdb) p theclass
$1 = {AMD64_INTEGER, AMD64_INTEGER}
...
and therefore the struct is passed using %rdi and %rsi instead of using %rdi
and %xmm0, which explains the failure.
The reason that we're misclassifying the argument in amd64_classify_aggregate
has to do with how nested struct are handled.
Rather than using fields c and s1.a for the first eightbyte, and using field
s1.b for the second eightbyte, instead field c is used for the first
eightbyte, and fields s1.a and s1.b are classified together in an intermediate
eightbyte, which is then used to merge with both the first and second
eightbyte.
Fix this by factoring out a new function amd64_classify_aggregate_field, and
letting it recursively handle fields of nested structs.
Tested on x86_64-linux.
Tested with g++ 4.8.5, 7.4.1, 8.3.1, 9.2.1.
Tested with clang++ 5.0.2 (which requires removing additional_flags=-Wno-psabi
and adding additional_flags=-Wno-deprecated).
gdb/ChangeLog:
2019-10-16 Tom de Vries <tdevries@suse.de>
PR tdep/25096
* amd64-tdep.c (amd64_classify_aggregate_field): Factor out of ...
(amd64_classify_aggregate): ... here.
(amd64_classify_aggregate_field): Handled fiels of nested structs
recursively.
gdb/testsuite/ChangeLog:
2019-10-16 Tom de Vries <tdevries@suse.de>
PR tdep/25096
* gdb.base/infcall-nested-structs.exp: Remove PR25096 KFAILs.
Change-Id: Id55c74755f0a431ce31223acc86865718ae0c123
Tom de Vries [Wed, 16 Oct 2019 15:11:56 +0000 (17:11 +0200)]
[gdb/tdep] Fix 'Unexpected register class' assert in amd64_push_arguments
Atm, when executing gdb.base/infcall-nested-structs.exp on x86_64-linux, we get:
...
FAIL: gdb.base/infcall-nested-structs.exp: l=c++: types-tc-tf: \
p/d check_arg_struct_02_01 (ref_val_struct_02_01)
FAIL: gdb.base/infcall-nested-structs.exp: l=c++: types-ts-tf: \
p/d check_arg_struct_02_01 (ref_val_struct_02_01)
FAIL: gdb.base/infcall-nested-structs.exp: l=c++: types-ti-tf: \
p/d check_arg_struct_02_01 (ref_val_struct_02_01)
=== gdb Summary ===
nr of expected passes 9255
nr of unexpected failures 3
nr of expected failures 142
...
The 3 FAILs are reported as PR tdep/25096.
The 142 XFAILs are for a gdb assertion failure, reported in PR tdep/24104,
which should have been KFAILs since there's a problem in gdb rather than in
the environment.
A minimal version of the assertion failure looks like this. Consider test.c:
...
struct s { struct { } es1; long f; };
struct s ref = { {}, 'f' };
int __attribute__((noinline,noclone)) check (struct s arg)
{ return arg.f == 'f'; }
int main (void)
{ return check (ref); }
...
When calling 'check (ref)' from main, we have '1' as expected:
...
$ g++ test3.c -g && ( ./a.out; echo $? )
1
...
But when calling 'check (ref)' from the gdb prompt, we get:
...
$ gdb a.out -batch -ex start -ex "p check (ref)"
Temporary breakpoint 1 at 0x4004f7: file test.c, line 8.
Temporary breakpoint 1, main () at test.c:8
8 { return check (ref); }
src/gdb/amd64-tdep.c:982: internal-error: \
CORE_ADDR amd64_push_arguments(regcache*, int, value**, CORE_ADDR, \
function_call_return_method): \
Assertion `!"Unexpected register class."' failed.
...
The assert happens in this loop in amd64_push_arguments:
...
for (j = 0; len > 0; j++, len -= 8)
{
int regnum = -1;
int offset = 0;
switch (theclass[j])
{
case AMD64_INTEGER:
regnum = integer_regnum[integer_reg++];
break;
case AMD64_SSE:
regnum = sse_regnum[sse_reg++];
break;
case AMD64_SSEUP:
gdb_assert (sse_reg > 0);
regnum = sse_regnum[sse_reg - 1];
offset = 8;
break;
default:
gdb_assert (!"Unexpected register class.");
}
...
}
...
when processing theclass[0], which is AMD64_NO_CLASS:
...
(gdb) p theclass
$1 = {AMD64_NO_CLASS, AMD64_INTEGER}
...
The layout of struct s is that the empty field es1 occupies one byte (due to
c++) at offset 0, and the long field f occupies 8 bytes at offset 8.
When compiling at -O2, we can see from the disassembly of main:
...
4003f0: 48 8b 3d 41 0c 20 00 mov 0x200c41(%rip),%rdi \
# 601038 <ref+0x8>
4003f7: e9 e4 00 00 00 jmpq 4004e0 <_Z5check1s>
4003fc: 0f 1f 40 00 nopl 0x0(%rax)
...
that check is called with field f passed in %rdi, meaning that the
classification in theclass is correct, it's just not supported in the loop in
amd64_push_arguments mentioned above.
Fix the assert by implementing support for 'AMD64_NO_CLASS' in that loop.
This exposes 9 more FAILs of the PR tdep/25096 type, so mark all 12 of them as
KFAIL.
Tested on x86_64-linux.
Tested with g++ 4.8.5, 7.4.1, 8.3.1, 9.2.1. With 4.8.5, 3 of the 12 KFAILs
are KPASSing.
Tested with clang++ 5.0.2 (which requires removing additional_flags=-Wno-psabi
and adding additional_flags=-Wno-deprecated).
gdb/ChangeLog:
2019-10-16 Tom de Vries <tdevries@suse.de>
PR tdep/24104
* amd64-tdep.c (amd64_push_arguments): Handle AMD64_NO_CLASS in loop
that handles 'theclass'.
gdb/testsuite/ChangeLog:
2019-10-16 Tom de Vries <tdevries@suse.de>
PR tdep/24104
* gdb.base/infcall-nested-structs.exp: Remove XFAIL for PR tdep/24104.
Add KFAIL for PR tdep/25096.
Change-Id: I8b66345bbf5c00209ca75b1209fd4d60b36e9ede
Tom de Vries [Wed, 16 Oct 2019 15:00:04 +0000 (17:00 +0200)]
[gdb/testsuite] Fix local-static.exp with g++-4.8
With g++-4.8, I see:
...
(gdb) PASS: gdb.cp/local-static.exp: c++: print free_inline_func(void)
print 'S::method()'::S_M_s_var_int^M
No symbol "S_M_s_var_int" in specified context.^M
(gdb) FAIL: gdb.cp/local-static.exp: c++: print 'S::method()'::S_M_s_var_int
...
The variable is declared like this (showing pruned .ii):
...
void S::method ()
{
static int S_M_s_var_int = 4;
}
...
But the DWARF generated for the variable is encapsulated in an unnamed lexical
block:
...
<1><121>: Abbrev Number: 5 (DW_TAG_structure_type)
<122> DW_AT_name : S
...
<2><14f>: Abbrev Number: 6 (DW_TAG_subprogram)
...
<150> DW_AT_name : (indirect string, offset: 0x599): method
<156> DW_AT_linkage_name: (indirect string, offset: 0x517): \
_ZN1S6methodEv /* demangled: dS::method() */
...
<1><3f8>: Abbrev Number: 21 (DW_TAG_subprogram)
<3f9> DW_AT_specification: <0x14f>
...
<3fe> DW_AT_low_pc : 0x4004fc
<406> DW_AT_high_pc : 0x2c /* 0x400528 */
...
<2><418>: Abbrev Number: 17 (DW_TAG_formal_parameter)
<419> DW_AT_name : (indirect string, offset: 0x68a): this
...
<2><424>: Abbrev Number: 18 (DW_TAG_lexical_block)
<425> DW_AT_low_pc : 0x400508
<42d> DW_AT_high_pc : 0x1e /* 0x400526 */
<3><435>: Abbrev Number: 22 (DW_TAG_variable)
<436> DW_AT_name : (indirect string, offset: 0x29d): S_M_s_var_int
...
which has the effect that the variable is not addressable unless the program
counter is in the range of the lexical block.
This is caused by gcc PR debug/55541, which was fixed in gcc 5.
Mark in total 225 FAILs as XFAIL.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-16 Tom de Vries <tdevries@suse.de>
PR testsuite/25059
* gdb.cp/local-static.exp (do_test): Add xfails for gcc PR debug/55541.
Change-Id: Ibe86707eecffc79f1bb474d7928ea7d0c39a00a2
Tom de Vries [Wed, 16 Oct 2019 14:53:37 +0000 (16:53 +0200)]
[gdb/testsuite] Fix regexp for reg value in jit-reader.exp
On openSUSE Leap 15.1 (as well as on Fedora-x86_64-m64 buildbot) I see:
...
FAIL: gdb.base/jit-reader.exp: with jit-reader: after mangling: current frame: info registers
...
The problem is that r10 is printed signed:
...
r10 0xffffffffffffffb0 -80^M
...
but the regexp expects a signed value:
...
"r10 $hex +$decimal" \
...
Fix this by allowing signed values.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-16 Tom de Vries <tdevries@suse.de>
* gdb.base/jit-reader.exp: Allow non-pointer registers to be printed
as signed.
Change-Id: Ie494d24fad7a9af7ac6bfaf731c4aa04f1333830
Alan Modra [Wed, 16 Oct 2019 10:53:29 +0000 (21:23 +1030)]
PR13616, linker should pad executable sections with nops, not zeros
This implements padding of orphan executable sections for PowerPC.
Of course, the simple implementation of bfd_arch_ppc_nop_fill and
removing the NOP definition didn't work, with powerpc64 hitting a
testsuite failure linking to S-records. That's because the srec
target is BFD_ENDIAN_UNKNOWN so the test of bfd_big_endian (abfd) in
default_data_link_order therefore returned false, resulting in a
little-endian nop pattern. The rest of the patch fixes that problem
by adding a new field to bfd_link_info that can be used to determine
actual endianness on targets like srec.
PR 13616
include/
* bfdlink.h (struct bfd_link_info <big_endian>): New field.
bfd/
* cpu-powerpc.c (bfd_arch_ppc_nop_fill): New function, use it
for all ppc arch info.
* linker.c (default_data_link_order): Pass info->big_endian to
arch_info->fill function.
ld/
* emulparams/elf64lppc.sh (NOP): Don't define.
* emulparams/elf64ppc.sh (NOP): Don't define.
* ldwrite.c (build_link_order): Use link_info.big_endian. Move
code determining endian to use for data_statement to..
* ldemul.c (after_open_default): ..here. Set link_info.big_endian.
Nick Clifton [Wed, 16 Oct 2019 11:56:58 +0000 (12:56 +0100)]
Fix potential illegal memory access when disassembling corrupt RX binaries.
opcodes * rx-dis.c (get_register_name): New function. Provides safe
access to name array.
(get_condition_name, get_flag_name, get_double_register_name)
(get_double_register_high_name, get_double_register_low_name)
(get_double_control_register_name, get_double_condition_name):
Likewise.
(print_insn_rx): Use the accessor functions.
Alan Modra [Tue, 15 Oct 2019 12:36:21 +0000 (23:06 +1030)]
genscripts comment tidy
Some of the comments in this file are ancient and no longer reflect
reality. This patch removes those comments, and also the description
of ld options emitted to script files. While describing what an
option does in the script file might help reinforce what the option
does, it's unnecessary and makes for overlong lines. Also, some of
the descriptions did not mention all the options.
* genscripts.sh: Correct comments. Remove outdated comment block
saying "Generate 5 or 6 script files..". Remove description of
ld options from comment emitted to script files, and order options
as per comment block in genscripts.sh saying which scripts are
generated.
Alan Modra [Tue, 15 Oct 2019 12:34:14 +0000 (23:04 +1030)]
qsort: tc-xtensa.c tidy
Not much to see here, just reduce the number of calls to S_GET_VALUE
and symbol_symbolS in the comparison functions.
* config/tc-xtensa.c (xg_order_trampoline_chain_entry): Don't
call S_GET_VALUE multiple times for a symbol. Rearrange code
so it is obvious what is the primary sort key.
(xg_order_trampoline_chain): Similarly.
GDB Administrator [Wed, 16 Oct 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Tue, 15 Oct 2019 21:00:05 +0000 (22:00 +0100)]
gdb/gdbserver: Remove reference to vec-ipa.o
This comit:
commit
0dc327459b19e6765c8fe80957f5c8620611628e
Date: Mon Oct 7 16:38:53 2019 +0100
gdb: Remove vec.{c,h} and update code to not include vec.h
Broke the GDB build due to leaving a reference to vec-ipa.o in the
Makefile.in, this file is built from vec.c which has been removed.
I got away with this as I had an old version of the vec-ipa.o file
still in my build tree.
With this commit in place a clean build now completed successfully.
gdb/ChangeLog:
* Makefile.in: Remove references to vec-ipa.o.
Change-Id: I4cf55951158dd7ee8f60cd054311a7c367e1d7bf
Andrew Burgess [Mon, 7 Oct 2019 15:45:24 +0000 (16:45 +0100)]
gdb: Update comments that reference VEC or vec.h
With the removal of the old VEC mechanism from the code base, update
comments that still make reference to VECs. There should be no user
visible changes after this commit.
gdb/ChangeLog:
* linespec.c (decode_digits_ordinary): Update comment.
* make-target-delegates: No longer need to handle VEC case.
* memrange.c (normalize_mem_ranges): Update comment.
* namespace.c (add_using_directive): Update comment.
* objc-lang.c (uniquify_strings): Update comment.
* ppc-linux-nat.c (struct thread_points): Update comment.
* probe.h (find_probes_in_objfile): Update comment.
* target.h (enum flash_preserve_mode): Update comment.
* varobj.c (varobj_restrict_range): Update comment.
* varobj.h (varobj_list_children): Update comment.
Change-Id: Iefd2e903705c3e79cd13b43395c7a1c167f9a088
Andrew Burgess [Mon, 7 Oct 2019 15:38:53 +0000 (16:38 +0100)]
gdb: Remove vec.{c,h} and update code to not include vec.h
Removes vec.c and vec.h from the source tree, and remove all the
remaining includes of vec.h. There should be no user visible changes
after this commit.
I did have a few issues rebuilding GDB after applying this patch due
to cached dependencies, I found that running this command in the build
directory resolved my build issues without requiring a 'make clean':
rm -fr gdb/gdbserver/gdbsupport/.deps/
gdb/ChangeLog:
* Makefile.in: Remove references to vec.h and vec.c.
* aarch64-tdep.c: No longer include vec.h.
* ada-lang.c: Likewise.
* ada-lang.h: Likewise.
* arm-tdep.c: Likewise.
* ax.h: Likewise.
* breakpoint.h: Likewise.
* charset.c: Likewise.
* cp-support.h: Likewise.
* dtrace-probe.c: Likewise.
* dwarf2read.c: Likewise.
* extension.h: Likewise.
* gdb_bfd.c: Likewise.
* gdbsupport/gdb_vecs.h: Likewise.
* gdbsupport/vec.c: Remove.
* gdbsupport/vec.h: Remove.
* gdbthread.h: Likewise.
* guile/scm-type.c: Likewise.
* inline-frame.c: Likewise.
* machoread.c: Likewise.
* memattr.c: Likewise.
* memrange.h: Likewise.
* namespace.h: Likewise.
* nat/linux-btrace.h: Likewise.
* osdata.c: Likewise.
* parser-defs.h: Likewise.
* progspace.h: Likewise.
* python/py-type.c: Likewise.
* record-btrace.c: Likewise.
* rust-exp.y: Likewise.
* solib-target.c: Likewise.
* stap-probe.c: Likewise.
* target-descriptions.c: Likewise.
* target-memory.c: Likewise.
* target.h: Likewise.
* varobj.c: Likewise.
* varobj.h: Likewise.
* xml-support.h: Likewise.
gdb/gdbserver/ChangeLog:
* Makefile.in: Remove references to vec.c.
Change-Id: I0c91d7170bf1b5e992a387fcd9fe4f2abe343bb5
Andrew Burgess [Wed, 2 Oct 2019 14:38:51 +0000 (15:38 +0100)]
gdb: Remove use of VEC from dwarf2read.c
This removes a use of VEC from GDB, from dwarf2read.c. This removal
is not very clean, and would probably benefit from additional
refactoring in the future.
The problem here is that the VEC is contained within struct
dwarf2_per_cu_data, which is treated as POD in dwarf2read.c. As such
it is actually a VEC pointer. When converting this to a std::vector
in an ideal world we would not use a std::vector pointer, and use the
std::vector directly. Sadly, to do that would require some rewriting
in dwarf2read.c - my concern would be introducing bugs during this
rewrite.
If we move to a std::vector pointer then we need to take care to
handle the case where the pointer is null. The old VEC library would
handle null for us, making the VEC interface very clean. With
std::vector we need to handle the null pointer case ourselves.
The achieve this then I've added a small number of function that wrap
up access to the std::vector, hopefully hiding the null pointer
management.
The final ugliness with this conversion is that, ideally, when
wrapping a data member behind an interface I would make the data
member private, however, treating the structure as POD once again
prevents this, so we are left with the data member being public, but
access (ideally) being through the published interface functions.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* gdb/dwarf2read.c (dwarf2_per_objfile::~dwarf2_per_objfile):
Update for new std::vector based implementation.
(process_psymtab_comp_unit_reader): Likewise.
(scan_partial_symbols): Likewise.
(recursively_compute_inclusions): Likewise.
(compute_compunit_symtab_includes): Likewise.
(process_imported_unit_die): Likewise.
(queue_and_load_dwo_tu): Likewise.
(follow_die_sig_1): Likewise.
* gdb/dwarf2read.h: Remove DEF_VEC_P.
(typedef dwarf2_per_cu_ptr): Remove.
(struct dwarf2_per_cu_data) <imported_symtabs_empty>: New
function.
(struct dwarf2_per_cu_data) <imported_symtabs_push>: New function.
(struct dwarf2_per_cu_data) <imported_symtabs_size>: New function.
(struct dwarf2_per_cu_data) <imported_symtabs_free>: New function.
(struct dwarf2_per_cu_data) <imported_symtabs>: Change to
std::vector.
Change-Id: Id0f4bda977c9dd83b0ba3d7fb42f7e5e2b6869c8
Tom Tromey [Fri, 11 Oct 2019 16:34:10 +0000 (10:34 -0600)]
Use %x when printing the TID
One spot in windows-nat.c uses %ld to print the TID, but all other
spots use %x, as does the infrun logging. This makes it unnecessarily
hard to tell which other log messages correspond to this one. This
patch changes the one outlier to use %x.
gdb/ChangeLog
2019-10-15 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat_target::resume): Use %x when logging
TID.
Change-Id: Ic66efeb8a7ec08e7fb007320318f51acbf976734
Tom Tromey [Thu, 10 Oct 2019 17:33:16 +0000 (11:33 -0600)]
Rename pid -> tid in windows-nat.c
A couple of spots in windows-nat.c used the name "pid" to refer to the
thread ID. I found this confusing, so this patch changes the names.
gdb/ChangeLog
2019-10-15 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat_target::fetch_registers)
(windows_nat_target::store_registers): Rename "pid" to "tid".
Change-Id: Ia1a447e8da822d01ad94a5ca3760342bbdc0e66c
Tom Tromey [Tue, 15 Oct 2019 16:57:40 +0000 (10:57 -0600)]
Change gcc_target_options to return std::string
This patch was inspired by a recent review that recommended using
std::string in a new implementation of the gcc_target_options gdbarch
function. It changes this function to return std::string rather than
an ordinary xmalloc'd string.
I believe this caught a latent memory leak in compile.c:get_args.
Tested on x86-64 Fedora 29.
gdb/ChangeLog
2019-10-15 Tom Tromey <tromey@adacore.com>
* gdbarch.h, gdbarch.c: Rebuild.
* gdbarch.sh (gcc_target_options): Change return type to
std::string.
* compile/compile.c (get_args): Update.
* nios2-tdep.c (nios2_gcc_target_options): Return std::string.
* arm-linux-tdep.c (arm_linux_gcc_target_options): Return
std::string.
* aarch64-linux-tdep.c (aarch64_linux_gcc_target_options): Return
std::string.
* arch-utils.c (default_gcc_target_options): Return std::string.
* arch-utils.h (default_gcc_target_options): Return std::string.
* s390-tdep.c (s390_gcc_target_options): Return std::string.
Change-Id: I51f61703426a323089e646da8f22320a2cafbc1f
Christian Biesinger [Mon, 7 Oct 2019 22:38:51 +0000 (17:38 -0500)]
Make tui-winsource not use breakpoint_chain
That's an internal variable of breakpoint.c. Insted, use
iterate_over_breakpoints to update the breakpoint list.
gdb/ChangeLog:
2019-10-15 Christian Biesinger <cbiesinger@google.com>
* breakpoint.c (breakpoint_chain): Make static.
* tui/tui-winsource.c: Call iterate_over_breakpoints instead
of accessing breakpoint_chain.
Change-Id: Ic259b2c3a4c1f5a47f34cfd7fccbdcf274417429
Christian Biesinger [Wed, 9 Oct 2019 18:50:20 +0000 (13:50 -0500)]
Change iterate_over_breakpoints to take a function_view
This allows callers to pass in capturing lambdas. Also changes the return
type to bool.
gdb/ChangeLog:
2019-10-15 Christian Biesinger <cbiesinger@google.com>
* breakpoint.c (iterate_over_breakpoints): Change function pointer
to a gdb::function_view and return value to bool.
* breakpoint.h (iterate_over_breakpoints): Likewise.
* dummy-frame.c (pop_dummy_frame_bpt): Update.
(pop_dummy_frame): Update.
* guile/scm-breakpoint.c (bpscm_build_bp_list): Update.
(gdbscm_breakpoints): Update.
* python/py-breakpoint.c (build_bp_list): Update.
(gdbpy_breakpoints): Update.
* python/py-finishbreakpoint.c (bpfinishpy_detect_out_scope_cb):
Update.
(bpfinishpy_handle_stop): Update.
(bpfinishpy_handle_exit): Update.
* solib-svr4.c (svr4_update_solib_event_breakpoint): Update.
(svr4_update_solib_event_breakpoints): Update.
Change-Id: Ia9de4deecae562a70a40f5cd49f5a74d64570251
Alan Modra [Tue, 15 Oct 2019 09:03:17 +0000 (19:33 +1030)]
m68hc1x: better arg checking for reloc_warning
* elf32-m68hc1x.c (reloc_warning): Add printf attribute.
(elf32_m68hc11_relocate_section): Don't use a variable for format
strings. Delete some unnecessary xgettext:c-format comments.
Andreas Arnez [Tue, 15 Oct 2019 12:20:14 +0000 (14:20 +0200)]
s390: Fix infcalls passing a single-field struct with static members
The infcall-nested-structs test case yields 36 FAILs on s390x because GCC
and GDB disagree on how to pass a C++ struct like this as an argument to a
function:
struct s { float x; static float y; };
For the purpose of argument passing, GCC ignores static fields, while GDB
does not. Thus GCC passes the argument in a floating-point register and
GDB passes it via memory.
Fix this by explicitly ignoring static fields when detecting single-field
structs.
gdb/ChangeLog:
* s390-tdep.c (s390_effective_inner_type): Ignore static fields
when unwrapping single-field structs.
Alan Modra [Tue, 15 Oct 2019 05:27:35 +0000 (15:57 +1030)]
remove more xmalloc in bfd
Also fixes m68hc1x printf arguments which would have bombed when
compiling on a 32-bit host with --enable-64-bit-bfd.
bfd/
PR 24955
* elf32-arm.c (set_cmse_veneer_addr_from_implib): Use bfd_malloc
rather than xmalloc.
* elf32-m68hc1x.c (reloc_warning): New function.
(elf32_m68hc11_relocate_section): Use it here. Cast bfd_vma values
corresponding to %lx in format strings.
* elf32-nds32.c (nds32_insertion_sort): Use a stack temporary.
gas/
* config/tc-nds32.c (nds32_set_section_relocs): Use relocs and n
parameters rather than equivalent sec->orelocation and
sec->reloc_count. Don't sort for n <= 1. Tidy.
Alan Modra [Tue, 15 Oct 2019 01:28:11 +0000 (11:58 +1030)]
PR25100, Compile fails in elf64-ppc.c because of single equal sign instead of double equal for comparison
PR 25100
* elf64-ppc.c (sfpr_define): Delete dead code that triggered a warning.
Alan Modra [Mon, 14 Oct 2019 09:59:12 +0000 (20:29 +1030)]
Simplify power of two test
* bfd.c (bfd_check_compression_header): Check for powers of two
with x == (x & -x).
Tom de Vries [Tue, 15 Oct 2019 00:21:37 +0000 (02:21 +0200)]
[gdb/testsuite] Fix gdb.ada/mi_task_arg.exp
On openSUSE Leap 15.1, we have:
...
FAIL: gdb.ada/mi_task_arg.exp: -stack-list-arguments 1 (unexpected output)
...
The problem is that the stack-list-arguments command prints a frame argument
'self_id' for function system.tasking.stages.task_wrapper:
...
frame={level="2",args=[{name="self_id",value="0x12345678"}]
...
where none (args=[]) is expected.
The frame argument is in fact correct. The FAIL does not show for say, fedora
30, because there the executable uses the system.tasking.stages.task_wrapper
from /lib64/libgnarl-9.so. Adding "additional_flags=-bargs
additional_flags=-shared additional_flags=-largs" to the flags argument of
gdb_compile_ada gives us the same PASS, but installing libada7-debuginfo gets
us the same FAIL again.
Fix the FAIL by allowing the 'self_id' argument.
Tested on x86_64-linux.
Change-Id: I5aee5856fa6aeb0cc78aa4fe69deecba5b00b77a
GDB Administrator [Tue, 15 Oct 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 14 Oct 2019 04:37:30 +0000 (00:37 -0400)]
gdb.mi/list-thread-groups-available.exp: read entries one by one instead of increasing timeout
Commit
580f1034 ("Increase timeout in
gdb.mi/list-thread-groups-available.exp") changed
gdb.mi/list-thread-groups-available.exp to significantly increase the
timeout, which was necessary for when running with make check-read1.
Pedro suggested a better alternative, which is to use gdb_test_multiple
and consume one entry at a time. This patch does that.
gdb/testsuite/ChangeLog:
* gdb.mi/list-thread-groups-available.exp: Read entries one by
one instead of increasing timeout.
Change-Id: I51b689458503240f24e401f054e6583d9172ebdf
Simon Marchi [Sun, 13 Oct 2019 04:46:13 +0000 (00:46 -0400)]
gdb: remove unused includes from dwarf2read.c
include-what-you-use says:
../../../src/binutils-gdb/gdb/dwarf2read.c should remove these lines:
- #include <ctype.h> // lines 67-67
- #include <sys/stat.h> // lines 59-59
- #include <sys/types.h> // lines 83-83
- #include <cmath> // lines 88-88
- #include <forward_list> // lines 90-90
- #include <set> // lines 89-89
- #include <unordered_set> // lines 85-85
- #include "completer.h" // lines 60-60
- #include "expression.h" // lines 44-44
- #include "gdbsupport/byte-vector.h" // lines 78-78
- #include "gdbsupport/filestuff.h" // lines 71-71
- #include "gdbsupport/gdb_unlinker.h" // lines 74-74
After a quick glance, that makes sense, so this patch removes them.
gdb/ChangeLog:
* dwarf2read.c: Remove includes.
Change-Id: I13cfcb2f1d747144fddba7f66b329630b79dae90
Alan Modra [Mon, 14 Oct 2019 03:27:01 +0000 (13:57 +1030)]
qsort: ldctor.c CONSTRUCTORS
ctor_cmp had an ineffective comparison of addresses in an attempt to
ensure sort stability. Comparing the addresses passed to the
comparison function can't work since those addresses may be from an
array that is already perturbed by qsort.
* ldctor.h (struct set_element): Make next field a union, adding
idx field.
* ldctor.c (ctor_cmp): Dereference pointer and lose unnecessary
const. Replace final sort on pointer value with final sort on idx.
(ldctor_add_set_entry): Adjust next field access.
(ldctor_build_sets): Likewise. Set u.idx field for sort.
Alan Modra [Mon, 14 Oct 2019 03:25:32 +0000 (13:55 +1030)]
qsort: pe-dll.c reloc sorting
* pe-dll.c (reloc_data_type): Add idx field.
(reloc_sort): Perform final sort by idx.
(generate_reloc): Set idx.
Alan Modra [Mon, 14 Oct 2019 03:24:09 +0000 (13:54 +1030)]
qsort: objcopy.c section sort
* objcopy.c (compare_section_lma): Correct comment. Dereference
section pointer earlier and lose unnecessary const. Style fixes.
Add final sort by id.
Alan Modra [Mon, 14 Oct 2019 03:23:40 +0000 (13:53 +1030)]
qsort: syms.c stab sorting
* syms.c (struct indexentry): Add idx field.
(cmpindexentry): Final sort on idx.
(_bfd_stab_section_find_nearest_line): Set idx.
Alan Modra [Mon, 14 Oct 2019 03:22:32 +0000 (13:52 +1030)]
qsort: dwarf2.c
This patch ensures qsort stability in line and function sorting done
in dwarf2.c. For the line sequences we make use of an existing field
that isn't used until later, as a monotonic counter for the qsort.
* dwarf2.c (struct lookup_funcinfo): Add idx field.
(compare_lookup_funcinfos): Perform final sort on idx.
(build_lookup_funcinfo_table): Set idx.
(compare_sequences): Perform final sort on num_lines.
(build_line_info_table): Set num_lines and line_info_lookup earlier.
(sort_line_sequences): Set num_lines for sort.
Alan Modra [Mon, 14 Oct 2019 03:21:19 +0000 (13:51 +1030)]
qsort: elf_link_add_object_symbols weak aliases
This particular sort almost certainly does not need to be stable for
the ELF linker to work correctly. However it is conceivable that an
unstable sort could affect linker output, and thus different output be
seen with differing qsort implementations. The argument goes like
this: Given more than one strong alias symbol of equal section, value,
and size, the aliases will compare equal by elf_sort_symbol and thus
which one is chosen as the "real" symbol to be made dynamic depends on
qsort. Why would anyone define two symbols at the same address?
Well, sometimes the fact that there are more than one strong alias
symbol is due to linker script symbols like __bss_start being made
dynamic. This will match the first symbol defined in .bss if it
doesn't have correct size, and forgetting to properly set size and
type of symbols isn't as rare as it should be.
This patch adds some more heuristics to elf_sort_symbol.
* elflink.c (elf_sort_symbol): Sort on type and name as well.
(elf_link_add_object_symbols): Style fix.
Alan Modra [Mon, 14 Oct 2019 03:20:48 +0000 (13:50 +1030)]
qsort: elf_sort_sections use of target_index
elf_sort_sections tried to ensure a stable qsort by using target_index
as the final comparison, but target_index hasn't been set by anything
at the time elf_sort_sections was run. This patch arrange to have
target_index set.
* elf.c (_bfd_elf_map_sections_to_segments): Init target_index
for sections about to be sorted.
(assign_file_positions_for_load_sections): Likewise.
(elf_sort_sections): Don't bother optimising both TOEND case.
* elflink.c (bfd_elf_final_link): Reset target_index.
Alan Modra [Mon, 14 Oct 2019 03:19:34 +0000 (13:49 +1030)]
qsort: SHF_LINK_ORDER section sort
The linker SHF_LINK_ORDER section sorting had a number of defects.
1) The ordering was by VMA, which won't work with overlays. LMA is
better.
2) Zero size sections can result in two sections at the same LMA/VMA.
When only one of the two sections at the same LMA is zero size,
that one must be first.
3) Warnings given by elf_get_linked_section_vma won't ever be emitted
since elf_object_p warns and excludes objects with zero sh_link on
a SHF_LINK_ORDER section.
4) Section offset was adjusted down rather than up by section
alignment, possibly creating overlapping sections.
5) Finding the linked section did so the hard way, rather than simply
using elf_linked_to_section.
* elflink.c (elf_get_linked_section_vma): Delete.
(compare_link_order): Use elf_linked_to_section and sort by lma,
size, and id.
(elf_fixup_link_order): Use size_t variables where appropriate.
Make use of elf_linked_to_section. Formatting. Properly align
sections.
Alan Modra [Mon, 14 Oct 2019 03:05:21 +0000 (13:35 +1030)]
qsort issues
qsort isn't guaranteed to be a stable sort, that is, elements
comparing equal according to the comparison function may be reordered
relative to their original ordering. Of course sometimes you may not
care, but even in those cases it is good to force some ordering
(ie. not have the comparison function return 0) so that linker output
is reproducible over different libc qsort implementations.
One way to make qsort stable (which the glibc manual incorrectly says
is the only way) is to augment the elements being sorted with a
monotonic counter of some kind, and use that counter as the final
arbiter of ordering in the comparison function.
Another way is to set up an array of pointers into the array of
elements, first pointer to first element, second pointer to second
element and so so, and sort the pointer array rather than the element
array. Final arbiter in the comparison function then is the pointer
difference. This works well with, for example, the symbol pointers
returned by _bfd_elf_canonicalize_symtab which point into a symbol
array.
This patch fixes a few places where sorting by symbol pointers is
appropriate, and adds comments where qsort stability is a non-issue.
* elf-strtab.c (strrevcmp): Comment.
* merge.c (strrevcmp): Likewise.
* elf64-ppc.c (compare_symbols): Correct final pointer comparison.
Comment on why comparing pointers ensures a stable sort.
* elflink.c (struct elf_symbol): Add void* to union.
(elf_sort_elf_symbol): Ensure a stable sort with pointer comparison.
(elf_sym_name_compare): Likewise.
(bfd_elf_match_symbols_in_sections): Style fix.
(elf_link_sort_cmp1): Comment.
Alan Modra [Mon, 14 Oct 2019 03:04:30 +0000 (13:34 +1030)]
PR24955, libbfd terminating program on out of memory (part2)
PR 24955
* elflink.c (elf_output_implib): Don't use xmalloc. Don't ignore
return value of bfd_alloc2.
* peXXigen.c (_bfd_XXi_write_codeview_record): Don't use xmalloc.
* pef.c (bfd_pef_print_symbol): Likewise. Don't ignore return
value of bfd_get_section_contents.
* som.c (som_write_space_strings): Don't use xmalloc.
(som_write_symbol_strings): Likewise.
GDB Administrator [Mon, 14 Oct 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Fri, 11 Oct 2019 19:36:49 +0000 (15:36 -0400)]
gdb: Silence -Wformat-nonliteral warning with clang
We get this warning when building with clang:
CXX ui-out.o
/home/smarchi/src/binutils-gdb/gdb/ui-out.c:590:22: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
do_message (style, format, args);
^~~~~~
This can be considered a legitimate warning, as call_do_message's format
parameter is not marked as a format string. Therefore, we should
normally mark the call_do_message method with the `format` attribute.
However, doing so just moves (and multiplies) the problem, as all the
uses of call_do_message in the vmessage method now warn. If we wanted
to continue on that path, we should silence the warning for each of
them, as a way of telling the compiler "it's ok, we know what we are
doing".
But since call_do_message is really just vmessage's little helper, it's
simpler to just silence the warning at that single point.
gdb/ChangeLog:
* ui-out.c (ui_out::call_do_message): Silence
-Wformat-nonliteral warning.
Change-Id: I58ad41793448f38835c5d6ba7b9e5c4dd8df260f
Tom de Vries [Sun, 13 Oct 2019 13:09:09 +0000 (15:09 +0200)]
Mention PR c++/20020 in ChangeLog entry
[ Port of gdb-8.3-branch commit
59047affb0a "Update ChangeLog entry of commit
98c90f8028 and mention PR c++/20020". ]
Tom de Vries [Sun, 13 Oct 2019 13:09:09 +0000 (15:09 +0200)]
Mention PR testsuite/25016 in ChangeLog entry
[ Port of gdb-8.3-branch commit
3d80b2e754f "Update ChangeLog entry of commit
3b752ac2e6 and mention PR testsuite/25016". ]
Tom de Vries [Sun, 13 Oct 2019 13:09:09 +0000 (15:09 +0200)]
Mention PR breakpoints/25011 in ChangeLog entry
[ Port of gdb-8.3-branch commit
88f07f28d5b "Update ChangeLog entry of commit
7e38ddcb2e and mention PR breakpoints/25011". ]
Tom de Vries [Sun, 13 Oct 2019 13:09:09 +0000 (15:09 +0200)]
Mention PR gdb/25010 in ChangeLog entry
[ Port of gdb-8.3-branch commit
5ca0b868fa7 "Update ChangeLog entry of commit
8ac39635f6 and mention PR gdb/25010". ]
Nick Clifton [Sun, 13 Oct 2019 12:33:27 +0000 (13:33 +0100)]
Update the README-how-to-make-a-release file with a note to reset the development flag back to true after making a point release. Aldo fix a typo in the ld/NEWS file.
binutils* README-how-to-make-a-release: Add a note to reset the
development flag back to true after making a point release.
ld * NEWS: Delete superflous "Changes in 2.33" comment.
Simon Marchi [Sun, 13 Oct 2019 03:46:15 +0000 (23:46 -0400)]
gdb: small cleanup in breakpoint.c's includes
In an attempt to reduce the number of files re-build when some headers
are touched, I ran include-what-you-use with breakpoint.c as a guinea
pig. It revealed a few files that were unnecessary to include, which
this patch removes.
breakpoint.c uses tilde_expand from readline, hence the necessity to
include tilde.h. AFAIK, it's fine to include just that, and not the
whole readline headers.
include-what-you-use also reported many header files that should be
included but aren't, I suppose that breakpoint.c currently includes them
indirectly. For now I'll pretend I didn't see that :).
gdb/ChangeLog:
* breakpoint.c: Remove some includes: continuations.h, skip.h,
mi/mi-main.h, readline/readline.h, readline/history.h. Add
include: readline/tilde.h.
-#include "skip.h"
#include "ax-gdb.h"
#include "dummy-frame.h"
#include "interps.h"
@@ -69,11 +67,9 @@
#include "thread-fsm.h"
#include "tid-parse.h"
#include "cli/cli-style.h"
-#include "mi/mi-main.h"
/* readline include files */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include "readline/tilde.h"
/* readline defines this. */
#undef savestring
Change-Id: I88bfe9071f2f973fd84caaf04b95c33a4dfb33de
Tom de Vries [Sun, 13 Oct 2019 00:40:57 +0000 (02:40 +0200)]
[gdb/testsuite] Add KFAIL for missing support of reverse-debugging xsave
Normally the gdb.reverse/*.exp test-cases pass on my system (apart from the
record/23188 KFAIL for gdb.reverse/step-precsave.exp). But when specifying
GLIBC_TUNABLES=glibc.tune.hwcaps=-XSAVEC_Usable to force glibc to use
_dl_runtime_resolve_xsave instead of _dl_runtime_resolve_xsavec, we run into
1054 FAILs like this:
...
(gdb) PASS: gdb.reverse/sigall-reverse.exp: b gen_HUP
continue^M
Continuing.^M
Process record does not support instruction 0xfae64 at address \
0x7ffff7ded958.^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0x00007ffff7ded958 in _dl_runtime_resolve_xsave () from \
/lib64/ld-linux-x86-64.so.2^M
(gdb) FAIL: gdb.reverse/sigall-reverse.exp: get signal ABRT
...
The problem is that the xsave instruction is not supported in
reverse-debugging (PR record/25038).
Add KFAILs for this PR.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2019-10-13 Tom de Vries <tdevries@suse.de>
PR record/25038
* gdb.reverse/sigall-precsave.exp: Add PR record/25038 KFAIL.
* gdb.reverse/sigall-reverse.exp: Same.
* gdb.reverse/solib-precsave.exp: Same.
* gdb.reverse/solib-reverse.exp: Same.
* gdb.reverse/step-precsave.exp: Same.
* gdb.reverse/until-precsave.exp: Same.
* gdb.reverse/until-reverse.exp: Same.
* lib/gdb.exp (gdb_continue_to_breakpoint): Same.
GDB Administrator [Sun, 13 Oct 2019 00:01:15 +0000 (00:01 +0000)]
Automatic date update in version.in
Christian Biesinger [Fri, 11 Oct 2019 03:57:36 +0000 (22:57 -0500)]
Remove unnecessary declaration of trace_regblock_size
This variable is declared in tracepoint.h, which is already included
by remote.c.
gdb/ChangeLog:
2019-10-12 Christian Biesinger <cbiesinger@google.com>
* remote.c (remote_target::get_trace_status): Remove declaration of
trace_regblock_size.
Christian Biesinger [Thu, 10 Oct 2019 04:27:33 +0000 (23:27 -0500)]
Move declaration of max_user_call_depth to header
Also removes an unnecessary declaration of cmdlist in cli-cmds.c.
I don't understand why it is there, the definition of cmdlist is
at the top of the same file.
gdb/ChangeLog:
2019-10-12 Christian Biesinger <cbiesinger@google.com>
* cli/cli-cmds.c (max_user_call_depth): Move comment to header.
(show_user): Remove declaration of cmdlist.
* cli/cli-cmds.h (max_user_call_depth): Declare.
* cli/cli-script.c (execute_user_command): Remove declaration
of max_user_call_depth.
Nick Clifton [Sat, 12 Oct 2019 15:04:20 +0000 (16:04 +0100)]
Tweak the 'how to make a release' document
GDB Administrator [Sat, 12 Oct 2019 00:00:24 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Fri, 11 Oct 2019 18:28:35 +0000 (11:28 -0700)]
Improve comments in print-utils.h.
Since I had to look at these function comments to fix the RISC-V ARI warnings,
I noticed that they make no sense. The pulongest and plongest comments are
swapped. phex is missing a comment. And phex_nz doesn't mention how it is
different from phex.
* gdbsupport/print-utils.h (pulongest): Fix comment.
(plongest): Likewise.
(phex): Add missing comment, mention leading zeros.
(phex_nz): Add mention of no leading zeros to comment.
Jim Wilson [Fri, 11 Oct 2019 18:26:29 +0000 (11:26 -0700)]
RISC-V: Fix two ARI warnings.
> gdb/riscv-tdep.c:1657: code: %ll: Do not use printf(%ll), instead use printf(%s,phex()) to dump a 'long long' value
gdb/riscv-tdep.c:1657: "Writing %lld-byte nop instruction to %s: %s\n",
> gdb/riscv-tdep.c:1658: code: long long: Do not use 'long long', instead use LONGEST
gdb/riscv-tdep.c:1658: ((unsigned long long) sizeof (nop_insn)),
fprintf_unfiltered doesn't support z (or j for that matter), and fixing that
is a larger patch than I'd like to write, so this does basically what the
ARI warnings recommends. We don't need the cast as there is a prototype for
plongest.
* riscv-tdep.c (riscv_push_dummy_code): Change %lld to %s and use
plongest instead of unsigned long long cast.
Max Filippov [Thu, 10 Oct 2019 23:37:25 +0000 (16:37 -0700)]
bfd/dwarf2.c: fix assertion failure in comp_unit_hash_info
stash_maybe_enable_info_hash_tables sets
stash->info_hash_status = STASH_INFO_HASH_ON;
regardless of the result of stash_maybe_update_info_hash_tables call. In
case it fails this results in repeated invocation of comp_unit_hash_info
for the same comp unit and assertion failure in this function.
Only set stash->info_hash_status = STASH_INFO_HASH_ON; when
stash_maybe_update_info_hash_tables is successful.
bfd/
2019-10-11 Max Filippov <jcmvbkbc@gmail.com>
* dwarf2.c (stash_maybe_enable_info_hash_tables): Only set
stash->info_hash_status = STASH_INFO_HASH_ON when
stash_maybe_update_info_hash_tables succeeds.
Nick Clifton [Fri, 11 Oct 2019 10:58:22 +0000 (11:58 +0100)]
Updated traditional Chinese translation for the binutils/ subdirectory
GDB Administrator [Fri, 11 Oct 2019 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
This page took 0.056823 seconds and 4 git commands to generate.