GDB Administrator [Tue, 25 Aug 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 24 Aug 2020 23:44:53 +0000 (19:44 -0400)]
gdb/testsuite: make runto always emit a FAIL on internal error
I noticed that when a test uses `runto_main` and a GDB internal error
happens while running to main, no error or fail is emitted. This is
because `runto_main` uses the `no-message` option of `runto`.
As a result, if a test fails to run to main and exits, no sign that
something went wrong is emitted. For example, add this always-false
assertion to compute_frame_id:
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -545,6 +545,7 @@ static void
compute_frame_id (struct frame_info *fi)
{
gdb_assert (!fi->this_id.p);
+ gdb_assert (false);
if (frame_debug)
fprintf_unfiltered (gdb_stdlog, "{ compute_frame_id (fi=%d) ",
... and run gdb.dwarf2/dw2-align.exp. No fail or sign that something
went wrong is shown. It just appears as if the test gets skipped.
A developer introducing such a regression in this test today would
likely notice it, because we are used to diff-ing test results. So we
would see some PASSes dispappear for no good reason and look into it.
But I find it worrysome for two reasons:
1. Scripts that analyze regressions (such as the one on the buildbot)
may only look for new FAILs or new ERRORs. It would probably miss
this.
2. Imagine that we one day have a testsuite that runs cleanly (some
people might already run subsets of the testsuite and expect it to
all pass), we would just run the testsuite and check that there are
no fails. It would be easy to miss something like this.
In case of internal error, I suggest making `runto` emit a FAIL even if
`no-message` was passed. This is different from other failure modes
that might be expected (whchi rightfully cause the test to simply be
skipped). An internal error is always bad, so if it happens it should
noisily fail.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (runto): Always emit fail on internal error.
Change-Id: I6e6faed4868ea821541a23042b2d01c30058b0d3
Simon Marchi [Mon, 24 Aug 2020 19:50:19 +0000 (15:50 -0400)]
gdb: add debug_prefixed_vprintf
To help ensure that all debug statements have the same format, introduce
the debug_prefixed_vprintf helper. Implement linux_nat_debug_printf_1
and infrun_debug_printf_1 with it.
I would eventually like to style the module and function name with some
color, to help them stick out, but I don't really know how to do that
yet, it can always be done later.
gdb/ChangeLog:
* debug.h: New file.
* debug.c (debug_prefixed_vprintf): New function.
* infrun.c (infrun_debug_printf_1): Use debug_prefixed_vprintf.
* linux-nat.c (linux_nat_debug_printf_1): Likewise.
Change-Id: Iccc290a2dc6b5fffcbe1c2866ed8d804ad380764
Simon Marchi [Mon, 24 Aug 2020 19:49:46 +0000 (15:49 -0400)]
gdb: add infrun_debug_printf macro
Introduce this macro to print debug statements in the infrun.c file,
same idea as what was done in
9327494e0eeb ("gdb: add
linux_nat_debug_printf macro").
Although in this case, there are places outside infrun.c that print
debug statements if debug_infrun is set. So the macro has to be
declared in the header file, so that it can be used in these other
files.
Note one special case. In stop_all_threads, I've used an explicit
if (debug_infrun)
infrun_debug_printf_1 ("stop_all_threads", "done");
for the message in the SCOPE_EXIT. Otherwise, the message appears like
this:
[infrun] operator(): done
Until we find a better solution for extracting a meaningful function
name for lambda functions, I think it's fine to handle these special
cases manually, they are quite rare.
Some tests need to be updated, because they rely on some infrun debug
statements.
gdb/ChangeLog:
* infrun.h (infrun_debug_printf_1): New function declaration.
(infrun_debug_printf): New macro.
* infrun.c (infrun_debug_printf_1): Use infrun_debug_printf
throughout.
(infrun_debug_printf): New function.
* breakpoint.c (should_be_inserted): Use infrun_debug_printf.
(handle_jit_event): Likewise.
gdb/testsuite/ChangeLog:
* gdb.base/gdb-sigterm.exp (do_test): Update expected regexp.
* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
Likewise.
* gdb.threads/stepi-random-signal.exp: Likewise.
Change-Id: I66433c8a9caa64c8525ab57c593022b9d1956d5c
Alan Modra [Mon, 24 Aug 2020 17:07:02 +0000 (02:37 +0930)]
elf_hash_table_id access
* elf-m10300.c (elf32_mn10300_hash_table): Test is_elf_hash_table
before accessing elf_hash_table_id.
* elf32-arc.c (elf_arc_hash_table): Likewise.
* elf32-arm.c (elf32_arm_hash_table): Likewise.
* elf32-avr.c (avr_link_hash_table): Likewise.
* elf32-bfin.c (bfinfdpic_hash_table): Likewise.
* elf32-cris.c (elf_cris_hash_table): Likewise.
* elf32-csky.c (csky_elf_hash_table): Likewise.
* elf32-frv.c (frvfdpic_hash_table): Likewise.
* elf32-hppa.c (hppa_link_hash_table): Likewise.
* elf32-lm32.c (lm32_elf_hash_table): Likewise.
* elf32-m32r.c (m32r_elf_hash_table): Likewise.
* elf32-m68hc1x.h (m68hc11_elf_hash_table): Likewise.
* elf32-m68k.c (elf_m68k_hash_table): Likewise.
* elf32-metag.c (metag_link_hash_table): Likewise.
* elf32-microblaze.c (elf32_mb_hash_table): Likewise.
* elf32-nds32.h (nds32_elf_hash_table): Likewise.
* elf32-or1k.c (or1k_elf_hash_table): Likewise.
* elf32-s390.c (elf_s390_hash_table): Likewise.
* elf32-sh.c (sh_elf_hash_table): Likewise.
* elf32-spu.c (spu_hash_table): Likewise.
* elf32-tilepro.c (tilepro_elf_hash_table): Likewise.
* elf32-xtensa.c (elf_xtensa_hash_table): Likewise.
* elf64-alpha.c (alpha_elf_hash_table): Likewise.
* elf64-hppa.c (hppa_link_hash_table): Likewise.
* elf64-ia64-vms.c (elf64_ia64_hash_table): Likewise.
* elf64-s390.c (elf_s390_hash_table): Likewise.
* elfnn-ia64.c (elfNN_ia64_hash_table): Likewise.
* elfnn-riscv.c (riscv_elf_hash_table): Likewise.
* elfxx-mips.c (mips_elf_hash_table): Likewise.
* elfxx-sparc.h (_bfd_sparc_elf_hash_table): Likewise.
* elfxx-tilegx.c (tilegx_elf_hash_table): Likewise.
Jon Turney [Fri, 21 Aug 2020 15:30:00 +0000 (16:30 +0100)]
Fix erroroneous use of '%zu' in elfcore_grok_win32pstatus
As reported in [1], _bfd_error_handler() doesn't support '%zu'.
module_name_size is always 32-bits in the data structure we are
extracting it from, so use an unsigned int to store it instead.
[1] https://sourceware.org/pipermail/gdb-patches/2020-August/171391.html
bfd/ChangeLog:
2020-08-21 Jon Turney <jon.turney@dronecode.org.uk>
* elf.c (elfcore_grok_win32pstatus): Change name_size to unsigned
int. Use '%u' format with _bfd_error_handler to render it.
Alan Modra [Mon, 24 Aug 2020 16:25:38 +0000 (01:55 +0930)]
PR26489, ASAN: ppc64_elf_size_stubs elf64-ppc.c:13389
Stub sections are inserted after sec_info is sized, so have higher ids.
Test flags that will exclude stub sections before looking at the
sec_info array.
PR 26489
* elf64-ppc.c (ppc64_elf_size_stubs): Test code_sec->has_toc_reloc
and code_sec->makes_toc_func_call before sec_info[code_sec->id].
Alan Modra [Mon, 24 Aug 2020 16:21:39 +0000 (01:51 +0930)]
PR26492, ASAN: ppc64_elf_before_check_relocs elf64-ppc.c:4337
PR 26492
* elf64-ppc.c (ppc_hash_table): Test is_elf_hash_table before
accessing elf_hash_table_id.
Alan Modra [Mon, 24 Aug 2020 16:18:08 +0000 (01:48 +0930)]
PR26483, ASAN: ppc_elf_link_params elf32-ppc.c:2314
PR 26483
* elf32-ppc.c (ppc_elf_hash_table): Test is_elf_hash_table before
accessing elf_hash_table_id.
Mark Wielaard [Mon, 24 Aug 2020 14:52:53 +0000 (15:52 +0100)]
bfd: Handle DW_FORM_data16 for .debug_line tables containing MD5
* dwarf2.c (read_attribute_value): Handle DW_FORM_data16.
(read_formatted_entries): Likewise. And skip zero entry.
Cooper Qu [Mon, 24 Aug 2020 12:13:47 +0000 (20:13 +0800)]
CSKY: Add new arch CK860.
bfd/
* bfd-in2.h (bfd_mach_ck860): New.
* cpu-csky.c (arch_info_struct): Add item for CK860.
gas/
* config/tc-csky.c (csky_archs): Add item for CK860,
change ck810 and ck807's arch_flag.
(csky_cpus): Add item for CK860.
(md_begin): Enable DSP for CK810 and CK807 by default.
(md_apply_fix): Fix CKCORE_TLS_IE32 relocation failure.
* gas/testsuite/gas/csky/cskyv2_all.d: Change 'sync 0'
to 'sync'.
* gas/testsuite/gas/csky/cskyv2_all.s: Likewise.
* gas/testsuite/gas/csky/cskyv2_ck860.d: New.
* gas/testsuite/gas/csky/cskyv2_ck860.s: New.
* gas/testsuite/gas/csky/enhance_dsp.d: Change plsli.u16
to plsli.16.
* gas/testsuite/gas/csky/enhance_dsp.s: Likewise.
include/
* opcode/csky.h (CSKYV2_ISA_10E60): New.
(CSKY_ARCH_860): New.
opcode/
* csky-dis.c (csky_find_inst_info): Skip CK860's instructions
in other CPUs to speed up disassembling.
* csky-opc.h (csky_v2_opcodes): Add CK860's instructions,
Change plsli.u16 to plsli.16, change sync's operand format.
Change-Id: I80ec1a9c0cc600d668082a9b91ae6d45b33ec0fc
Alan Modra [Mon, 24 Aug 2020 08:00:30 +0000 (17:30 +0930)]
sparc testsuite fallout
Alan Modra [Sun, 23 Aug 2020 11:35:34 +0000 (21:05 +0930)]
tic54x fixes
A number of the tic54x tests were failing, and I thought it worth
investigating since the target makes use of a lot of hash tables, and
we've just changed gas hash tables. It turns out none of the gas
failures were due to hashing.
* config/tc-tic54x.c (stag_add_field_symbols): Don't free "name"
in case where it isn't copied.
* config/tc-tic54x.h (LOCAL_LABELS_FB): Undef.
* testsuite/gas/tic54x/field.d: Dump section contents and symbols
rather than disassembling.
* testsuite/gas/tic54x/set.d: Adjust for newer disassembly.
Alan Modra [Mon, 24 Aug 2020 07:02:57 +0000 (16:32 +0930)]
PowerPC TPREL_HA/LO optimisation
ppc64 ld optimises sequences like the following
addis 3,13,wot@tprel@ha
lwz 3,wot@tprel@l(3)
to
nop
lwz 3,wot@tprel(13)
when "wot" is located near enough to the thread pointer.
However, the ABI doesn't require that R_PPC64_TPREL16_HA always be on
an addis rt,13,imm instruction, and while ld checked for that on the
high-part instruction it didn't disable the optimisation on the
low-part instruction. This patch fixes that problem, disabling the
tprel optimisation globally if high-part instructions don't pass
sanity checks. The optimisation is also enabled for ppc32, where
before ld.bfd had the code in the wrong place and ld.gold had it in a
block only enabled for ppc64.
bfd/
* elf32-ppc.c (ppc_elf_check_relocs): Set has_tls_reloc for
high part tprel16 relocs.
(ppc_elf_tls_optimize): Sanity check high part tprel16 relocs.
Clear do_tls_opt on odd instructions.
(ppc_elf_relocate_section): Move TPREL16_HA/LO optimisation later.
Don't sanity check them here.
* elf64-ppc.c (ppc64_elf_check_relocs): Set has_tls_reloc for
high part tprel16 relocs.
(ppc64_elf_tls_optimize): Sanity check high part tprel16 relocs.
Clear do_tls_opt on odd instructions.
(ppc64_elf_relocate_section): Don't sanity check TPREL16_HA.
ld/
* testsuite/ld-powerpc/tls32.d: Update for TPREL_HA/LO optimisation.
* testsuite/ld-powerpc/tlsexe32.d: Likewise.
* testsuite/ld-powerpc/tlsldopt32.d: Likewise.
* testsuite/ld-powerpc/tlsmark32.d: Likewise.
* testsuite/ld-powerpc/tlsopt4_32.d: Likewise.
* testsuite/ld-powerpc/tprel.s,
* testsuite/ld-powerpc/tprel.d,
* testsuite/ld-powerpc/tprel32.d: New tests.
* testsuite/ld-powerpc/tprelbad.s,
* testsuite/ld-powerpc/tprelbad.d: New test.
* testsuite/ld-powerpc/powerpc.exp: Run them.
gold/
* powerpc.cc (Target_powerpc): Add tprel_opt_ and accessors.
(Target_powerpc::Scan::local): Sanity check tprel high relocs.
(Target_powerpc::Scan::global): Likewise.
(Target_powerpc::Relocate::relocate): Control tprel optimisation
with tprel_opt_ and enable for 32-bit.
Alan Modra [Mon, 24 Aug 2020 03:51:31 +0000 (13:21 +0930)]
Remove "memory exhausted" messages
Since we use xcalloc to set up hash table memory, htab_create won't
ever return a failure.
* config/tc-aarch64.c (md_begin): Don't bother checking for
out of memory failure from str_htab_create.
* config/tc-arc.c (arc_insert_opcode, md_begin): Likewise.
(arc_extcorereg, arc_stralloc): Likewise.
* config/tc-arm.c (md_begin): Likewise.
* config/tc-cr16.c (initialise_reg_hash_table, md_begin): Likewise.
* config/tc-cris.c (md_begin): Likewise.
* config/tc-crx.c (md_begin): Likewise.
* config/tc-pdp11.c (md_begin): Likewise.
* config/tc-score.c (s3_build_reg_hsh, s3_begin): Likewise.
* config/tc-score7.c (s7_build_reg_hsh, s7_begin): Likewise.
Alan Modra [Mon, 24 Aug 2020 03:28:14 +0000 (12:58 +0930)]
gcc-4 -Og false positive "may be used uninitialised"
binutils/
* readelf.c (dump_section_as_strings) Avoid false positive
"may be used uninitialised".
gas/
* config/tc-arm.c (move_or_literal_pool): Avoid false positive
"may be used uninitialised".
(opcode_lookup): Likewise.
Alan Modra [Mon, 24 Aug 2020 03:36:46 +0000 (13:06 +0930)]
PR26526,
5014c2d22b2 breaks compiling the Linux kernel for ARM
PR 26526
* symbols.c (local_symbol_convert): Clear out xtra.
Cooper Qu [Fri, 21 Aug 2020 10:08:10 +0000 (18:08 +0800)]
CSKY: Add ck803r2 series cpu.
gas/
* config/tc-csky.c (CSKY_ISA_803R2): New.
(csky_archs): Add ck803r2 series.
(md_begin): Fix warning about -medsp.
(csky_get_freg_val): Support lowercase of fpu register name.
* testsuite/gas/csky/cskyv2_ck803r2.s: New file.
* testsuite/gas/csky/cskyv2_ck803r2.d: New file.
include/
* csky.h (CSKYV2_ISA_3E3R2): New.
opcodes/
* csky-opc.h (csky_v2_opcodes): Add instruction bnezad.
GDB Administrator [Mon, 24 Aug 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
John David Anglin [Sun, 23 Aug 2020 16:44:22 +0000 (16:44 +0000)]
Disable default ELF plugins on 32-bit hppa*-*-hpux*.
PR binutils/26357
* configure.ac: Disable plugins by default on 32-bit hppa*-*-hpux*.
* configure: Regenerate.
Alan Modra [Sat, 22 Aug 2020 08:29:57 +0000 (17:59 +0930)]
PR26513,
629310abec breaks assembling PowerPC Linux kernels
Inserting with replacement is wrong for some gas hash table uses.
This patch implements an htab_insert that conditionally replaces, and
similarly for str_hash_insert. str_hash_insert with replace=0 is
roughly equivalent to the older hash_insert, and str_hash_insert with
replace=1 to the older hash_jam, but return values are different. I
found it useful to know whether the slot was occupied prior to
inserting/replacing. I've also reinstated the fatal errors on messing
up opcode tables with duplicates.
PR 26513
* hash.h (htab_insert): Update prototype and comment.
(struct string_tuple): Make "value" a const void*.
(string_tuple_alloc): Likewise.
(str_hash_find, str_hash_find_n): Cast returned value.
(str_hash_insert): Add "replace" parameter, and return slot pointer.
Free alloc'd element when not inserted.
* hash.c (htab_insert): Likewise. Return slot when element exists,
otherwise return NULL.
* read.c (pop_insert): Insert into hash table without first searching.
* config/tc-avr.c (md_begin): Likewise.
* config/tc-msp430.c (md_begin): Likewise.
* config/tc-nds32.c (nds32_init_nds32_pseudo_opcodes): Likewise.
* config/tc-v850.c (md_begin): Likewise.
* macro.c (do_formals, define_macro, macro_expand_body): Likewise.
(delete_macro): Delete from hash table.
* config/tc-tic54x.c (subsym_create_or_replace): Correct logic.
* symbols.c (local_symbol_make, symbol_table_insert): Allow
replacement of hash table entries.
* config/obj-coff-seh.c (seh_hash_insert): Likewise.
* config/obj-coff.c (tag_insert): Likewise.
* config/tc-iq2000.c (iq2000_add_macro): Likewise.
* config/tc-m68k.c (md_begin): Likewise for aliases.
* config/tc-tic4x.c (tic4x_asg): Likewise.
* config/tc-tic6x.c (md_begin): Likewise.
* dw2gencfi.c (dwcfi_hash_find_or_make): Disallow replacement of
hash table entries.
* ecoff.c (add_string, get_tag): Likewise.
* macro.c (expand_irp): Likewise.
* config/obj-elf.c (build_additional_section_info): Likewise.
* config/tc-aarch64.c (insert_reg_alias): Likewise.
(checked_hash_insert): Likewise.
* config/tc-alpha.c (get_alpha_reloc_tag, md_begin): Likewise.
* config/tc-arc.c (arc_insert_opcode, declare_register): Likewise.
(declare_addrtype, md_begin, arc_extcorereg): Likewise.
* config/tc-arm.c (insert_reg_alias): Likewise.
(arm_tc_equal_in_insn, md_begin): Likewise.
* config/tc-cr16.c (initialise_reg_hash_table, md_begin): Likewise.
* config/tc-cris.c (md_begin): Likewise.
* config/tc-crx.c (md_begin): Likewise.
* config/tc-csky.c (md_begin): Likewise.
* config/tc-d10v.c (md_begin): Likewise.
* config/tc-dlx.c (md_begin): Likewise.
* config/tc-ft32.c (md_begin): Likewise.
* config/tc-h8300.c (md_begin): Likewise.
* config/tc-hppa.c (md_begin): Likewise.
* config/tc-i386.c (md_begin): Likewise.
* config/tc-ia64.c (dot_rot, dot_entry, declare_register): Likewise.
(md_begin, dot_alias): Likewise.
* config/tc-m68hc11.c (md_begin): Likewise.
* config/tc-m68k.c (md_begin): Likewise.
* config/tc-mcore.c (md_begin): Likewise.
* config/tc-microblaze.c (md_begin): Likewise.
* config/tc-mips.c (md_begin): Likewise.
* config/tc-mmix.c (md_begin): Likewise.
* config/tc-mn10200.c (md_begin): Likewise.
* config/tc-mn10300.c (md_begin): Likewise.
* config/tc-moxie.c (md_begin): Likewise.
* config/tc-nds32.c (nds32_relax_hint, md_begin): Likewise.
* config/tc-nios2.c (md_begin): Likewise.
* config/tc-ns32k.c (md_begin): Likewise.
* config/tc-pdp11.c (md_begin): Likewise.
* config/tc-pj.c (fake_opcode, md_begin): Likewise.
* config/tc-ppc.c (ppc_setup_opcodes): Likewise.
* config/tc-pru.c (md_begin): Likewise.
* config/tc-riscv.c (init_ext_version_hash): Likewise.
(init_opcode_names_hash, hash_reg_name, init_opcode_hash): Likewise.
(riscv_init_csr_hash): Likewise.
* config/tc-s390.c (s390_setup_opcodes, md_begin): Likewise.
* config/tc-score.c (s3_insert_reg): Likewise.
(s3_build_score_ops_hsh, s3_build_dependency_insn_hsh): Likewise.
* config/tc-score7.c (s7_build_score_ops_hsh): Likewise.
(s7_build_dependency_insn_hsh, s7_insert_reg): Likewise.
* config/tc-sh.c (md_begin): Likewise.
* config/tc-sparc.c (md_begin): Likewise.
* config/tc-spu.c (md_begin): Likewise.
* config/tc-tic30.c (md_begin): Likewise.
* config/tc-tic4x.c (tic4x_inst_insert): Likewise.
* config/tc-tic54x.c (stag_add_field_symbols, md_begin): Likewise.
(tic54x_endstruct, tic54x_var, tic54x_macro_info): Likewise.
(subsym_substitute): Likewise.
* config/tc-tilegx.c (md_begin): Likewise.
* config/tc-tilepro.c (md_begin): Likewise.
* config/tc-vax.c (vip_begin): Likewise.
* config/tc-wasm32.c (md_begin): Likewise.
* config/tc-xgate.c (md_begin): Likewise.
* config/tc-z8k.c (md_begin): Likewise.
* testsuite/gas/ppc/dcbt.d,
* testsuite/gas/ppc/dcbt.s: New test.
* testsuite/gas/ppc/ppc.exp: Run it.
* ecoff.c (add_string): Report fatal error on duplicates.
* config/tc-alpha.c (md_begin): Likewise.
* config/tc-arc.c (arc_insert_opcode, declare_register): Likewise.
(declare_addrtype, md_begin, arc_extcorereg): Likewise.
* config/tc-cr16.c (initialise_reg_hash_table, md_begin): Likewise.
* config/tc-cris.c (md_begin): Likewise.
* config/tc-crx.c (md_begin): Likewise.
* config/tc-dlx.c (md_begin): Likewise.
* config/tc-hppa.c (md_begin): Likewise.
* config/tc-i386.c (md_begin): Likewise.
* config/tc-ia64.c (dot_rot, dot_entry, declare_register): Likewise.
(md_begin): Likewise.
* config/tc-m68k.c (md_begin): Likewise.
* config/tc-mips.c (md_begin): Likewise.
* config/tc-nios2.c (md_begin): Likewise.
* config/tc-ns32k.c (md_begin): Likewise.
* config/tc-ppc.c (ppc_setup_opcodes): Likewise.
* config/tc-pru.c (md_begin): Likewise.
* config/tc-riscv.c (init_ext_version_hash): Likewise.
(init_opcode_names_hash, hash_reg_name, init_opcode_hash): Likewise.
* config/tc-s390.c (s390_setup_opcodes, md_begin): Likewise.
* config/tc-sparc.c (md_begin): Likewise.
* config/tc-tic30.c (md_begin): Likewise.
* config/tc-tic4x.c (tic4x_inst_insert): Likewise.
* config/tc-tilegx.c (md_begin): Likewise.
* config/tc-tilepro.c (md_begin): Likewise.
* config/tc-vax.c (vip_begin): Likewise.
* config/tc-alpha.c,
* config/tc-arm.c,
* config/tc-avr.c,
* config/tc-cr16.c,
* config/tc-csky.c,
* config/tc-i386.c,
* config/tc-m68hc11.c,
* config/tc-m68k.c,
* config/tc-microblaze.c,
* config/tc-ns32k.c,
* config/tc-pj.c,
* config/tc-ppc.c,
* config/tc-score.c,
* config/tc-score7.c,
* config/tc-tic4x.c,
* config/tc-tic54x.c,
* config/tc-tilegx.c,
* config/tc-tilepro.c,
* config/tc-xgate.c: Formatting.
Mark Wielaard [Fri, 21 Aug 2020 22:20:55 +0000 (00:20 +0200)]
ada-lex.l: Ignore register diagnostic also for g++ defaulting to ISO C++17
Building with a really old flex and a really new g++ is probably not
recommended, but it should not cause compile errors.
gdb/ChangeLog:
* ada-lex.l: Extend register warnings diagnostics comment for g++.
include/ChangeLog:
* diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Also define
for GCC version 7.0 or higher.
GDB Administrator [Sun, 23 Aug 2020 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sat, 22 Aug 2020 15:31:53 +0000 (08:31 -0700)]
elf: Keep only one '@' for undefined versioned symbols
The symbol string table in the .symtab section is optional and cosmetic.
Keep only one '@' for undefined versioned symbols, which are defined in
shared objects, in the symbol string table. Update "nm -D" to display
only one '@' for undefined versioned symbols.
bfd/
PR ld/26382
* elflink.c (elf_link_output_symstrtab): Keep only one '@' for
versioned symbols, which are defined in shared objects, in
symbol string table.
binutils/
PR ld/26382
* nm.c (print_symname): Display only one '@' for undefined
versioned symbols.
* doc/binutils.texi: Update nm version information.
ld/
PR ld/26382
* testsuite/ld-elf/pr26302.nd: Updated.
* testsuite/ld-elf/pr26302.rd: New file.
* testsuite/ld-elf/shared.exp: Add a test for readelf -sW.
Simon Marchi [Sat, 22 Aug 2020 15:14:46 +0000 (11:14 -0400)]
gdb: assert that we don't try to get a frame's id while it is computed
I'm dealing these days with a class of bugs that involve trying to get a
certain frame's id while we are in the process of computing it. In other
words, compute_frame_id being called for a frame, eventually calling
get_frame_id for that same frame. I don't think this is ever supposed to
happen, as that creates a cyclic dependency.
Usually, these problems cause some failure down the line. I'm proposing with
this patch to catch them as early as possible, as soon as the situation
described above happens. I think that helps because the failed assertion will
be closer to the root of the problem.
To do so, the patch changes the frame_info::this_id::p flag from a boolean (is
the frame id computed or not) to a tri-state:
- the frame id is not computed
- the frame id is being computed
- the frame id is computed
Then, we can properly assert that get_frame_id doesn't get called for a frame
whose id is being computed.
To illustrate how that can help, let's imagine we apply the following change to
frame_unwind_got_optimized:
--- a/gdb/frame-unwind.c
+++ b/gdb/frame-unwind.c
@@ -260,8 +260,7 @@ frame_unwind_got_optimized (struct frame_info *frame, int regnum)
mark_value_bytes_optimized_out (val, 0, TYPE_LENGTH (type));
VALUE_LVAL (val) = lval_register;
VALUE_REGNUM (val) = regnum;
- VALUE_NEXT_FRAME_ID (val)
- = get_frame_id (get_next_frame_sentinel_okay (frame));
+ VALUE_NEXT_FRAME_ID (val) = get_frame_id (frame);
return val;
}
... and run the following command, which leads to a failed assertion (you need
to run the corresponding test to generate the binary first):
$ ./gdb -q -nx testsuite/outputs/gdb.dwarf2/dw2-undefined-ret-addr/dw2-undefined-ret-addr -ex "b stop_frame" -ex r
Without this patch applied, we catch the issue indirectly, when the top-level
get_frame_id tries to stash the frame:
/home/smarchi/src/binutils-gdb/gdb/frame.c:593: internal-error: frame_id get_frame_id(frame_info*): Assertion `stashed' failed.
...
#9 0x0000000001af1c3a in internal_error (file=0x1cea060 "/home/smarchi/src/binutils-gdb/gdb/frame.c", line=593, fmt=0x1ce9f80 "%s: Assertion `%s' failed.") at /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:55
#10 0x0000000000e9b413 in get_frame_id (fi=0x6210005105e0) at /home/smarchi/src/binutils-gdb/gdb/frame.c:593
#11 0x0000000000e99e35 in scoped_restore_selected_frame::scoped_restore_selected_frame (this=0x7fff1d8b9760) at /home/smarchi/src/binutils-gdb/gdb/frame.c:308
#12 0x000000000149a261 in print_frame_args (fp_opts=..., func=0x6210000dd7d0, frame=0x6210005105e0, num=-1, stream=0x60300008a580) at /home/smarchi/src/binutils-gdb/gdb/stack.c:750
#13 0x000000000149d938 in print_frame (fp_opts=..., frame=0x6210005105e0, print_level=0, print_what=SRC_AND_LOC, print_args=1, sal=...) at /home/smarchi/src/binutils-gdb/gdb/stack.c:1394
#14 0x000000000149c0c8 in print_frame_info (fp_opts=..., frame=0x6210005105e0, print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1) at /home/smarchi/src/binutils-gdb/gdb/stack.c:1119
#15 0x0000000001498100 in print_stack_frame (frame=0x6210005105e0, print_level=0, print_what=SRC_AND_LOC, set_current_sal=1) at /home/smarchi/src/binutils-gdb/gdb/stack.c:366
#16 0x00000000010234b7 in print_stop_location (ws=0x7fff1d8ba1f0) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:8366
#17 0x000000000102362d in print_stop_event (uiout=0x607000018660, displays=true) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:8382
...
It freaks out because the frame is already in the stash: it was added by an
inner call to get_frame_id, called indirectly by compute_frame_id. Debugging
this failure is difficult because we have to backtrack to where this happened.
With the patch applied, we catch the issue earlier, here:
/home/smarchi/src/binutils-gdb/gdb/frame.c:601: internal-error: frame_id get_frame_id(frame_info*): Assertion `fi->this_id.p != frame_id_status::COMPUTING' failed
...
#9 0x0000000001af22bc in internal_error (file=0x1cea6e0 "/home/smarchi/src/binutils-gdb/gdb/frame.c", line=601, fmt=0x1cea600 "%s: Assertion `%s' failed.") at /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:55
#10 0x0000000000e9b7e3 in get_frame_id (fi=0x62100050dde0) at /home/smarchi/src/binutils-gdb/gdb/frame.c:601
#11 0x0000000000e989b3 in frame_unwind_got_optimized (frame=0x62100050dde0, regnum=16) at /home/smarchi/src/binutils-gdb/gdb/frame-unwind.c:264
#12 0x0000000000cbe386 in dwarf2_frame_prev_register (this_frame=0x62100050dde0, this_cache=0x62100050ddf8, regnum=16) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/frame.c:1267
#13 0x0000000000e9f569 in frame_unwind_register_value (next_frame=0x62100050dde0, regnum=16) at /home/smarchi/src/binutils-gdb/gdb/frame.c:1266
#14 0x0000000000e9eaab in frame_register_unwind (next_frame=0x62100050dde0, regnum=16, optimizedp=0x7ffca814ade0, unavailablep=0x7ffca814adf0, lvalp=0x7ffca814ae10, addrp=0x7ffca814ae20, realnump=0x7ffca814ae00, bufferp=0x7ffca814aec0 "") at /home/smarchi/src/binutils-gdb/gdb/frame.c:1169
#15 0x0000000000e9f233 in frame_unwind_register (next_frame=0x62100050dde0, regnum=16, buf=0x7ffca814aec0 "") at /home/smarchi/src/binutils-gdb/gdb/frame.c:1225
#16 0x0000000000f84262 in i386_unwind_pc (gdbarch=0x6210000eed10, next_frame=0x62100050dde0) at /home/smarchi/src/binutils-gdb/gdb/i386-tdep.c:1969
#17 0x0000000000ec95dd in gdbarch_unwind_pc (gdbarch=0x6210000eed10, next_frame=0x62100050dde0) at /home/smarchi/src/binutils-gdb/gdb/gdbarch.c:3062
#18 0x0000000000cb5e9d in dwarf2_tailcall_sniffer_first (this_frame=0x62100050dde0, tailcall_cachep=0x62100050dee0, entry_cfa_sp_offsetp=0x7ffca814b160) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/frame-tailcall.c:387
#19 0x0000000000cbdd38 in dwarf2_frame_cache (this_frame=0x62100050dde0, this_cache=0x62100050ddf8) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/frame.c:1198
#20 0x0000000000cbe026 in dwarf2_frame_this_id (this_frame=0x62100050dde0, this_cache=0x62100050ddf8, this_id=0x62100050de40) at /home/smarchi/src/binutils-gdb/gdb/dwarf2/frame.c:1226
#21 0x0000000000e9b447 in compute_frame_id (fi=0x62100050dde0) at /home/smarchi/src/binutils-gdb/gdb/frame.c:580
#22 0x0000000000e9b89e in get_frame_id (fi=0x62100050dde0) at /home/smarchi/src/binutils-gdb/gdb/frame.c:613
#23 0x0000000000e99e35 in scoped_restore_selected_frame::scoped_restore_selected_frame (this=0x7ffca814b610) at /home/smarchi/src/binutils-gdb/gdb/frame.c:315
#24 0x000000000149a8e3 in print_frame_args (fp_opts=..., func=0x6210000dd7d0, frame=0x62100050dde0, num=-1, stream=0x60300008a520) at /home/smarchi/src/binutils-gdb/gdb/stack.c:750
#25 0x000000000149dfba in print_frame (fp_opts=..., frame=0x62100050dde0, print_level=0, print_what=SRC_AND_LOC, print_args=1, sal=...) at /home/smarchi/src/binutils-gdb/gdb/stack.c:1394
#26 0x000000000149c74a in print_frame_info (fp_opts=..., frame=0x62100050dde0, print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1) at /home/smarchi/src/binutils-gdb/gdb/stack.c:1119
#27 0x0000000001498782 in print_stack_frame (frame=0x62100050dde0, print_level=0, print_what=SRC_AND_LOC, set_current_sal=1) at /home/smarchi/src/binutils-gdb/gdb/stack.c:366
#28 0x0000000001023b39 in print_stop_location (ws=0x7ffca814c0a0) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:8366
#29 0x0000000001023caf in print_stop_event (uiout=0x607000018660, displays=true) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:8382
...
Now, we can clearly see that get_frame_id for frame `fi=0x62100050dde0` gets
called while compute_frame_id is active for that frame. The backtrace is more
helpful to identify the root of the problem.
gdb/ChangeLog:
* frame.c (enum class frame_id_status): New.
(struct frame_info) <this_id::p>: Change type to frame_id_status.
(fprintf_frame): Update.
(compute_frame_id): Set frame id status to "computing" on entry.
Set it back to "not_computed" on failure and to "computed" on
success.
(get_frame_id): Assert the frame id is not being computed.
(create_sentinel_frame): Use frame_id_status::COMPUTED.
(create_new_frame): Likewise.
(frame_cleanup_after_sniffer): Update assert.
Change-Id: I5f1a25fafe045f756bd75f358892720b30ed20c9
GDB Administrator [Sat, 22 Aug 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Fri, 21 Aug 2020 15:55:08 +0000 (11:55 -0400)]
sim/bfin: include config/pkg.m4 in configure.ac
When trying to re-generate configure in sim/bfin, I get:
$ autoreconf -vf
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not running libtoolize: --install not given
autoreconf: running: /opt/autostuff/bin/autoconf --force
configure.ac:57: error: possibly undefined macro: AC_CHECK_LIB
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /opt/autostuff/bin/autoconf failed with exit status: 1
This happens since commit
f693213d126a ("Run `autoreconf -vf` throughout").
The problem (not clear from the error message) is that the
PKG_CHECK_MODULES macro used in configure.ac is undefined. In the past, I
suppose that it relied on the person running autoconf having pkg.m4 (from
pkg-config) in their include path. That's not my case.
Since we recently added a local version of PKG_CHECK_MODULES to our tree,
we can just make sim/bfin/configure.ac use it. This patch makes
configure.ac include config/pkg.m4, and re-generates configure. With this,
the configure script appears to be generated correctly, I am able to
configure and build the bfin simulator.
Note: using sinclude to include the required m4 files makes no sense to
me. These files contain macros we need, if they are not defined then
the resulting file is unusable. And sinclude fails silently if the file
is not found. So, better use include/m4_include.
sim/bfin/ChangeLog:
* configure.ac: Include config/pkg.m4.
Change-Id: I7d8012e5ed510cd7746b94e918f0feb1c701cd83
Nick Clifton [Fri, 21 Aug 2020 14:32:20 +0000 (15:32 +0100)]
Fix problems with the AArch64 linker exposed by testing it with sanitization enabled.
bfd * elfnn-aarch64.c (_bfd_aarch64_erratum_835769_scan): Only sort
the data map if there are entries in it.
(_bfd_aarch64_erratum_843419_scan): Likewise.
opcodes * aarch64-dis.c (get_sym_code_type): Return FALSE for non-ELF
symbols.
Mark Wielaard [Fri, 21 Aug 2020 11:26:07 +0000 (13:26 +0200)]
Recognize DW_LANG_C11 in readelf testsuite.
readelf_wi_test checks the DW_AT_LANGUAGE is recognized by matching
against ANSI C. But for the new DWARF5 DW_LANG_C11 readelf simply
prints "C11", not prefixed with ANSI (DW_LANG_C is "non-ANSI C",
DW_LANG_C89 is "ANSI C" and DW_LANG_C99 is "ANSI-C99"). Adjust the
testcase instead of readelf because C11 seems a fine name.
binutils/ChangeLog:
* testsuite/binutils-all/readelf.exp (readelf_wi_test): Also
recognize DW_LANG_C11.
Alan Modra [Thu, 20 Aug 2020 06:06:46 +0000 (15:36 +0930)]
Redo gas local symbol support
gas handles local symbols specially in order to save memory, but the
implementation using two separate hash tables is inefficient,
particularly the scheme of duplicating a struct local_symbol when it
needs to be converted to a full struct symbol. Also, updating symbol
pointers with LOCAL_SYMBOL_CHECK is horrible and has led to some hard
to find bugs.
This changes the implementation to use a single hash table and avoids
another copy of the symbol name in symbol_entry_t. When converting
local symbols the struct local_symbol memory is reused. Not only
does that save memory, but there is no need to twiddle symbol pointers
with LOCAL_SYMBOL_CHECK.
Assembling gcc-10 -g -Og gold/powerpc.cc output shows the following:
old:
symbol table hash statistics:
1371192 searches
1290398 collisions
143585 elements
262139 table size
mini local symbol table hash statistics:
2966204 searches
2707489 collisions
523533 elements
1048573 table size
523533 mini local symbols created, 140453 converted
new:
symbol table hash statistics:
2828883 searches
2453138 collisions
526665 elements
1048573 table size
523533 mini local symbols created, 140453 converted
* symbols.c (struct local_symbol): Add "hash" entry. Reorder fields.
Delete union. Adjust code throughout file.
(struct symbol): Add "hash", "name" and "x" entries. Reorder fields.
Split off some to..
(struct xsymbol): ..this. New struct. Adjust code throughout file
accessing these fields.
(struct symbol_entry): Delete.
(union symbol_entry): New.
(hash_symbol_entry): Adjust for symbol_entry_t change.
(symbol_entry_find): Likewise.
(eq_symbol_entry): Compare hash values too.
(symbol_entry_alloc): Delete.
(local_symbol_converted_p, local_symbol_mark_converted): Delete.
(local_symbol_get_real_symbol, local_symbol_set_real_symbol): Delete.
(local_hash): Delete.
(abs_symbol_x, dot_symbol_x): New static var.
(symbol_init): New function.
(symbol_create): Rewrite.
(LOCAL_SYMBOL_CHECK): Delete. Replace uses throughout with simple
test of flags.local_symbol.
(local_symbol_make): Adjust for struct local_symbol changes.
(local_symbol_convert): Rewrite. Adjust all callers.
(symbol_table_insert): Simplify.
(symbol_clone): Comment on local sym cloning. Handle split symbol
struct.
(get_real_sym): Delete. Remove all uses.
(symbol_find_exact_noref): Simplify.
(resolve_local_symbol): Don't resolve non-locals.
(S_SET_SEGMENT): Don't special case reg_section.
(S_SET_NAME): Set both name and bsym->name.
(symbol_mark_resolved, symbol_resolved_p): Simplify.
(symbol_symbolS): Update comment.
(symbol_begin): Don't create local_hash. Adjust abs_symbol setup.
(dot_symbol_init): Adjust dot_symbol setup.
(symbol_print_statistics): Delete local_hash stats.
Alan Modra [Fri, 21 Aug 2020 03:31:37 +0000 (13:01 +0930)]
gas symbol struct field renaming
Get rid of sy_ prefix, and some unused fields.
* symbols.c (struct symbol_flags): Rename sy_volatile to volatil,
and remove sy_ from other field names. Update throughout.
(struct symbol): Remove sy_ from field names. Delete unused
TARGET_SYMBOL_FIELDS. Update throughout file. Move after..
(struct local_symbol): ..here. Remove lsy_ from field names.
Delete unused TC_LOCAL_SYMFIELD_TYPE. Update throughout file.
(local_symbol_resolved_p, local_symbol_mark_resolved): Delete.
Expand uses throughout file.
(local_symbol_get_frag, local_symbol_set_frag): Likewise.
(symbol_new): Move symbol_table_frozen test to..
(symbol_append): ..here, and..
(symbol_insert): ..here.
(resolve_symbol_value, symbol_relc_make_expr): White space fixes.
(HANDLE_XADD_OPT1, HANDLE_XADD_OPT2): Likewise.
* config/obj-coff.h (RESOLVE_SYMBOL_REDEFINITION): Update.
Alan Modra [Thu, 20 Aug 2020 23:47:53 +0000 (09:17 +0930)]
Rearrange symbol_create parameters
These functions take an offset within frag, frag within section, and
section parameter. So it makes sense to order the parameters as
section, frag, offset.
* symbols.h (symbol_new, symbol_create, local_symbol_make),
(symbol_temp_new): Arrange params as section, frag, offset.
* symbols.c: Adjust to suit.
* as.c: Likewise.
* cgen.c: Likewise.
* dwarf2dbg.c: Likewise.
* ecoff.c: Likewise.
* expr.c: Likewise.
* itbl-ops.c: Likewise.
* read.c: Likewise.
* stabs.c: Likewise.
* subsegs.c: Likewise.
* config/obj-coff.c: Likewise.
* config/obj-elf.c: Likewise.
* config/obj-macho.c: Likewise.
* config/tc-aarch64.c: Likewise.
* config/tc-alpha.c: Likewise.
* config/tc-arc.c: Likewise.
* config/tc-arm.c: Likewise.
* config/tc-avr.c: Likewise.
* config/tc-cr16.c: Likewise.
* config/tc-cris.c: Likewise.
* config/tc-csky.c: Likewise.
* config/tc-dlx.c: Likewise.
* config/tc-hppa.c: Likewise.
* config/tc-i386.c: Likewise.
* config/tc-ia64.c: Likewise.
* config/tc-m32r.c: Likewise.
* config/tc-m68k.c: Likewise.
* config/tc-mips.c: Likewise.
* config/tc-mmix.c: Likewise.
* config/tc-mn10200.c: Likewise.
* config/tc-mn10300.c: Likewise.
* config/tc-nds32.c: Likewise.
* config/tc-nios2.c: Likewise.
* config/tc-ppc.c: Likewise.
* config/tc-riscv.c: Likewise.
* config/tc-s390.c: Likewise.
* config/tc-sh.c: Likewise.
* config/tc-tic4x.c: Likewise.
* config/tc-tic54x.c: Likewise.
* config/tc-xtensa.c: Likewise.
Cooper Qu [Fri, 21 Aug 2020 08:17:36 +0000 (16:17 +0800)]
CSKY: Support two operands form for bloop.
gas/
* config/tc-csky.c (csky_insn_info): Add member last_isize.
(md_assemble): Assign value to csky_insn.last_isize.
* testsuite/gas/csky/enhance_dsp.d: Test bloop's two operands form.
* testsuite/gas/csky/enhance_dsp.s: Likewise.
opcodes/
* csky-opc.h (csky_v2_opcodes): Add two operands form for bloop.
Jan Beulich [Fri, 21 Aug 2020 08:28:35 +0000 (10:28 +0200)]
fix objcopy of PE images with .buildid section
Xen Project embeds a build ID in its hypervisor binary (including its
EFI variant), living in a standalone section. This usually gets placed
right after .rodata, and due to the rounding done on the (file) size of
.rodata the two sections appear to overlap (as far as e.g.
find_section_by_vma() is concerned). With the first byte "found" in
.rodata, nothing guarantees that the entire debug dir fits in that
section, leading to apparently random failure of objcopy on such an
image.
Possible alternatives to the solution chosen:
- make find_section_by_vma() honor virt_size,
- correct the recording of sizes elsewhere (ibfd has size == virt_size,
while obfd doesn't),
- fix the linker to avoid producing apparently overlapping sections.
While touching the condition around and the contents of the disgnostic,
pull it up ahead of the bfd_malloc_and_get_section() call: There's no
point first obtaining the section contents, in order to then fail.
GDB Administrator [Fri, 21 Aug 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Thu, 20 Aug 2020 14:11:09 +0000 (10:11 -0400)]
gdb: handle the `ptid.is_pid ()` case in registers_changed_ptid
As reported by Tom here [1], commit
888bdb2b7445 ("gdb: change regcache
list to be a map") overlooked an important case, causing a regression.
When registers_changed_ptid is called with a pid-like ptid, it used to
clear all the regcaches for that pid. That commit accidentally removed
that behavior. We need to handle the `ptid.is_pid ()` case in
registers_changed_ptid.
The most trivial way of fixing it would be to iterate on all ptids of a
target and delete the entries where the ptid match the pid. But the
point of that commit was to avoid having to iterate on ptids to
invalidate regcaches, so that would feel like a step backwards.
The only logical solution I see is to add yet another map level, so that
we now have:
target -> (pid -> (ptid -> regcaches))
This patch implements that and adds a test for the case of calling
registers_changed_ptid with a pid-like ptid.
[1] https://sourceware.org/pipermail/gdb-patches/2020-August/171222.html
gdb/ChangeLog:
* regcache.c (pid_ptid_regcache_map): New type.
(target_ptid_regcache_map): Remove.
(target_pid_ptid_regcache_map): New type.
(regcaches): Change type to target_pid_ptid_regcache_map.
(get_thread_arch_aspace_regcache): Update.
(regcache_thread_ptid_changed): Update, handle pid-like ptid
case.
(regcaches_size): Update.
(regcache_count): Update.
(registers_changed_ptid_target_pid_test): New.
(_initialize_regcache): Register new test.
Change-Id: I4c46e26d8225c177dbac9488b549eff4c68fa0d8
Simon Marchi [Thu, 20 Aug 2020 14:10:59 +0000 (10:10 -0400)]
gdb: split regcaches management selftest
The selftest `regcaches` selftest is a bit too broad for my taste,
testing the behavior of get_thread_arch_aspace_regcache and various
cases of registers_changed_ptid. Since I'll want to test even more
scenarios of registers_changed_ptid, passing different sets of
parameters, it will be difficult to do in a single test case. It is
difficult to change something at some point in the test case while make
sure it doesn't compromise what comes after, that we still test the
scenarios that we intended to test. So, split the test case in multiple
smaller ones.
- Split the test case in multiple, where each test case starts from
scratch and tests one specific scenario.
- Introduce the populate_regcaches_for_test function, which is used by
the various test cases to start with a regcache container populated
with a few regcaches for two different targets.
- populate_regcaches_for_test returns a regcache_test_data object, which
contains the test targets that were used to create the regcaches. It
also takes care to call registers_changed at the beginning and end of
the test to ensure the test isn't influenced by existing regcaches,
and cleans up after itself.
- Move the regcache_count lambda function out of
regcache_thread_ptid_changed, so it can be used in
other tests.
- For get_thread_arch_aspace_regcache, test that getting a regcache that
already exists does not increase the count of existing regcaches.
- For registers_changed_ptid, test the three cases we handle today:
(nullptr, minus_one_ptid), (target, minus_one_ptid) and (target,
ptid). The (target, minus_one_ptid) case was not tested prior to this
patch.
gdb/ChangeLog:
* regcache.c (regcache_count): New.
(struct regcache_test_data): New.
(regcache_test_data_up): New.
(populate_regcaches_for_test): New.
(regcaches_test): Remove.
(get_thread_arch_aspace_regcache_test): New.
(registers_changed_ptid_all_test): New.
(registers_changed_ptid_target_test): New.
(registers_changed_ptid_target_ptid_test): New.
(regcache_thread_ptid_changed): Remove regcache_count lambda.
(_initialize_regcache): Register new tests.
Change-Id: Id4280879fb40ff3aeae49b01b95359e1359c3d4b
Simon Marchi [Thu, 20 Aug 2020 14:10:47 +0000 (10:10 -0400)]
gdb: refactor test_get_thread_arch_aspace_regcache
Do these misc changes to test_get_thread_arch_aspace_regcache:
- Rename to get_thread_arch_aspace_regcache_and_check. The following
patch introduces a selftest for get_thread_arch_aspace_regcache, named
get_thread_arch_aspace_regcache_test. To avoid confusion between the
two functions, rename this one to
get_thread_arch_aspace_regcache_and_check, I think it describes better
what it does.
- Remove gdbarch parameter. We always pass the same gdbarch (the
current inferior's gdbarch), so having a parameter is not useful. It
would be interesting to actually test with multiple gdbarches, to
verify that the regcache container can hold multiple regcaches (with
different architectures) for a same (target, ptid). But it's not the
case as of this patch.
- Verify that the regcache's arch is correctly set.
- Remove the aspace parameter. We always pass NULL here, so it's not
useful to have it as a parameter. Also, instead of passing a NULL
aspace to get_thread_arch_aspace_regcache and verifying that we get a
NULL aspace back, pass the current inferior's aspace (just like we use
the current inferior's gdbarch).
gdb/ChangeLog:
* regcache.c (test_get_thread_arch_aspace_regcache): Rename to...
(get_thread_arch_aspace_regcache_and_check): ... this. Remove
gdbarch and aspace parameter. Use current inferior's aspace.
Validate regcache's arch value.
(regcaches_test): Update.
Change-Id: I8b4c2303b4f91f062269043d1f7abe1650232010
Simon Marchi [Thu, 20 Aug 2020 14:07:21 +0000 (10:07 -0400)]
gdb: clear regcaches at the start of regcaches selftest
It currently does not work to run the `regcaches` selftest while
debugging something. This is because we expect that there exists no
regcache at the start of the test. If we are debugging something, there
might exist some regcaches.
Fix it by making the test clear regcaches at the start.
While at it, make the test clean up after it self and clear the
regcaches at the end too.
gdb/ChangeLog:
* regcache.c (regcaches_test): Call registers_changed.
Change-Id: I9d4f83ecb0ff9721a71e2c5cbd19e6e6d4e6c30c
Nick Clifton [Thu, 20 Aug 2020 14:03:21 +0000 (15:03 +0100)]
Ensure that compressed sections that have an ELF compression header structure at the start are correctly aligned.
PR 26428
bfd * bfd.c (bfd_update_compression_header): Also set the sh_addralign
field in the ELF header of the compressed sections.
ld * testsuite/ld-elf/zlibbegin.rS: Update expected output.
* testsuite/ld-elf/zlibnormal.rS: Likewise.
Tankut Baris Aktemur [Thu, 20 Aug 2020 12:23:34 +0000 (14:23 +0200)]
gdb: fix typo "breapoint" -> "breakpoint"
gdb/ChangeLog:
2020-08-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* infrun.c (process_event_stop_test): Fix typo "breapoint".
gdb/testsuite/ChangeLog:
2020-08-20 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* gdb.base/print-file-var.exp: Fix typo "breapoint".
* gdb.trace/strace.exp: Ditto.
Nick Clifton [Thu, 20 Aug 2020 09:19:47 +0000 (10:19 +0100)]
Apply a workaround to mitigate a quadratic performance hit in the linker when writing out secondary reloc sections.
PR 26406
* elf-bfd.h (struct bfd_elf_section_data): Add
has_secondary_relocs field.
* elf.c (_bfd_elf_copy_special_section_fields): Set the
has_secondary_relocs field for sections which have associated
secondary relocs.
* elfcode.h (elf_write_relocs): Only call write_secondary_relocs
on sections which have associated secondary relocs.
Alok Kumar Sharma [Thu, 20 Aug 2020 05:05:27 +0000 (10:35 +0530)]
Fix for incorrect breakpoint set in case of flang compiled binary
Currently, GDB is not able to set a breakpoint at subprogram post
prologue for flang generated binaries. This is due to clang having
two line notes one before and another after the prologue.
Now the end of prologue is determined using symbol table, which was
the way for clang generated binaries already. Since clang and flang
both share same back-end it is true for flang as well.
gdb/ChangeLog
* amd64-tdep.c (amd64_skip_prologue): Using symbol table
to find the end of prologue for flang compiled binaries.
* arm-tdep.c (arm_skip_prologue): Likewise.
* i386-tdep.c (i386_skip_prologue): Likewise.
* producer.c (producer_is_llvm): New function.
(producer_parsing_tests): Added new tests for clang/flang.
* producer.h (producer_is_llvm): New declaration.
gdb/testsuite/ChangeLog
* gdb.fortran/vla-type.exp: Skip commands not required for
the Flang compiled binaries after prologue fix.
Martin Liska [Tue, 18 Aug 2020 12:24:41 +0000 (14:24 +0200)]
Remove --reduce-memory-overheads and --hash-size arguments.
* NEWS: Mention --reduce-memory-overheads and --hash-size arguments
options.
* as.c: Remove the options from help.
* doc/as.texi: Remove options.
* doc/internals.texi: Remove hash from documentation.
* hash.c (struct hash_entry): Remove.
(struct hash_control): Likewise.
(set_gas_hash_table_size): Likewise.
(hash_new_sized): Likewise.
(hash_new): Likewise.
(hash_die): Likewise.
(hash_lookup): Likewise.
(hash_insert): Likewise.
(hash_jam): Likewise.
(hash_replace): Likewise.
(hash_find): Likewise.
(hash_find_n): Likewise.
(hash_delete): Likewise.
(hash_traverse): Likewise.
(hash_print_statistics): Likewise.
(TABLES): Likewise.
(STATBUFSIZE): Likewise.
(main): Likewise.
(what): Likewise.
(destroy): Likewise.
(applicatee): Likewise.
(whattable): Likewise.
* hash.h (struct hash_control): Likewise.
(set_gas_hash_table_size): Likewise.
(hash_new): Likewise.
(hash_new_sized): Likewise.
(hash_die): Likewise.
(hash_insert): Likewise.
(hash_jam): Likewise.
(hash_replace): Likewise.
(hash_find): Likewise.
(hash_find_n): Likewise.
(hash_delete): Likewise.
(hash_traverse): Likewise.
(hash_print_statistics): Likewise.
Martin Liska [Tue, 18 Aug 2020 08:57:21 +0000 (10:57 +0200)]
Port gas/config/* to str_htab.
* config/obj-coff-seh.c (seh_hash_insert): Port to use new
str_htab type.
(seh_hash_find): Likewise.
(seh_hash_find_or_make): Likewise.
* config/obj-coff.c (tag_init): Likewise.
(tag_insert): Likewise.
(tag_find): Likewise.
* config/obj-elf.c (struct group_list): Likewise.
(build_additional_section_info): Likewise.
(free_section_idx): Likewise.
(elf_adjust_symtab): Likewise.
(elf_frob_file_after_relocs): Likewise.
* config/tc-aarch64.c (INSN_SIZE): Likewise.
(parse_reg): Likewise.
(insert_reg_alias): Likewise.
(create_register_alias): Likewise.
(s_unreq): Likewise.
(parse_shift): Likewise.
(parse_pldop): Likewise.
(parse_barrier): Likewise.
(parse_barrier_psb): Likewise.
(parse_bti_operand): Likewise.
(parse_sys_reg): Likewise.
(parse_sys_ins_reg): Likewise.
(lookup_mnemonic): Likewise.
(opcode_lookup): Likewise.
(parse_operands): Likewise.
(checked_hash_insert): Likewise.
(sysreg_hash_insert): Likewise.
(fill_instruction_hash_table): Likewise.
(md_begin): Likewise.
* config/tc-alpha.c (struct alpha_reloc_tag): Likewise.
(get_alpha_reloc_tag): Likewise.
(assemble_tokens_to_insn): Likewise.
(assemble_tokens): Likewise.
(md_begin): Likewise.
* config/tc-arc.c (arc_find_opcode): Likewise.
(arc_insert_opcode): Likewise.
(find_opcode_match): Likewise.
(declare_register): Likewise.
(declare_addrtype): Likewise.
(md_begin): Likewise.
(arc_parse_name): Likewise.
(tc_arc_regname_to_dw2regnum): Likewise.
(arc_extcorereg): Likewise.
* config/tc-arm.c (MVE_BAD_QREG): Likewise.
(arm_reg_parse_multi): Likewise.
(parse_reloc): Likewise.
(insert_reg_alias): Likewise.
(create_register_alias): Likewise.
(s_unreq): Likewise.
(parse_shift): Likewise.
(parse_psr): Likewise.
(parse_cond): Likewise.
(parse_barrier): Likewise.
(do_vfp_nsyn_opcode): Likewise.
(opcode_lookup): Likewise.
(arm_tc_equal_in_insn): Likewise.
(md_begin): Likewise.
* config/tc-avr.c (md_begin): Likewise.
(avr_ldi_expression): Likewise.
(md_assemble): Likewise.
(avr_update_gccisr): Likewise.
(avr_emit_insn): Likewise.
* config/tc-cr16.c (get_register): Likewise.
(get_register_pair): Likewise.
(get_index_register): Likewise.
(get_index_register_pair): Likewise.
(get_pregister): Likewise.
(get_pregisterp): Likewise.
(initialise_reg_hash_table): Likewise.
(md_begin): Likewise.
(cr16_assemble): Likewise.
(md_assemble): Likewise.
* config/tc-cris.c (cris_insn_first_word_frag): Likewise.
(md_begin): Likewise.
(cris_process_instruction): Likewise.
* config/tc-crx.c (get_register): Likewise.
(get_copregister): Likewise.
(md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-csky.c (md_begin): Likewise.
(parse_opcode): Likewise.
(get_operand_value): Likewise.
(v1_work_jbsr): Likewise.
(v2_work_rotlc): Likewise.
(v2_work_bgeni): Likewise.
(v2_work_not): Likewise.
* config/tc-d10v.c (sizeof): Likewise.
(md_begin): Likewise.
(do_assemble): Likewise.
(md_apply_fix): Likewise.
* config/tc-d30v.c (sizeof): Likewise.
(md_begin): Likewise.
(do_assemble): Likewise.
* config/tc-dlx.c (RELOC_DLX_VTENTRY): Likewise.
(md_begin): Likewise.
(machine_ip): Likewise.
* config/tc-ft32.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-h8300.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-hppa.c (pa_ip): Likewise.
(md_begin): Likewise.
* config/tc-i386.c (md_begin): Likewise.
(i386_print_statistics): Likewise.
(parse_insn): Likewise.
(process_operands): Likewise.
(i386_index_check): Likewise.
(parse_real_register): Likewise.
* config/tc-ia64.c (dot_rot): Likewise.
(dot_entry): Likewise.
(declare_register): Likewise.
(md_begin): Likewise.
(ia64_parse_name): Likewise.
(md_assemble): Likewise.
(dot_alias): Likewise.
(do_alias): Likewise.
(ia64_adjust_symtab): Likewise.
(do_secalias): Likewise.
(ia64_frob_file): Likewise.
* config/tc-m68hc11.c (m68hc11_print_statistics): Likewise.
(md_begin): Likewise.
(print_insn_format): Likewise.
(md_assemble): Likewise.
* config/tc-m68k.c (tc_gen_reloc): Likewise.
(m68k_ip): Likewise.
(md_begin): Likewise.
* config/tc-mcore.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-microblaze.c (md_begin): Likewise.
(md_assemble): Likewise.
(md_apply_fix): Likewise.
* config/tc-mips.c (nopic_need_relax): Likewise.
(md_begin): Likewise.
(macro_build): Likewise.
(mips16_macro_build): Likewise.
(mips_lookup_insn): Likewise.
(mips_ip): Likewise.
(mips16_ip): Likewise.
* config/tc-mmix.c (sizeof): Likewise.
(mmix_md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-mn10200.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-mn10300.c (HAVE_AM30): Likewise.
(md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-moxie.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-msp430.c (md_begin): Likewise.
(msp430_operands): Likewise.
(md_assemble): Likewise.
* config/tc-nds32.c (PV_DONT_CARE): Likewise.
(builtin_isreg): Likewise.
(builtin_regnum): Likewise.
(nds32_init_nds32_pseudo_opcodes): Likewise.
(nds32_lookup_pseudo_opcode): Likewise.
(nds32_relax_hint): Likewise.
(md_begin): Likewise.
(nds32_find_reloc_table): Likewise.
(nds32_elf_append_relax_relocs_traverse): Likewise.
(nds32_relax_branch_instructions): Likewise.
(md_convert_frag): Likewise.
(nds32_elf_analysis_relax_hint): Likewise.
(tc_nds32_regname_to_dw2regnum): Likewise.
* config/tc-nios2.c (nios2_opcode_lookup): Likewise.
(nios2_reg_lookup): Likewise.
(nios2_ps_lookup): Likewise.
(md_begin): Likewise.
* config/tc-ns32k.c (struct hash_control): Likewise.
(parse): Likewise.
(md_begin): Likewise.
* config/tc-pdp11.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-pj.c (fake_opcode): Likewise.
(alias): Likewise.
(md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-ppc.c (ppc_setup_opcodes): Likewise.
(md_assemble): Likewise.
* config/tc-pru.c (pru_opcode_lookup): Likewise.
(pru_reg_lookup): Likewise.
(md_begin): Likewise.
(md_end): Likewise.
* config/tc-riscv.c (init_ext_version_hash): Likewise.
(riscv_get_default_ext_version): Likewise.
(riscv_set_arch): Likewise.
(init_opcode_names_hash): Likewise.
(opcode_name_lookup): Likewise.
(enum reg_class): Likewise.
(hash_reg_name): Likewise.
(riscv_init_csr_hash): Likewise.
(reg_csr_lookup_internal): Likewise.
(reg_lookup_internal): Likewise.
(init_opcode_hash): Likewise.
(md_begin): Likewise.
(DECLARE_CSR): Likewise.
(macro_build): Likewise.
(riscv_ip): Likewise.
* config/tc-s390.c (register_name): Likewise.
(s390_setup_opcodes): Likewise.
(md_begin): Likewise.
(md_assemble): Likewise.
(s390_insn): Likewise.
* config/tc-score.c (struct s3_reg_map): Likewise.
(s3_score_reg_parse): Likewise.
(s3_dependency_type_from_insn): Likewise.
(s3_parse_16_32_inst): Likewise.
(s3_parse_48_inst): Likewise.
(s3_insert_reg): Likewise.
(s3_build_reg_hsh): Likewise.
(s3_build_score_ops_hsh): Likewise.
(s3_build_dependency_insn_hsh): Likewise.
(s3_begin): Likewise.
* config/tc-score7.c (struct s7_reg_map): Likewise.
(s7_score_reg_parse): Likewise.
(s7_dependency_type_from_insn): Likewise.
(s7_parse_16_32_inst): Likewise.
(s7_build_score_ops_hsh): Likewise.
(s7_build_dependency_insn_hsh): Likewise.
(s7_insert_reg): Likewise.
(s7_build_reg_hsh): Likewise.
(s7_begin): Likewise.
* config/tc-sh.c (EMPTY): Likewise.
(md_begin): Likewise.
(find_cooked_opcode): Likewise.
* config/tc-sparc.c (md_begin): Likewise.
(sparc_ip): Likewise.
* config/tc-spu.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-tic30.c (md_begin): Likewise.
(tic30_operand): Likewise.
(tic30_parallel_insn): Likewise.
(md_assemble): Likewise.
* config/tc-tic4x.c (TIC4X_ALT_SYNTAX): Likewise.
(tic4x_asg): Likewise.
(tic4x_inst_insert): Likewise.
(tic4x_inst_add): Likewise.
(md_begin): Likewise.
(tic4x_operand_parse): Likewise.
(md_assemble): Likewise.
* config/tc-tic54x.c (MAX_SUBSYM_HASH): Likewise.
(stag_add_field_symbols): Likewise.
(tic54x_endstruct): Likewise.
(tic54x_tag): Likewise.
(tic54x_remove_local_label): Likewise.
(tic54x_clear_local_labels): Likewise.
(tic54x_var): Likewise.
(tic54x_macro_start): Likewise.
(tic54x_macro_info): Likewise.
(tic54x_macro_end): Likewise.
(subsym_isreg): Likewise.
(subsym_structsz): Likewise.
(md_begin): Likewise.
(is_mmreg): Likewise.
(is_type): Likewise.
(encode_condition): Likewise.
(encode_cc3): Likewise.
(encode_cc2): Likewise.
(encode_operand): Likewise.
(tic54x_parse_insn): Likewise.
(tic54x_parse_parallel_insn_firstline): Likewise.
(subsym_create_or_replace): Likewise.
(subsym_lookup): Likewise.
(subsym_substitute): Likewise.
(tic54x_undefined_symbol): Likewise.
* config/tc-tic6x.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-tilegx.c (O_hw2_last_plt): Likewise.
(INSERT_SPECIAL_OP): Likewise.
(md_begin): Likewise.
(tilegx_parse_name): Likewise.
(parse_reg_expression): Likewise.
(md_assemble): Likewise.
* config/tc-tilepro.c (O_tls_ie_load): Likewise.
(INSERT_SPECIAL_OP): Likewise.
(tilepro_parse_name): Likewise.
(parse_reg_expression): Likewise.
(md_assemble): Likewise.
* config/tc-v850.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-vax.c (md_ri_to_chars): Likewise.
(vip_begin): Likewise.
(vip): Likewise.
(main): Likewise.
(md_begin): Likewise.
* config/tc-wasm32.c (md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-xgate.c (xgate_parse_operand): Likewise.
(md_begin): Likewise.
(md_assemble): Likewise.
* config/tc-z8k.c (md_begin): Likewise.
(md_assemble): Likewise.
Martin Liska [Tue, 18 Aug 2020 08:51:28 +0000 (10:51 +0200)]
Port dw2gencfi.c to str_htab.
* dw2gencfi.c (dwcfi_hash_insert): Use htab_t and str_hash_*
functions.
(dwcfi_hash_find): Likewise.
(dwcfi_hash_find_or_make): Likewise.
Martin Liska [Tue, 18 Aug 2020 08:49:16 +0000 (10:49 +0200)]
Port ecoff.c to str_hash.
* ecoff.c (INIT_VARRAY): Use htab_t.
(add_string): Likewise.
(ecoff_read_begin_hook): Use new str_htab_create.
(get_tag): Use htab_t.
(add_file): Likewise.
Martin Liska [Tue, 18 Aug 2020 08:49:16 +0000 (10:49 +0200)]
Add new string hash table based on htab_t.
* hash.h (struct string_tuple): New.
(hash_string_tuple): Likewise.
(eq_string_tuple): Likewise.
(string_tuple_alloc): Likewise.
(str_hash_find): Likewise.
(str_hash_find_n): Likewise.
(str_hash_delete): Likewise.
(str_hash_insert): Likewise.
(str_htab_create): Likewise.
Martin Liska [Sat, 15 Aug 2020 17:48:17 +0000 (19:48 +0200)]
Use libiberty hash in gas/symbols.c.
* symbols.c (struct symbol_entry): New.
(hash_symbol_entry): Likewise.
(eq_symbol_entry): Likewise.
(symbol_entry_alloc): Likewise.
(symbol_entry_find): Likewise.
(local_symbol_make): Use htab hash table.
(local_symbol_convert): Likewise.
(symbol_table_insert): Likewise.
(symbol_find_exact_noref): Likewise.
(resolve_local_symbol): Likewise.
(resolve_local_symbol_values): Likewise.
(symbol_begin): Likewise.
(symbol_print_statistics): Likewise.
Martin Liska [Sat, 15 Aug 2020 17:47:35 +0000 (19:47 +0200)]
Use libiberty hash in gas/read.c.
* read.c (struct po_entry): New.
(hash_po_entry): Likewise.
(eq_po_entry): Likewise.
(po_entry_alloc): Likewise.
(po_entry_find): Likewise.
(pop_insert): Likewise.
(pobegin): Use htab hash table.
(read_a_source_file): Likewise.
(s_macro): Likewise.
(read_print_statistics): Likewise.
* config/tc-m68k.c (m68k_conditional_pseudoop): Add const qualifier.
* config/tc-m68k.h (m68k_conditional_pseudoop): Likewise.
Martin Liska [Sat, 15 Aug 2020 17:47:01 +0000 (19:47 +0200)]
Use libiberty hash in gas/macro.c.
* config/tc-iq2000.c (iq2000_add_macro): Use htab hash table.
* macro.c (struct hash_control): Use htab.
(macro_init): Likewise.
(do_formals): Likewise.
(free_macro): Likewise.
(define_macro): Likewise.
(sub_actual): Likewise.
(macro_expand_body): Likewise.
(macro_expand): Likewise.
(check_macro): Likewise.
(delete_macro): Likewise.
(expand_irp): Likewise.
* macro.h (struct macro_hash_entry): New struct.
(hash_macro_entry): New.
(eq_macro_entry): Likewise.
(macro_entry_alloc): Likewise.
(macro_entry_find): Likewise.
(struct formal_hash_entry): Likewise.
(hash_formal_entry): Likewise.
(eq_formal_entry): Likewise.
(formal_entry_alloc): Likewise.
(formal_entry_find): Likewise.
Martin Liska [Sat, 15 Aug 2020 17:46:33 +0000 (19:46 +0200)]
gas/hash.c: add new functions
The first of a patch series deleting the gas/hash.c hash table
implementation and instead using libiberty/hashtab.c hash tables in
gas.
* as.h: Include hashtab.h.
* hash.c (htab_insert): New.
(htab_print_statistics): Likewise.
* hash.h (htab_insert): Likewise.
(htab_print_statistics): Likewise.
GDB Administrator [Thu, 20 Aug 2020 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 19 Aug 2020 08:49:38 +0000 (18:19 +0930)]
PR26349, FAIL: binutils-all/pr25543 on hpux
The 't' length modifier isn't in SUSv2, unsurprisingly %tx isn't
recognized by older printf implementations. So even though 't' is
correct for ptrdiff_t we can't use it. Also, _bfd_int64_high and
_bfd_int64_low disappeared in 2008.
PR 26349
* readelf.c (dump_relocations): Use BFD_VMA_FMT to print offset
and info fields.
(dump_section_as_strings): Don't use %tx to display offset.
Simon Marchi [Wed, 19 Aug 2020 02:49:54 +0000 (22:49 -0400)]
gdb: add linux_nat_debug_printf macro
The debug prints inside linux-nat.c almost all have a prefix that
indicate in which function they are located. This prefix is an
abbreviation of the function name. For example, this print is in the
`linux_nat_post_attach_wait` function:
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LNPAW: Attaching to a stopped process\n");
Over time, the code has changed, things were moved, and many of these
prefixes are not accurate anymore. Also, unless you know the
linux-nat.c file by heart, it's a bit cryptic what LLR, LNW, RSRL, etc,
all mean.
To address both of these issues, I suggest adding this macro for
printing debug statements, which automatically includes the function
name. It also includes the `[linux-nat]` prefix to clarify which part
of GDB printed this (I think that, ideally, all debug prints would
include such a tag).
The `__func__` magic symbol is used to get the function name.
Unfortunately, in the case of methods, it only contains the method name,
not the class name. So we'll get "wait", where I would have liked to
get "linux_nat_target::wait". But at least with the `[linux-nat]` tag
in the front, it's not really ambiguous.
I've made the macro automatically include the trailing newline, because
it wouldn't make sense to call it twice to print two parts of one line,
the `[linux-nat]` tag would be printed in the middle.
An advantage of this (IMO) is that it's less verbose, we don't have to
check for `if (debug_linux_nat)` everywhere.
Another advantage is that it's easier to customize the output later,
without having to touch all call sites.
Here's an example of what it looks like in the end:
[linux-nat] linux_nat_wait_1: enter
[linux-nat] wait: [process -1], [TARGET_WNOHANG]
gdb/ChangeLog:
* linux-nat.c (linux_nat_debug_printf): New function.
(linux_nat_debug_printf_1): New macro. Use throughout the file.
Change-Id: Ifcea3255b91400d3ad093cd0b75d3fac241cb998
GDB Administrator [Wed, 19 Aug 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Tue, 18 Aug 2020 23:17:35 +0000 (08:47 +0930)]
Correct vcmpsq, vcmpuq and xvtlsbb BF field
These shouldn't be optional. The record form of vector instructions
set CR6, giving an expectation that omitting BF should be the same as
specifying CR6.
opcodes/
* ppc-opc.c (powerpc_opcodes): Replace OBF with BF for vcmpsq,
vcmpuq and xvtlsbb.
gas/
* testsuite/gas/ppc/int128.s: Correct vcmpuq.
* testsuite/gas/ppc/int128.d: Update.
* testsuite/gas/ppc/xvtlsbb.d: Update.
Aaron Merey [Tue, 18 Aug 2020 22:02:26 +0000 (18:02 -0400)]
gdb/Makefile.in: Add DEBUGINFOD_CFLAGS, DEBUGINFOD_LIBS variables.
Introduce Makefile variables DEBUGINFOD_CFLAGS and DEBUGINFOD_LIBS
that map to the configuration variables of the same names.
Replace @DEBUGINFOD_LIBS@ with $(DEBUGINFOD_LIBS) in the definition
of CLIBS in order to conform to the usage of other *_LIBS variables
in Makefile.in.
Add DEBUGINFOD_CFLAGS to INTERNAL_CFLAGS_BASE. This fixes an issue
where GDB would fail to find debuginfod.h if it was not installed
in a default location searched by the compiler.
gdb/ChangeLog:
* Makefile.in (DEBUGINFOD_CFLAGS, DEBUGINFOD_LIBS): New variables.
(INTERNAL_CFLAGS_BASE): Add DEBUGINFOD_CFLAGS.
(CLIBS): Add DEBUGINFOD_LIBS.
Peter Bergner [Tue, 18 Aug 2020 17:48:42 +0000 (12:48 -0500)]
Add ChangeLog entries for previous commit.
Peter Bergner [Tue, 18 Aug 2020 17:42:31 +0000 (12:42 -0500)]
PowerPC: Rename xvcvbf16sp to xvcvbf16spn
The xvcvbf16sp mnemonic has been renamed to xvcvbf16spn, to be consistent
with the other non-signaling conversion instructions which all end with "n".
opcodes/
* ppc-opc.c (powerpc_opcodes) <xvcvbf16sp>: Rename from this...
<xvcvbf16spn>: ...to this.
gas/
* testsuite/gas/ppc/vsx4.s: Update test to use new mnemonic.
* testsuite/gas/ppc/vsx4.d: Likewise.
GDB Administrator [Tue, 18 Aug 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergei Trofimovich [Tue, 19 May 2020 21:19:45 +0000 (22:19 +0100)]
gdb: fix IA64 build failure of linux-nat
On IA64 built failed as:
```
ia64-linux-nat.c:352:29: error: 'gdbarch_num_regs' was not declared in this scope
352 | if (regno < 0 || regno >= gdbarch_num_regs (gdbarch))
| ^~~~~~~~~~~~~~~~
```
The fix includes "gdbarch.h" header where symbol is declared.
* ia64-linux-nat.c: Include "gdbarch.h" to declare used
'gdbarch_num_regs'.
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Tom Tromey [Mon, 17 Aug 2020 16:45:49 +0000 (10:45 -0600)]
Update xfail pattern in gdb.rust/simple.exp
In PR rust/26197, Tom de Vries notes that the variant part rewrite
caused some regressions for the Rust compiler he has. This compiler
is unusual in that it combines a relatively recent rustc with a
relatively old LLVM -- so variant parts are not emitted using DWARF.
Most of the bugs in that PR were already fixed by earlier patches, but
some lingered. After some research we found that some of these never
did work -- which is consistent with the investigations we did into
the debug info -- but instead were xfail'd. This patch updates the
xfails to cope with the new output. (After this, just one failure
remains.)
Tom de Vries tested this using his rustc and suggested a fix that
appears in this version.
gdb/testsuite/ChangeLog
2020-08-17 Tom de Vries <tdevries@suse.de>
Tom Tromey <tromey@adacore.com>
PR rust/26197:
* gdb.rust/simple.exp (xfail_pattern): Update for new failure.
Tom Tromey [Mon, 17 Aug 2020 15:21:40 +0000 (09:21 -0600)]
Fix MI crash with Ada string access
I happened to notice that using -var-create at a certain spot in an
Ada program caused a crash. This happens because
ada_get_decoded_value can return NULL -- in particular, deeper in the
code it can hit this return in ada_type_of_array:
descriptor = desc_bounds (arr);
if (value_as_long (descriptor) == 0)
return NULL;
This patch avoids the crash by handling this NULL return.
gdb/ChangeLog
2020-08-17 Tom Tromey <tromey@adacore.com>
* ada-varobj.c (ada_varobj_decode_var): Handle case where
ada_get_decoded_value returns NULL.
gdb/testsuite/ChangeLog
2020-08-17 Tom Tromey <tromey@adacore.com>
* gdb.ada/mi_var_access.exp: New file.
* gdb.ada/mi_var_access/mi_access.adb: New file.
* gdb.ada/mi_var_access/pck.adb: New file.
* gdb.ada/mi_var_access/pck.ads: New file.
Tom Tromey [Mon, 17 Aug 2020 14:50:35 +0000 (08:50 -0600)]
Convert CORE_ADDR to Python using gdb_py_object_from_ulongest
An internal test failed on a riscv64-elf cross build because
Inferior.search_memory returned a negative value. I tracked this down
to to use of PyLong_FromLong in infpy_search_memory. Then, I looked
at other conversions of CORE_ADDR to Python and fixed these as well.
I don't think there is a good way to write a test for this.
gdb/ChangeLog
2020-08-17 Tom Tromey <tromey@adacore.com>
* python/py-inferior.c (infpy_search_memory): Use
gdb_py_object_from_ulongest.
* python/py-infevents.c (create_inferior_call_event_object)
(create_memory_changed_event_object): Use
gdb_py_object_from_ulongest.
* python/py-linetable.c (ltpy_entry_get_pc): Use
gdb_py_object_from_ulongest.
Simon Marchi [Mon, 17 Aug 2020 10:02:24 +0000 (06:02 -0400)]
gdb: fix wrong indentation in symbol_needs_eval_context
gdb/ChangeLog:
* loc.c (class symbol_needs_eval_context): Fix indentation.
Change-Id: Ibf4e6a9ca9573b498737a61db116ee10b287b7f5
Simon Marchi [Mon, 17 Aug 2020 09:57:16 +0000 (05:57 -0400)]
gdb: use bool in dwarf2_loc_desc_get_symbol_read_needs
This variable is really a boolean, so use the bool type.
gdb/ChangeLog:
* dwarf2/loc.c (dwarf2_loc_desc_get_symbol_read_needs): Use
bool.
Change-Id: I814a47d1200f3b88722c54c822fd49607a6b77be
Alex Coplan [Mon, 17 Aug 2020 13:23:14 +0000 (14:23 +0100)]
gas: Fix internal error in S_SET_SEGMENT
This patch fixes an internal error in GAS when defining a section using
a symbol that has already been named but not defined. For a minimal
reproducer, try the following input:
a=b
.sect a
The problem is that obj_elf_change_section() happily reuses the symbol
"a" created by equals() without clearing the sy_value field: prior to
this patch, it just set bsym. This caused a problem when attempting to
resolve the section symbol, since resolve_symbol_value() ended up
resolving the symbol as if it were the original symbol created by
equals(), which ends up leaving the section symbol in the undefined
section instead of in section a, hence the call to abort() in
S_SET_SEGMENT().
gas/ChangeLog:
* config/obj-elf.c (obj_elf_change_section): When repurposing an
existing symbol, ensure that we set sy_value as per other (fresh)
section symbols.
* testsuite/gas/elf/elf.exp: Add new test.
* testsuite/gas/elf/section-symbol-redef.d: New test.
* testsuite/gas/elf/section-symbol-redef.s: Input for test.
Tom de Vries [Mon, 17 Aug 2020 07:54:37 +0000 (09:54 +0200)]
[gdb] Fix printing of unresolved dynamic type
When debugging gdb in batch mode with executable mixed-lang-stack and doing a
backtrace at breakpt:
...
$ gdb --args gdb \
-batch \
outputs/gdb.fortran/mixed-lang-stack/mixed-lang-stack \
-ex "b breakpt" \
-ex r \
-ex bt
...
and stopping at resolve_dynamic_type to print the type:
...
(gdb) b resolve_dynamic_type
Breakpoint 1 at 0x6b020c: file gdbtypes.c, line 2633.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
>call recursive_dump_type (type, 0)
>continue
>end
(gdb) run
...
we eventually run into an assert for the dynamic type of "str":
...
Thread 1 "gdb" hit Breakpoint 1, resolve_dynamic_type (type=0x22204f0, \
valaddr=..., addr=
4199408) at gdbtypes.c:2633
2633 = {check_typedef (type), valaddr, addr, NULL};
type node 0x22204f0
name '<NULL>' (0x0)
code 0xd (TYPE_CODE_STRING)
length 0
...
nfields 0 0x22204b0
gdbtypes.h:526: internal-error: LONGEST dynamic_prop::const_val() const: \
Assertion `m_kind == PROP_CONST' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
...
when trying to print the high bound of a TYPE_CODE_RANGE, which has m_kind
PROP_LOCEXPR, while the code in resolve_dynamic_type assumes PROP_CONST.
Fix this by extending the printing of TYPE_CODE_RANGE to allow
PROP_LOCEXPR/PROP_LOCLIST as well, such that we have instead:
...
nfields 0 0x1fbc020
low 1 high (dynamic)
...
Tested on x86_64-linux.
gdb/ChangeLog:
2020-08-17 Tom de Vries <tdevries@suse.de>
PR gdb/26393
* gdbtypes.c (dump_dynamic_prop): New function.
(recursive_dump_type): Use dump_dynamic_prop for TYPE_CODE_RANGE.
GDB Administrator [Mon, 17 Aug 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Sun, 16 Aug 2020 13:27:51 +0000 (22:57 +0930)]
PowerPC64 inline PLT call tests
* testsuite/ld-powerpc/inline.s,
* testsuite/ld-powerpc/inline-1.d,
* testsuite/ld-powerpc/inline-2.d,
* testsuite/ld-powerpc/inline-3.d,
* testsuite/ld-powerpc/inline-4.d,
* testsuite/ld-powerpc/inlinepcrel.s,
* testsuite/ld-powerpc/inlinepcrel-1.d,
* testsuite/ld-powerpc/inlinepcrel-2.d,
* testsuite/ld-powerpc/inlinepcrel-3.d: New tests.
* testsuite/ld-powerpc/powerpc.exp: Run them.
H.J. Lu [Sun, 16 Aug 2020 12:45:02 +0000 (05:45 -0700)]
ld: Add a PR binutils/26389 test
PR binutils/26389
* testsuite/ld-plugin/lto.exp: Run PR binutils/26389 test.
* testsuite/ld-plugin/pr26389.c: New file.
* testsuite/ld-plugin/pr26389.d: Likewise.
Tom de Vries [Sun, 16 Aug 2020 11:30:34 +0000 (13:30 +0200)]
[gdb/testsuite] Add gdb.base/eh_return.exp
In PR25350, an internal error was reported:
...
(gdb) break *eh2+0x7e
Breakpoint 1 at 0x13e2: file small.c, line 38.
(gdb) run
Starting program: a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Breakpoint 1, 0x00005555555553e2 in eh2 (
frame.c:558: internal-error: frame_id get_frame_id(frame_info*): \
Assertion `stashed' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
...
The internal error does not reproduce after recent commit
547ce8f00b
"[gdb/backtrace] Fix printing of fortran string args".
Add the corresponding test-case as regression test, given that the code is
rather atypical.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-08-16 Tom de Vries <tdevries@suse.de>
PR gdb/25350
* gdb.base/eh_return.c: New test.
* gdb.base/eh_return.exp: New file.
GDB Administrator [Sun, 16 Aug 2020 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Sat, 15 Aug 2020 09:59:18 +0000 (11:59 +0200)]
[gdb/testsuite] Fix charlen type in mixed-lang-stack.c
In gdb.fortran/mixed-lang-stack.f90, we have fortran function mixed_func_1d:
...
subroutine mixed_func_1d(a, b, c, d, str)
use, intrinsic :: iso_c_binding, only: c_int, c_float, c_double
use, intrinsic :: iso_c_binding, only: c_float_complex
implicit none
integer(c_int) :: a
real(c_float) :: b
real(c_double) :: c
complex(c_float_complex) :: d
character(len=*) :: str
...
which we declare in C in gdb.fortran/mixed-lang-stack.c like this:
...
extern void mixed_func_1d_ (int *, float *, double *, complex float *,
char *, size_t);
...
The fortran string parameter str is passed as a char *, and an additional
argument str_ for the string length. The type used for the string length
argument is size_t, but for gcc 7 and earlier, the actual type is int
instead ( see
https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html ).
Fix this by declaring the string length type depending on the gcc version:
...
#if !defined (__GNUC__) || __GNUC__ > 7
typedef size_t fortran_charlen_t;
#else
typedef int fortran_charlen_t;
...
Tested on x86_64-linux, with gcc-7 and gcc-8.
gdb/testsuite/ChangeLog:
2020-08-15 Tom de Vries <tdevries@suse.de>
* gdb.fortran/mixed-lang-stack.c (fortran_charlen_t): New type.
(mixed_func_1d_): Use fortran_charlen_t in decl.
Tom de Vries [Sat, 15 Aug 2020 08:19:13 +0000 (10:19 +0200)]
[gdb/backtrace] Fix printing of fortran string args
When running test-case gdb.fortran/mixed-lang-stack.exp, it passes, but we
find in gdb.log:
...
(gdb) bt^M
...
#7 0x000000000040113c in mixed_func_1b (a=1, b=2, c=3, d=(4,5), \
e=<error reading variable: value requires
140737488341744 bytes, which \
is more than max-value-size>, g=..., _e=6) at mixed-lang-stack.f90:87^M
...
while a bit later in gdb.log, we have instead for the same frame (after
adding a gdb_test_no_output "set print frame-arguments all" to prevent
getting "e=..."):
...
(gdb) up^M
#7 0x000000000040113c in mixed_func_1b (a=1, b=2, c=3, d=(4,5), \
e='abcdef', g=( a = 1.5, b = 2.5 ), _e=6) at mixed-lang-stack.f90:87^M
...
The difference is that in the latter case, we print the frame while it's
selected, while in the former, it's not.
The problem is that while trying to resolve the dynamic type of e in
resolve_dynamic_type, we call dwarf2_evaluate_property with a frame == NULL
argument, and then use the selected frame as the context in which to evaluate
the dwarf property, effectively evaluating a DW_OP_fbreg operation in the
wrong frame context.
Fix this by temporarily selecting the frame of which we're trying to print the
arguments in print_frame_args, borrowing code from print_frame_local_vars that
was added to fix a similar issue in commit
16c3b12f19 "error/internal-error
printing local variable during "bt full".
Build and tested on x86_64-linux.
gdb/ChangeLog:
2020-08-15 Tom de Vries <tdevries@suse.de>
PR backtrace/26390
* stack.c (print_frame_args): Temporarily set the selected
frame to FRAME while printing the frame's arguments.
gdb/testsuite/ChangeLog:
2020-08-15 Tom de Vries <tdevries@suse.de>
PR backtrace/26390
* gdb.fortran/mixed-lang-stack.exp: Call bt with -frame-arguments all.
Update expected pattern.
Alan Modra [Sat, 15 Aug 2020 04:34:43 +0000 (14:04 +0930)]
Set SEC_SMALL_DATA on small common
Unlike the previous patch setting SEC_SMALL_DATA during
elf_backend_symbol_processing, this patch is mostly cosmetic.
* elf32-frv.c (elf32_frv_add_symbol_hook): Set SEC_SMALL_DATA on
small common section.
* elf32-m32r.c (m32r_elf_add_symbol_hook): Likewise.
* elf32-microblaze.c (microblaze_elf_add_symbol_hook): Likewise.
* elf32-nds32.c (nds32_elf_add_symbol_hook): Likewise.
* elf32-nios2.c (nios2_elf_add_symbol_hook): Likewise.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf32-score.c (s3_bfd_score_elf_add_symbol_hook): Likewise.
* elf32-score7.c (s7_bfd_score_elf_add_symbol_hook): Likewise.
* elf32-tic6x.c (elf32_tic6x_add_symbol_hook): Likewise.
* elf32-v850.c (v850_elf_check_relocs): Likewise.
(v850_elf_add_symbol_hook): Likewise.
* elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
* elf64-ia64-vms.c (elf64_ia64_add_symbol_hook): Likewise.
* elfnn-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
* elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Likewise.
Alan Modra [Sat, 15 Aug 2020 00:12:44 +0000 (09:42 +0930)]
PR26389, nm prints "c" for a common symbol with -flto and -fcommon
git commit
49d9fd42acef chose to make nm print 'C' for the normal
common section, and 'c' for other commons. This was an attempt to
make common symbols in .scommon and other small common sections show
a 'c' type without a section name comparison, but it failed for
nm --plugin on lto objects where normal common symbols are stashed in
a "plug" section. It's also wrong for large common symbols. So
instead set SEC_SMALL_DATA on sections created for small commons, and
key off that flag to show 'c' type. If your ELF target doesn't have
an elf_backend_symbol_processing function, then you won't see 'c' for
symbols in .scommon.
Note that due to bfd_decode_symclass decoding common symbols without
a chance for coff_section_type to treat .scommon specially, then
having .scommon in the array of special sections handled by
coff_section_type prior to
49d9fd42acef was entirely ineffective.
That fact escaped me when writing
49d9fd42acef. Unless .scommon
didn't have SEC_IS_COMMON set, which would be a little weird.
PR 26389
* syms.c (bfd_decode_symclass): Choose 'c' for commons only when
SEC_SMALL_DATA.
* elf32-m32r.c (_bfd_m32r_elf_symbol_processing): Set SEC_SMALL_DATA
on small common section.
* elf32-score.c (s3_bfd_score_elf_symbol_processing): Likewise.
* elf32-score7.c (s7_bfd_score_elf_symbol_processing): Likewise.
* elf32-tic6x.c (elf32_tic6x_symbol_processing): Likewise.
* elf32-v850.c (v850_elf_symbol_processing): Likewise.
* elfxx-mips.c (_bfd_mips_elf_symbol_processing): Likewise.
* ecoff.c (ecoff_set_symbol_info, ecoff_link_add_externals): Likewise.
GDB Administrator [Sat, 15 Aug 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Franco de Carvalho [Fri, 14 Aug 2020 18:41:14 +0000 (15:41 -0300)]
[PowerPC] Always clear watchpoint with PTRACE_SET_DEBUGREG
This patches changes low_prepare_to_resume in the ppc linux native target
to always clear the watchpoint when the old PTRACE_SET_DEBUGREG interface
is used, even if another watchpoint GDB requested to the target is
written right after using the same call.
The reason for this is that there were some older kernel versions for
which overwriting a watchpoint with PTRACE_SET_DEBUGREG would not
re-activate the watchpoint if it was previouly disabled following a hit.
This happened when the kernel was configured with CONFIG_HW_BREAKPOINT on
and uses perf events to install watchpoints.
Previously, the ppc linux native target would immediately remove or
insert watchpoints following a request from the upper layers. This was
changed in commit
227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7 to fix other
issues, which caused watchpoint requests to be applied to the inferior
only in low_prepare_to_resume, right before the inferior is resumed.
Usually, but maybe not always, after a hit, GDB will remove the
watchpoint, resume the inferior for a single-step, possibly report the
watchpoint hit to the user, and then re-insert the watchpoint before the
inferior is next resumed. In this case there would be no problems, but
since I can't guarantee that there aren't other paths in GDB that allow
the user to set a new watchpoint after the first one hit, and after its
deletion by GDB, but before the inferior is resumed, there is a chance
that PTRACE_SET_DEBUGREG could be called directly without the watchpoint
first having been cleared, which could cause a false negative with the
older kernel versions.
This issue would affect kernel versions starting from this commit:
5aae8a53708025d4e718f0d2e7c2f766779ddc71
Up to the fix in this commit:
a53fd61ac2f411745471c1c877d5e072fbbf0e5c
gdb/ChangeLog:
PR breakpoints/26385
* ppc-linux-nat.c (ppc_linux_nat_target::low_prepare_to_resume):
Always clear watchpoint with PTRACE_SET_DEBUGREG.
Pedro Franco de Carvalho [Fri, 14 Aug 2020 18:41:13 +0000 (15:41 -0300)]
[PowerPC] Use < 0 and >= 0 for watchpoint ptrace calls
In commit
227c0bf4b3dd0cf65dceb58e729e9da81b38b5a7, which fixed some
watchpoint bugs, I compared the return value of some ptrace calls with ==
-1 and != -1. Althought this should be correct, since the rest of the
file uses < 0 and >= 0, I have modified this for consistency.
gdb/ChangeLog:
* ppc-linux-nat.c (ppc_linux_dreg_interface::detect)
(ppc_linux_nat_target::low_prepare_to_resume): Use ptrace () < 0
and >= to check return value instead of == -1 and != -1.
Simon Marchi [Fri, 14 Aug 2020 16:27:22 +0000 (12:27 -0400)]
gdb: add gdb_argv::as_array_view method
Introduce the gdb_argv::as_array_view method, as a way to easily pass
the parsed arguments array to a function taking an array view. There is
currently one caller where we can use this (which prompted the
suggestion to implement this method).
Add some selftests for the new method, which at the same time test a
little bit gdb_argv. As far as I know, it's not tested currently.
gdb/ChangeLog:
* utils.h (class gdb_argv) <as_array_view>: New method.
* utils.c (gdb_argv_as_array_view_test): New.
(_initialize_utils): Register selftest.
* maint.c (maintenance_selftest): Use the new method.
Change-Id: I0645037613ed6549aabe60f14a36f3494513b177
Alan Modra [Fri, 14 Aug 2020 08:15:13 +0000 (17:45 +0930)]
Allow larger bfd_default_hash_table_size
* hash.c (bfd_hash_set_default_size): Use higher_prime_number
rather than another copy of primes. Increase maximum default
size allowed.
Alan Modra [Fri, 14 Aug 2020 10:49:39 +0000 (20:19 +0930)]
PR26388, objdump debug dump memory leaks
num_debug_info_entries is used not just as a count but also as a flag
(DEBUG_INFO_UNAVAILABLE) after some errors. That means
num_debug_info_entries can't be used when cleaning up malloc'd info.
PR 26388
* dwarf.c (free_debug_memory): Free alloc_num_debug_info_entries
of debug_information. Correct test of max_loc_offsets and
max_range_lists.
* rddbg.c (read_debugging_info): Free dhandle on error.
Alan Modra [Fri, 14 Aug 2020 00:00:22 +0000 (09:30 +0930)]
Readelf demangling test typo
Using floating point data results in cris failing the test.
* testsuite/binutils-all/mangled.s: Use dc.a rather than dc.d.
Tamar Christina [Fri, 14 Aug 2020 06:51:03 +0000 (07:51 +0100)]
AArch64: Relax thumb-plt testcases regexpr.
The regexpr in these two files are a bit strict in that they don't account for
the slight changes in tags in certain arm targets which cause our address
offsets to change. This changes the tests to allow slight movement in
locations while still strictly checking the rest.
ld/ChangeLog:
2020-08-03 Tamar Christina <tamar.christina@arm.com>
* testsuite/ld-arm/thumb-plt-got.d: Relax regexpr.
* testsuite/ld-arm/thumb-plt.d: Likewise.
GDB Administrator [Fri, 14 Aug 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Kamil Rytarowski [Thu, 13 Aug 2020 17:29:13 +0000 (19:29 +0200)]
gdb: Implement native dumpcore function for NetBSD
Define supports_dumpcore and dumpcore for NetBSD, that wraps
the ptrace(2) call with the PT_DUMPCORE operation.
gdb/ChangeLog:
* nbsd-nat.h (nbsd_nat_target::supports_dumpcore)
(nbsd_nat_target::dumpcore): New declarations.
* nbsd-nat.c (nbsd_nat_target::supports_dumpcore)
(nbsd_nat_target::dumpcore): New functions.
Kamil Rytarowski [Tue, 28 Jul 2020 15:29:35 +0000 (17:29 +0200)]
gdb: Implement native dumpcore function
Add new API for systems with native kernel support for dumping
a process on demand. Wire it into the gdb's gcore functionality.
gdb/ChangeLog:
* target.h (supports_dumpcore, dumpcore): New
function declarations.
* target.c (supports_dumpcore, dumpcore): New
functions.
* target-delegates.c: Rebuild.
* gcore.c (gcore_command): Use target_supports_dumpcore ()
and target_dumpcore ().
Aaron Merey [Thu, 13 Aug 2020 21:47:05 +0000 (17:47 -0400)]
debuginfod-support.c: Replace globals with user_data
Store query information in user_data struct instead of global variables.
gdb/ChangeLog:
* debuginfod-support.c: Replace global variables with user_data.
Pedro Alves [Thu, 13 Aug 2020 16:41:28 +0000 (17:41 +0100)]
Add skip_fortran_tests to more Fortran testcases
This adds missing skip_fortran_tests checks to Fortran testcases,
using the exact same pattern the existing files that do check it use.
gdb/testsuite/ChangeLog:
* gdb.fortran/complex.exp: Check skip_fortran_tests.
* gdb.fortran/library-module.exp: Likewise.
* gdb.fortran/logical.exp: Likewise.
* gdb.fortran/module.exp: Likewise.
* gdb.fortran/print_type.exp: Likewise.
* gdb.fortran/vla-alloc-assoc.exp: Likewise.
* gdb.fortran/vla-datatypes.exp: Likewise.
* gdb.fortran/vla-history.exp: Likewise.
* gdb.fortran/vla-ptr-info.exp: Likewise.
* gdb.fortran/vla-ptype-sub.exp: Likewise.
* gdb.fortran/vla-ptype.exp: Likewise.
* gdb.fortran/vla-sizeof.exp: Likewise.
* gdb.fortran/vla-type.exp: Likewise.
* gdb.fortran/vla-value-sub-arbitrary.exp: Likewise.
* gdb.fortran/vla-value-sub-finish.exp: Likewise.
* gdb.fortran/vla-value-sub.exp: Likewise.
* gdb.fortran/vla-value.exp: Likewise.
Pedro Alves [Thu, 13 Aug 2020 16:34:21 +0000 (17:34 +0100)]
Add skip_ada_tests to more Ada testcases
This adds missing skip_ada_tests checks to Ada testcases, using the
exact same pattern the existing files that do check it use.
gdb/testsuite/ChangeLog:
* gdb.ada/access_tagged_param.exp: Check skip_ada_tests.
* gdb.ada/access_to_packed_array.exp: Likewise.
* gdb.ada/access_to_unbounded_array.exp: Likewise.
* gdb.ada/addr_arith.exp: Likewise.
* gdb.ada/arr_acc_idx_w_gap.exp: Likewise.
* gdb.ada/arr_arr.exp: Likewise.
* gdb.ada/arr_enum_idx_w_gap.exp: Likewise.
* gdb.ada/array_bounds.exp: Likewise.
* gdb.ada/array_of_variable_length.exp: Likewise.
* gdb.ada/array_ptr_renaming.exp: Likewise.
* gdb.ada/array_subscript_addr.exp: Likewise.
* gdb.ada/arraydim.exp: Likewise.
* gdb.ada/arrayparam.exp: Likewise.
* gdb.ada/arrayptr.exp: Likewise.
* gdb.ada/assign_1.exp: Likewise.
* gdb.ada/assign_arr.exp: Likewise.
* gdb.ada/atomic_enum.exp: Likewise.
* gdb.ada/attr_ref_and_charlit.exp: Likewise.
* gdb.ada/bad-task-bp-keyword.exp: Likewise.
* gdb.ada/bias.exp: Likewise.
* gdb.ada/boolean_expr.exp: Likewise.
* gdb.ada/bp_c_mixed_case.exp: Likewise.
* gdb.ada/bp_enum_homonym.exp: Likewise.
* gdb.ada/bp_inlined_func.exp: Likewise.
* gdb.ada/bp_on_var.exp: Likewise.
* gdb.ada/bp_range_type.exp: Likewise.
* gdb.ada/bp_reset.exp: Likewise.
* gdb.ada/call_pn.exp: Likewise.
* gdb.ada/catch_assert_if.exp: Likewise.
* gdb.ada/catch_ex.exp: Likewise.
* gdb.ada/catch_ex_std.exp: Likewise.
* gdb.ada/char_enum.exp: Likewise.
* gdb.ada/char_param.exp: Likewise.
* gdb.ada/complete.exp: Likewise.
* gdb.ada/cond_lang.exp: Likewise.
* gdb.ada/convvar_comp.exp: Likewise.
* gdb.ada/dgopt.exp: Likewise.
* gdb.ada/disc_arr_bound.exp: Likewise.
* gdb.ada/display_nested.exp: Likewise.
* gdb.ada/dot_all.exp: Likewise.
* gdb.ada/dyn_loc.exp: Likewise.
* gdb.ada/dyn_stride.exp: Likewise.
* gdb.ada/excep_handle.exp: Likewise.
* gdb.ada/expr_delims.exp: Likewise.
* gdb.ada/expr_with_funcall.exp: Likewise.
* gdb.ada/exprs.exp: Likewise.
* gdb.ada/fin_fun_out.exp: Likewise.
* gdb.ada/fixed_cmp.exp: Likewise.
* gdb.ada/formatted_ref.exp: Likewise.
* gdb.ada/frame_arg_lang.exp: Likewise.
* gdb.ada/frame_args.exp: Likewise.
* gdb.ada/fullname_bp.exp: Likewise.
* gdb.ada/fun_addr.exp: Likewise.
* gdb.ada/fun_in_declare.exp: Likewise.
* gdb.ada/fun_overload_menu.exp: Likewise.
* gdb.ada/fun_renaming.exp: Likewise.
* gdb.ada/funcall_char.exp: Likewise.
* gdb.ada/funcall_param.exp: Likewise.
* gdb.ada/funcall_ptr.exp: Likewise.
* gdb.ada/funcall_ref.exp: Likewise.
* gdb.ada/homonym.exp: Likewise.
* gdb.ada/info_addr_mixed_case.exp: Likewise.
* gdb.ada/info_auto_lang.exp: Likewise.
* gdb.ada/info_exc.exp: Likewise.
* gdb.ada/info_types.exp: Likewise.
* gdb.ada/int_deref.exp: Likewise.
* gdb.ada/interface.exp: Likewise.
* gdb.ada/iwide.exp: Likewise.
* gdb.ada/lang_switch.exp: Likewise.
* gdb.ada/length_cond.exp: Likewise.
* gdb.ada/maint_with_ada.exp: Likewise.
* gdb.ada/mi_catch_assert.exp: Likewise.
* gdb.ada/mi_catch_ex.exp: Likewise.
* gdb.ada/mi_catch_ex_hand.exp: Likewise.
* gdb.ada/mi_dyn_arr.exp: Likewise.
* gdb.ada/mi_ex_cond.exp: Likewise.
* gdb.ada/mi_exc_info.exp: Likewise.
* gdb.ada/mi_interface.exp: Likewise.
* gdb.ada/mi_prot.exp: Likewise.
* gdb.ada/mi_ref_changeable.exp: Likewise.
* gdb.ada/mi_string_access.exp: Likewise.
* gdb.ada/mi_task_arg.exp: Likewise.
* gdb.ada/mi_task_info.exp: Likewise.
* gdb.ada/mi_var_array.exp: Likewise.
* gdb.ada/mi_var_union.exp: Likewise.
* gdb.ada/mi_variant.exp: Likewise.
* gdb.ada/minsyms.exp: Likewise.
* gdb.ada/mod_from_name.exp: Likewise.
* gdb.ada/nested.exp: Likewise.
* gdb.ada/null_array.exp: Likewise.
* gdb.ada/optim_drec.exp: Likewise.
* gdb.ada/out_of_line_in_inlined.exp: Likewise.
* gdb.ada/packed_array_assign.exp: Likewise.
* gdb.ada/packed_tagged.exp: Likewise.
* gdb.ada/pp-rec-component.exp: Likewise.
* gdb.ada/print_chars.exp: Likewise.
* gdb.ada/print_pc.exp: Likewise.
* gdb.ada/ptr_typedef.exp: Likewise.
* gdb.ada/ptype_arith_binop.exp: Likewise.
* gdb.ada/ptype_array.exp: Likewise.
* gdb.ada/ptype_field.exp: Likewise.
* gdb.ada/ptype_tagged_param.exp: Likewise.
* gdb.ada/ptype_union.exp: Likewise.
* gdb.ada/py_range.exp: Likewise.
* gdb.ada/py_taft.exp: Likewise.
* gdb.ada/rdv_wait.exp: Likewise.
* gdb.ada/rec_comp.exp: Likewise.
* gdb.ada/rec_return.exp: Likewise.
* gdb.ada/ref_param.exp: Likewise.
* gdb.ada/ref_tick_size.exp: Likewise.
* gdb.ada/rename_subscript_param.exp: Likewise.
* gdb.ada/repeat_dyn.exp: Likewise.
* gdb.ada/same_component_name.exp: Likewise.
* gdb.ada/same_enum.exp: Likewise.
* gdb.ada/scalar_storage.exp: Likewise.
* gdb.ada/set_wstr.exp: Likewise.
* gdb.ada/small_reg_param.exp: Likewise.
* gdb.ada/str_binop_equal.exp: Likewise.
* gdb.ada/str_ref_cmp.exp: Likewise.
* gdb.ada/str_uninit.exp: Likewise.
* gdb.ada/sub_variant.exp: Likewise.
* gdb.ada/sym_print_name.exp: Likewise.
* gdb.ada/taft_type.exp: Likewise.
* gdb.ada/tagged.exp: Likewise.
* gdb.ada/tagged_access.exp: Likewise.
* gdb.ada/task_bp.exp: Likewise.
* gdb.ada/task_switch_in_core.exp: Likewise.
* gdb.ada/tasks.exp: Likewise.
* gdb.ada/tick_last_segv.exp: Likewise.
* gdb.ada/tick_length_array_enum_idx.exp: Likewise.
* gdb.ada/type_coercion.exp: Likewise.
* gdb.ada/unc_arr_ptr_in_var_rec.exp: Likewise.
* gdb.ada/unchecked_union.exp: Likewise.
* gdb.ada/uninitialized_vars.exp: Likewise.
* gdb.ada/var_arr_attrs.exp: Likewise.
* gdb.ada/var_arr_typedef.exp: Likewise.
* gdb.ada/var_rec_arr.exp: Likewise.
* gdb.ada/variant-record.exp: Likewise.
* gdb.ada/variant.exp: Likewise.
* gdb.ada/variant_record_packed_array.exp: Likewise.
* gdb.ada/varsize_limit.exp: Likewise.
* gdb.ada/whatis_array_val.exp: Likewise.
* gdb.ada/widewide.exp: Likewise.
* gdb.ada/win_fu_syms.exp: Likewise.
Luis Machado [Thu, 13 Aug 2020 13:32:52 +0000 (10:32 -0300)]
[ARM, sim] Fix build failure with -Werror (PR26365)
There is a bit of a situation in the ARM sim with regards to the handling
of argv. sim_open () gets a const char **argv, but ARM's sim_open gets
clever and decides to modify argv in place via sim_target_parse_command_line.
I'm not sure why.
In any case, here's a fix that makes the code modify a copy of argv instead.
sim/arm/ChangeLog:
2020-08-13 Luis Machado <luis.machado@linaro.org>
PR sim/26365
* wrapper.c (sim_target_parse_command_line): Free discarded argv
entries.
(sim_open): Use a duplicate of argv instead of the original argv.
Simon Marchi [Thu, 13 Aug 2020 11:55:48 +0000 (07:55 -0400)]
gdb: allow specifying multiple filters when running selftests
I found myself wanting to run a few specific selftests while developing.
I thought it would be nice to be able to provide multiple test names
when running `maintenant selftests`. The arguments to that command is
currently interpreted as a single filter (not split by spaces), it now
becomes a list a filters, split by spaces. A test is executed when it
matches at least one filter.
Here's an example of the result in GDB:
(gdb) maintenance selftest xml
Running selftest xml_escape_text.
Running selftest xml_escape_text_append.
Ran 2 unit tests, 0 failed
(gdb) maintenance selftest xml unord
Running selftest unordered_remove.
Running selftest xml_escape_text.
Running selftest xml_escape_text_append.
Ran 3 unit tests, 0 failed
(gdb) maintenance selftest xml unord foobar
Running selftest unordered_remove.
Running selftest xml_escape_text.
Running selftest xml_escape_text_append.
Ran 3 unit tests, 0 failed
Since the selftest machinery is also shared with gdbserver, I also
adapted gdbserver. It accepts a `--selftest` switch, which accepts an
optional filter argument. I made it so you can now pass `--selftest`
multiple time to add filters.
It's not so useful right now though: there's only a single selftest
right now in GDB and it's for an architecture I can't compile. So I
tested by adding dummy tests, here's an example of the result:
$ ./gdbserver --selftest=foo
Running selftest foo.
foo
Running selftest foobar.
foobar
Ran 2 unit tests, 0 failed
$ ./gdbserver --selftest=foo --selftest=bar
Running selftest bar.
bar
Running selftest foo.
foo
Running selftest foobar.
foobar
Ran 3 unit tests, 0 failed
gdbsupport/ChangeLog:
* selftest.h (run_tests): Change parameter to array_view.
* selftest.c (run_tests): Change parameter to array_view and use
it.
gdb/ChangeLog:
* maint.c (maintenance_selftest): Split args and pass array_view
to run_tests.
gdbserver/ChangeLog:
* server.cc (captured_main): Accept multiple `--selftest=`
options. Pass all `--selftest=` arguments to run_tests.
Change-Id: I422bd49f08ea8095ae174c5d66a2dd502a59613a
Nick Clifton [Thu, 13 Aug 2020 10:50:13 +0000 (11:50 +0100)]
Fix an internal compiler error when attempting to create a second $GDB_DEBUG$ section.
PR 26359
* config/obj-som.c (obj_som_init_stab_section): Do nothing if the
$GDB_DEBUG$ section has already been created.
Alan Modra [Thu, 13 Aug 2020 04:43:43 +0000 (14:13 +0930)]
Obsolete ia64
* config.bfd: Obsolete ia64*-*-*.
Alan Modra [Thu, 13 Aug 2020 00:28:13 +0000 (09:58 +0930)]
Obsolete arm-symbianelf
* config.bfd: Obsolete arm*-*-symbianelf*.
GDB Administrator [Thu, 13 Aug 2020 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 12 Aug 2020 14:01:28 +0000 (23:31 +0930)]
PowerPC64 --no-pcrel-optimize
This new option effectively ignores R_PPC64_PCREL_OPT, disabling the
optimization of instructions marked by that relocation. The patch
also disables GOT indirect to GOT/TOC pointer relative code editing
when --no-toc-optimize.
bfd/
* elf64-ppc.h (struct ppc64_elf_params): Add no_pcrel_opt.
* elf64-ppc.c (ppc64_elf_relocate_section): Disable GOT reloc
optimizations when --no-toc-optimize. Disable R_PPC64_PCREL_OPT
optimization when --no-pcrel-optimize.
ld/
* emultempl/ppc64elf.em (params): Init new field.
(enum ppc64_opt): Add OPTION_NO_PCREL_OPT.
(PARSE_AND_LIST_LONGOPTS, PARSE_AND_LIST_OPTIONS),
(PARSE_AND_LIST_ARGS_CASES): Support --no-pcrel-optimize.
Alan Modra [Wed, 12 Aug 2020 10:48:43 +0000 (20:18 +0930)]
PR26348, Malloc error in write_zeros
This adds a few more sanity checks on ELF objects, and a BFD flag to
disable objcopy and strip when fuzzed input files belong in the "too
hard" basket.
bfd/
PR 26348
* bfd.c (struct bfd): Add read_only.
* elfcode.h (elf_swap_shdr_in): Test both sh_offset and sh_size.
Set read_only on warning.
(elf_object_p): Sanity check program header alignment. Set
read_only on warning.
* bfd-in2.h: Regenerate.
binutils/
PR 26348
* objcopy.c (copy_object): Report file name with endian error.
Error and return on abfd->read_only.