GDB Administrator [Sat, 7 Dec 2019 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Luis Machado [Tue, 26 Nov 2019 15:52:56 +0000 (12:52 -0300)]
[ARM, sim] Fix build error and warnings
Newer GCC's have switched to -fno-common by default, and this breaks the build
for the ARM sim, like this:
binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:65: multiple definition of `DSPsc'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:134: first defined here
binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:64: multiple definition of `DSPacc'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:133: first defined here
binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:63: multiple definition of `DSPregs'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:132: first defined here
I also noticed a few warnings due to mismatching types, as follows:
../../../../repos/binutils-gdb/sim/arm/wrapper.c: In function ‘sim_create_inferior’:
../../../../repos/binutils-gdb/sim/arm/wrapper.c:335:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
for (arg = argv; *arg != NULL; arg++)
^
../../../../repos/binutils-gdb/sim/arm/wrapper.c:342:8: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
arg = argv;
^
../../../../repos/binutils-gdb/sim/arm/wrapper.c:345:13: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
for (arg = argv; *arg != NULL; arg++)
^
The following patch fixes both of the above.
sim/arm/ChangeLog:
2019-12-06 Luis Machado <luis.machado@linaro.org>
* armemu.c (isize): Move this declaration ...
* arminit.c (isize): ... here.
* maverick.h: New file.
* wrapper.c: Include "maverick.h".
(<struct maverick_regs>, <union maverick_acc_regs>): Remove and update
comment.
(sim_create_inferior): Cast variables to proper type.
* maverick.c: Include "maverick.h".
(<struct maverick_regs>, <union maverick_acc_regs>): Move
declarations to maverick.h and update comment.
(DSPsc, DSPacc, DSPregs): Adjust comment.
Change-Id: I21db699d3b61b2de8c44053e47be4387285af28f
Christian Biesinger [Mon, 2 Dec 2019 21:05:54 +0000 (15:05 -0600)]
Put bcache inside "namespace gdb"
This avoids a conflict with a system "struct bcache" on
Solaris (see e.g.
https://www.isi.edu/nsnam/archive/ns-users/webarch/2001/msg05393.html)
Note that the Solaris conflict for now only surfaces with
--enable-targets=all (which the build bot doesn't use).
gdb/ChangeLog:
2019-12-06 Christian Biesinger <cbiesinger@google.com>
* bcache.c: Put in namespace gdb.
* bcache.h: Likewise.
* gdbtypes.c (check_types_worklist): Update.
(types_deeply_equal): Update.
* macrotab.c (struct macro_table) <bcache>: Update.
(new_macro_table): Update.
* macrotab.h (struct bcache): Put this forward declaration
inside namespace gdb.
(new_macro_table): Update.
* objfiles.h (struct objfile_per_bfd_storage) <filename_cache>:
Update.
<macro_cache>: Update.
* psymtab.h: (psymtab_storage) <psymbol_cache>: Update.
Change-Id: I843d5e91f7ccb3db6d1099a8214c15a74510256f
Tom de Vries [Fri, 6 Dec 2019 17:51:49 +0000 (18:51 +0100)]
[gdb/symtab] Prefer var def over decl
Consider the DWARF as generated by gcc with the tentative patch to fix gcc
PR91507 - "wrong debug for completed array with previous incomplete
declaration":
...
<1><f4>: Abbrev Number: 2 (DW_TAG_array_type)
<f5> DW_AT_type : <0xff>
<f9> DW_AT_sibling : <0xff>
<2><fd>: Abbrev Number: 3 (DW_TAG_subrange_type)
<2><fe>: Abbrev Number: 0
<1><ff>: Abbrev Number: 4 (DW_TAG_pointer_type)
<100> DW_AT_byte_size : 8
<101> DW_AT_type : <0x105>
<1><105>: Abbrev Number: 5 (DW_TAG_base_type)
<106> DW_AT_byte_size : 1
<107> DW_AT_encoding : 6 (signed char)
<108> DW_AT_name : (indirect string, offset: 0x19f): char
<1><10c>: Abbrev Number: 6 (DW_TAG_variable)
<10d> DW_AT_name : zzz
<111> DW_AT_decl_file : 1
<112> DW_AT_decl_line : 1
<113> DW_AT_decl_column : 14
<114> DW_AT_type : <0xf4>
<118> DW_AT_external : 1
<118> DW_AT_declaration : 1
<1><118>: Abbrev Number: 2 (DW_TAG_array_type)
<119> DW_AT_type : <0xff>
<11d> DW_AT_sibling : <0x128>
<1><12f>: Abbrev Number: 8 (DW_TAG_variable)
<130> DW_AT_specification: <0x10c>
<134> DW_AT_decl_line : 2
<135> DW_AT_decl_column : 7
<136> DW_AT_type : <0x118>
<13a> DW_AT_location : 9 byte block: 3 30 10 60 0 0 0 0 0 (DW_OP_addr: 601030)
...
The DWARF will result in two entries in the symbol table, a decl with type
char *[] and a def with type char*[2].
When trying to print the value of zzz:
...
$ gdb a.spec.out -batch -ex "p zzz"
...
the decl (rather than the def) will be found in the symbol table, which is
missing the location information, and consequently we get:
...
$1 = 0x601030 <zzz>
...
[ There is a fallback mechanism that finds the address of the variable in the
minimal symbol table, but that's not used here, because the type of the decl
does not specify a size. We could use the symbol size here to get the size
of the type, but that's currently not done: PR exp/24989. Still, fixing that
PR would not fix the generic case, where minimal symbol info is not
available. ]
Fix this by preferring defs over decls when searching in the symbol table.
Build and reg-tested on x86_64-linux.
gdb/ChangeLog:
2019-12-06 Tom de Vries <tdevries@suse.de>
PR symtab/24971
* block.c (best_symbol, better_symbol): New function.
(block_lookup_symbol_primary, block_lookup_symbol): Prefer def over
decl.
gdb/testsuite/ChangeLog:
2019-12-06 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/varval.exp: Add decl before def test.
Change-Id: Id92326cb8ef9903b121ef9e320658eb565d0f5a9
Kyrylo Tkachov [Fri, 6 Dec 2019 10:46:32 +0000 (10:46 +0000)]
[gas] Implement .cfi_negate_ra_state directive
This patch implements the .cfi_negate_ra_state to be consistent with
LLVM (https://reviews.llvm.org/D50136). The relevant DWARF code DW_CFA_AARCH64_negate_ra_state
is multiplexed on top of DW_CFA_GNU_window_save, as per
https://gcc.gnu.org/ml/gcc-patches/2017-08/msg00753.html
I believe this is the simplest patch implementing this and is needed to
allow users to build, for example, the Linux kernel with Armv8.3-A
pointer authentication support with Clang while using gas as the
assembler, which is a common usecase.
gas/
2019-12-06 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* dw2gencfi.c (cfi_pseudo_table): Add cfi_negate_ra_state.
* testsuite/gas/aarch64/pac_negate_ra_state.s: New file.
* testsuite/gas/aarch64/pac_negate_ra_state.d: Likewise.
Alan Modra [Fri, 6 Dec 2019 03:08:42 +0000 (13:38 +1030)]
Re: Only give FDE encoding warnings if --eh-frame-hdr was specified.
For mips*-linux targets, fixes the following fails.
FAIL: MIPS eh-frame 1, n32
FAIL: MIPS eh-frame 1, n64
FAIL: MIPS eh-frame 2, n32
FAIL: MIPS eh-frame 2, n64
* testsuite/ld-mips-elf/eh-frame1-n32.d: Pass --eh-frame-hdr to ld.
* testsuite/ld-mips-elf/eh-frame1-n64.d: Likewise.
* testsuite/ld-mips-elf/eh-frame2-n32.d: Likewise.
* testsuite/ld-mips-elf/eh-frame2-n64.d: Likewise.
Tankut Baris Aktemur [Tue, 12 Nov 2019 15:06:29 +0000 (16:06 +0100)]
gdb/testsuite: do minor clean-up in gdb.cp/rvalue-ref-overload.exp
Simplify the expected test outputs. This is a minor cleanup; no
functional change is intended.
gdb/testsuite/ChangeLog:
2019-12-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* gdb.cp/rvalue-ref-overload.exp: Minor cleanup.
Change-Id: Ie760a2856cae3be0eeed5496765a5f1cd102d6b7
Tankut Baris Aktemur [Tue, 12 Nov 2019 14:12:43 +0000 (15:12 +0100)]
gdb: fix overload resolution for see-through references
The overload resolution mechanism assigns badness values to the
necessary conversions to be made on types to pick a champion. A
badness value consists of a "rank" that scores the conversion and a
"subrank" to differentiate conversions of the same kind.
An auxiliary function, 'sum_ranks', is used for adding two badness
values. In all of its uses, except two, 'sum_ranks' is used for
populating the subrank of a badness value. The two exceptions are in
'rank_one_type':
~~~
/* See through references, since we can almost make non-references
references. */
if (TYPE_IS_REFERENCE (arg))
return (sum_ranks (rank_one_type (parm, TYPE_TARGET_TYPE (arg), NULL),
REFERENCE_CONVERSION_BADNESS));
if (TYPE_IS_REFERENCE (parm))
return (sum_ranks (rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL),
REFERENCE_CONVERSION_BADNESS));
~~~
Here, the result of a recursive call is combined with
REFERENCE_CONVERSION_BADNESS. This leads to the problem of
over-punishment by combining two ranks. Consider this:
void an_overloaded_function (const foo &);
void an_overloaded_function (const foo &&);
...
foo arg;
an_overloaded_function(arg);
When ranking 'an_overloaded_function (const foo &)', the badness
values REFERENCE_CONVERSION_BADNESS and CV_CONVERSION_BADNESS are
combined, whereas 'rank_one_type' assigns only the
REFERENCE_CONVERSION_BADNESS value to 'an_overloaded_function (const
foo &&)' (there is a different execution flow for that). This yields
in GDB picking the latter function as the overload champion instead of
the former.
In fact, the 'rank_one_type' function should have given
'an_overloaded_function (const foo &)' the CV_CONVERSION_BADNESS
value, with the see-through referencing increasing the subrank a
little bit. This can be achieved by introducing a new badness value,
REFERENCE_SEE_THROUGH_BADNESS, which bumps up the subrank only, and
using it in the two "exceptional" cases of 'sum_ranks'.
gdb/ChangeLog:
2019-12-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* gdbtypes.h: Define the REFERENCE_SEE_THROUGH_BADNESS value.
* gdbtypes.c (rank_one_type): Use REFERENCE_SEE_THROUGH_BADNESS
for ranking see-through reference cases.
gdb/testsuite/ChangeLog:
2019-12-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* gdb.cp/rvalue-ref-overload.cc: Add a case that involves both
CV and reference conversion for overload resolution.
* gdb.cp/rvalue-ref-overload.exp: Test it.
Change-Id: I39ae6505ab85ad0bd21915368c82540ceeb3aae9
Philippe Waroquiers [Thu, 5 Dec 2019 22:41:58 +0000 (23:41 +0100)]
Fix crash when command arg is missing in faas/taas/tfaas commands.
GDB crashes when doing:
(gdb) faas
Aborted
Do the needed check to avoid crashing.
gdb/ChangeLog
2019-12-06 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* stack.c (faas_command): Check a command is provided.
* thread.c (taas_command, tfaas_command): Likewise.
gdb/testsuite/ChangeLog
2019-12-06 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.threads/pthreads.exp: Test taas and tfaas without command.
* gdb.base/frameapply.exp: Test faas without command.
GDB Administrator [Fri, 6 Dec 2019 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Sun, 1 Dec 2019 14:40:17 +0000 (15:40 +0100)]
Fix leaks when pruning inferiors.
Valgrind detects various inferior related leaks, such as:
==31877== 5,530 (56 direct, 5,474 indirect) bytes in 1 blocks are definitely lost in loss record 7,131 of 7,355
==31877== at 0x4C2E18C: calloc (vg_replace_malloc.c:760)
==31877== by 0x23E580: xcalloc (alloc.c:100)
==31877== by 0x4794A9: xcnewvec<void*> (poison.h:158)
==31877== by 0x4794A9: registry_alloc_data(registry_data_registry*, registry_fields*) (registry.c:51)
==31877== by 0x3A537C: inferior_alloc_data (inferior.c:43)
==31877== by 0x3A537C: inferior::inferior(int) (inferior.c:92)
==31877== by 0x3A5426: add_inferior_silent(int) (inferior.c:98)
==31877== by 0x3A5530: add_inferior(int) (inferior.c:122)
...
Origin of the leaks is in prune_inferiors: prune_inferiors is first removing
the inferior to prune from the inferior list, then calls delete_inferior.
But delete_inferior will only really destroy the inferior when it finds
it into the inferior list.
As delete_inferior is removing the inferior to delete from the inferior list,
ensure prune_inferiors only calls delete_inferior, without touching the
inferior list.
gdb/ChangeLog
2019-12-05 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* inferior.c (prune_inferiors): Only call delete_inferior.
Do not modify the inferior list.
Sandra Loosemore [Thu, 5 Dec 2019 21:20:12 +0000 (13:20 -0800)]
Only give FDE encoding warnings if --eh-frame-hdr was specified.
This bug was observed on nios2-linux-gnu with some C++ programs
linked with -pie or -shared. The nios2 ABI doesn't include appropriate
relocations in this instance and GCC is also being patched not to pass
--eh-frame-hdr to the linker in those cases.
2019-12-05 Sandra Loosemore <sandra@codesourcery.com>
bfd/
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Make
FDE encoding warning conditional.
Simon Marchi [Thu, 5 Dec 2019 18:44:30 +0000 (13:44 -0500)]
Remove gdbarch parameter of lookup_typename
I noticed that the gdbarch parameter of lookup_typename was unused, so I
removed it (as well as from lookup_signed_typename and
lookup_unsigned_typename) and updated all callers.
Tested by rebuilding.
gdb/ChangeLog:
* c-exp.y: Update calls to lookup_typename,
lookup_signed_typename and lookup_unsigned_typename.
* c-lang.c (evaluate_subexp_c): Likewise.
* cp-namespace.c (cp_lookup_symbol_imports_or_template):
Likewise.
* eval.c (binop_promote): Likewise.
* gdbtypes.c (lookup_typename): Remove gdbarch parameter.
(lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
* gdbtypes.h (lookup_unsigned_typename): Likewise.
(lookup_signed_typename): Likewise.
(lookup_typename): Likewise.
* guile/scm-type.c (tyscm_lookup_typename): Update calls to
lookup_typename, lookup_signed_typename,
lookup_unsigned_typename.
* m2-exp.y: Likewise.
* printcmd.c (printf_wide_c_string): Likewise.
(ui_printf): Likewise.
* python/py-type.c (typy_lookup_typename): Likewise.
* python/py-xmethods.c (python_xmethod_worker::invoke):
Likewise.
* rust-exp.y: Likewise.
Nick Clifton [Thu, 5 Dec 2019 13:56:07 +0000 (13:56 +0000)]
Fix a problem computing the size fields in the PE format header.
PR 25029
* peXXigen.c (_bfd_XXi_swap_aouthdr_out): Ignore empty sections
when computing the sizes stored in the headers.
Alan Modra [Thu, 5 Dec 2019 10:59:21 +0000 (21:29 +1030)]
Re: PR25244, --print-memory-usage, division by zero if MEMORY length is zero
Do print the linefeed when length is zero.
PR 25244
* ldlang.c (lang_print_memory_usage): Correct last patch.
Jan Beulich [Thu, 5 Dec 2019 07:44:22 +0000 (08:44 +0100)]
Arm64: simplify Crypto arch extension handling
This, at the assembler level, is just a "brace" feature covering both
AES and SHA2. Hence there's no need for it to have a separate feature
flag, freeing up a bit for future re-use. Along these lines there are
also a number of dead definitions/variables in the opcode table file.
Jan Beulich [Thu, 5 Dec 2019 07:43:03 +0000 (08:43 +0100)]
Arm64: correct "sha3" arch-extension directive handling
SHA2 is a prereq to SHA3, not part of it aiui. Hence disabling the
latter should not also disable the former.
In the course of adding respective tests also do away with the
duplication of crypto.d's contents in crypto-directive.d.
Alan Modra [Thu, 5 Dec 2019 06:10:02 +0000 (16:40 +1030)]
PR25243, static linking with exceptions and iostream is broken on ARM
PR 25243
* emulparams/armelf.sh (OTHER_READONLY_SECTIONS): Move definition
of __exidx_start and __exidx_end into ARM.exidx.
* emulparams/armelf_linux_eabi.sh (OTHER_READONLY_SECTIONS): Likewise.
* emulparams/armsymbian.sh (OTHER_READONLY_SECTIONS): Similarly.
* emulparams/elf32_tic6x_le.sh (OTHER_READONLY_SECTIONS): Similarly.
* emulparams/armelf_fuchsia.sh: Source armelf_linux_eabi.sh,
just redefining TEXT_START_ADDR.
* emulparams/armelf_linux_fdpiceabi.sh: Source armelf_linux_eabi.sh,
adding to OTHER_READONLY_SECTIONS.
Alan Modra [Thu, 5 Dec 2019 06:07:25 +0000 (16:37 +1030)]
PR25244, --print-memory-usage, division by zero if MEMORY length is zero
PR 25244
* ldlang.c (lang_print_memory_usage): Don't print percent used
when length is zero.
Alan Modra [Thu, 5 Dec 2019 04:12:44 +0000 (14:42 +1030)]
PR25249, Memory leak in microblaze-dis.c
PR 25249
* microblaze-dis.c (NUM_STRBUFS, STRBUF_SIZE): Define.
(struct string_buf): New.
(strbuf): New function.
(get_field): Use strbuf rather than strdup of local temp.
(get_field_imm, get_field_imm5, get_field_imm5_mbar): Likewise.
(get_field_rfsl, get_field_imm15): Likewise.
(get_field_rd, get_field_r1, get_field_r2): Update macros.
(get_field_special): Likewise. Don't strcpy spr. Formatting.
(print_insn_microblaze): Formatting. Init and pass string_buf to
get_field functions.
GDB Administrator [Thu, 5 Dec 2019 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Fri, 22 Nov 2019 17:03:15 +0000 (11:03 -0600)]
Fix (most) OpenBSD link errors
This fixes these errors:
ld: error: undefined symbol: x86_stopped_by_hw_breakpoint()
>>> referenced by x86-nat.h:109 (../../gdb/x86-nat.h:109)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::stopped_by_hw_breakpoint())
ld: error: undefined symbol: x86_can_use_hw_breakpoint(bptype, int, int)
>>> referenced by x86-nat.h:76 (../../gdb/x86-nat.h:76)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::can_use_hw_breakpoint(bptype, int, int))
ld: error: undefined symbol: x86_insert_hw_breakpoint(gdbarch*, bp_target_info*)
>>> referenced by x86-nat.h:93 (../../gdb/x86-nat.h:93)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::insert_hw_breakpoint(gdbarch*, bp_target_info*))
ld: error: undefined symbol: x86_remove_hw_breakpoint(gdbarch*, bp_target_info*)
>>> referenced by x86-nat.h:97 (../../gdb/x86-nat.h:97)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::remove_hw_breakpoint(gdbarch*, bp_target_info*))
ld: error: undefined symbol: x86_remove_watchpoint(unsigned long, int, target_hw_bp_type, expression*)
>>> referenced by x86-nat.h:89 (../../gdb/x86-nat.h:89)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::remove_watchpoint(unsigned long, int, target_hw_bp_type, expression*))
ld: error: undefined symbol: x86_insert_watchpoint(unsigned long, int, target_hw_bp_type, expression*)
>>> referenced by x86-nat.h:84 (../../gdb/x86-nat.h:84)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::insert_watchpoint(unsigned long, int, target_hw_bp_type, expression*))
ld: error: undefined symbol: x86_stopped_by_watchpoint()
>>> referenced by x86-nat.h:100 (../../gdb/x86-nat.h:100)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::stopped_by_watchpoint())
ld: error: undefined symbol: x86_stopped_data_address(unsigned long*)
>>> referenced by x86-nat.h:103 (../../gdb/x86-nat.h:103)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::stopped_data_address(unsigned long*))
ld: error: undefined symbol: x86_region_ok_for_hw_watchpoint(unsigned long, int)
>>> referenced by x86-nat.h:79 (../../gdb/x86-nat.h:79)
>>> amd64-obsd-nat.o:(x86_nat_target<obsd_nat_target>::region_ok_for_hw_watchpoint(unsigned long, int))
and
ld: error: undefined symbol: x86_dr_insert_watchpoint(x86_debug_reg_state*, target_hw_bp_type, unsigned long, int)
>>> referenced by x86-nat.c:156 (../../gdb/x86-nat.c:156)
>>> x86-nat.o:(x86_insert_watchpoint(unsigned long, int, target_hw_bp_type, expression*))
ld: error: undefined symbol: x86_dr_remove_watchpoint(x86_debug_reg_state*, target_hw_bp_type, unsigned long, int)
>>> referenced by x86-nat.c:169 (../../gdb/x86-nat.c:169)
>>> x86-nat.o:(x86_remove_watchpoint(unsigned long, int, target_hw_bp_type, expression*))
ld: error: undefined symbol: x86_dr_region_ok_for_watchpoint(x86_debug_reg_state*, unsigned long, int)
>>> referenced by x86-nat.c:181 (../../gdb/x86-nat.c:181)
>>> x86-nat.o:(x86_region_ok_for_hw_watchpoint(unsigned long, int))
ld: error: undefined symbol: x86_dr_stopped_data_address(x86_debug_reg_state*, unsigned long*)
>>> referenced by x86-nat.c:194 (../../gdb/x86-nat.c:194)
>>> x86-nat.o:(x86_stopped_data_address(unsigned long*))
ld: error: undefined symbol: x86_dr_stopped_by_watchpoint(x86_debug_reg_state*)
>>> referenced by x86-nat.c:206 (../../gdb/x86-nat.c:206)
>>> x86-nat.o:(x86_stopped_by_watchpoint())
ld: error: undefined symbol: x86_dr_insert_watchpoint(x86_debug_reg_state*, target_hw_bp_type, unsigned long, int)
>>> referenced by x86-nat.c:219 (../../gdb/x86-nat.c:219)
>>> x86-nat.o:(x86_insert_hw_breakpoint(gdbarch*, bp_target_info*))
ld: error: undefined symbol: x86_dr_remove_watchpoint(x86_debug_reg_state*, target_hw_bp_type, unsigned long, int)
>>> referenced by x86-nat.c:233 (../../gdb/x86-nat.c:233)
>>> x86-nat.o:(x86_remove_hw_breakpoint(gdbarch*, bp_target_info*))
ld: error: undefined symbol: x86_dr_stopped_by_hw_breakpoint(x86_debug_reg_state*)
>>> referenced by x86-nat.c:269 (../../gdb/x86-nat.c:269)
>>> x86-nat.o:(x86_stopped_by_hw_breakpoint())
It does not fix:
ld: error: can't create dynamic relocation R_X86_64_64 against symbol: __gmp_binvert_limb_table in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /usr/local/lib/libgmp.a(mp_minv_tab.o)
>>> referenced by tmp-dive_1.s
>>> dive_1.o:(__gmpn_divexact_1) in archive /usr/local/lib/libgmp.a
ld: error: can't create dynamic relocation R_X86_64_64 against symbol: __gmp_binvert_limb_table in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /usr/local/lib/libgmp.a(mp_minv_tab.o)
>>> referenced by tmp-bdiv_q_1.s
>>> bdiv_q_1.o:(__gmpn_bdiv_q_1) in archive /usr/local/lib/libgmp.a
ld: error: can't create dynamic relocation R_X86_64_64 against symbol: __gmpn_invert_limb_table in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /usr/local/lib/libgmp.a(invert_limb_table.o)
>>> referenced by tmp-invert_limb.s
>>> invert_limb.o:(__gmpn_invert_limb) in archive /usr/local/lib/libgmp.a
gdb/ChangeLog:
2019-12-04 Christian Biesinger <cbiesinger@google.com>
* configure.nat (obsd64): Add missing files x86-nat.o and
nat/x86-dregs.o.
Change-Id: I4a443c0cf805efd7b45feaabd729a01b07772724
Tom Tromey [Tue, 3 Dec 2019 00:17:45 +0000 (17:17 -0700)]
Use metadata style in a few more places
I happened to find a few more spots that should use metadata style,
but do not. I missed these in my earlier search somehow. This patch
also adds gettext markup in a couple of spots where it was missing.
gdb/ChangeLog
2019-12-04 Tom Tromey <tom@tromey.com>
* valprint.c (val_print_string): Use metadata_style.
* go-valprint.c (print_go_string): Use metadata style.
* p-valprint.c (pascal_object_print_static_field): Use metadata
style.
* cp-valprint.c (cp_print_static_field): Use metadata style.
Change-Id: Id82ca2aa306c6694b111d5c92dfa6f0cce919ebf
Andrew Burgess [Wed, 27 Nov 2019 21:51:35 +0000 (21:51 +0000)]
gdb/testsuite: Use -J option when compiling Fortran tests
When compiling Fortran tests (e.g. gdb.fortran/info-modules.exp), the
Fotran compile produces .mod files. These files contain details of
compiled modules that are then consumed by the compiler when compiling
other files that USE a module.
Currently the compiler writes the .mod files into its current
directory, so for us this turns out to be 'build/gdb/testsuite/'.
This means that .mod files can be shared between tests, which seems
against the spirit of the GDB testsuite; source files should be
compiled fresh for each test.
This commit adds the -J option to the compiler flags whenever we
compile a Fortran file, this option tells the compiler where to write,
and look for, .mod files.
After this commit there was one Fortran test that needed fixing, with
that fix in place all of the Fortran tests pass again, but now the
.mod files are now produced in the per-test output directories.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_compile): Add -J compiler option when building
Fortran tests.
* gdb.mi/mi-fortran-modules.exp: Compile source files in correct
order.
Change-Id: I99444cf22d80e320093d3f3ed9abb8825f378e0b
Andrew Burgess [Tue, 3 Dec 2019 10:52:05 +0000 (10:52 +0000)]
gdb/fortran: Support for single/double type modifiers
Extend the Fortran parser to support 'single precision' and 'double
precision' types as well 'single complex' and 'double complex' types.
gdb/ChangeLog:
* f-exp.y (COMPLEX_KEYWORD, SINGLE, DOUBLE, PRECISION): New
tokens.
(typebase): New patterns for complex, single/double precision, and
single/double complex.
(f77_keywords): Change token for complex keyword, and add single,
double, and precision keywords.
gdb/testsuite/ChangeLog:
* gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Handle
casting to type with no kind specified.
(test_basic_parsing_of_type_kinds): Additional tests for types
with no kind specified, and add tests for single/double
precision/complex types.
Change-Id: I9c82f4d392c58607747bd08862c1ee330723a1ba
Simon Marchi [Wed, 4 Dec 2019 18:35:46 +0000 (13:35 -0500)]
Fix doc of AVR-specific command "info io_registers"
Running the selftests on an all-targets build, I get:
Running selftest help_doc_invariants.
help doc broken invariant: command 'info io_registers' help doc first line is not terminated with a '.' character
Self test failed: self-test failed at /home/simark/src/binutils-gdb/gdb/unittests/help-doc-selftests.c:95
Add a period at the end of the doc of that command, and make it a bit
nicer in general.
gdb/ChangeLog:
* avr-tdep.c (_initialize_avr_tdep): Improve help of command
"info io_registers".
Simon Marchi [Wed, 4 Dec 2019 18:35:32 +0000 (13:35 -0500)]
Fix regcache::cooked_read_test selftest for mep
When running the regcache::cooked_read_test selftest in an all targets
build, I get the following internal error:
/home/simark/src/binutils-gdb/gdb/thread.c:95: internal-error: thread_info* inferior_thread(): Assertion `tp' failed.
The stack trace is the followiing:
#9 0x000055fe25584a52 in internal_error (file=0x55fe27a25fe0 "/home/simark/src/binutils-gdb/gdb/thread.c", line=95, fmt=0x55fe27a25c80 "%s: Assertion `%s' failed.")
at /home/simark/src/binutils-gdb/gdb/gdbsupport/errors.c:55
#10 0x000055fe260674bc in inferior_thread () at /home/simark/src/binutils-gdb/gdb/thread.c:95
#11 0x000055fe25c62f0f in get_current_regcache () at /home/simark/src/binutils-gdb/gdb/regcache.c:372
#12 0x000055fe2594fcf1 in current_options () at /home/simark/src/binutils-gdb/gdb/mep-tdep.c:873
#13 0x000055fe2594ff08 in mep_register_name (gdbarch=0x62100056f510, regnr=152) at /home/simark/src/binutils-gdb/gdb/mep-tdep.c:958
#14 0x000055fe25950112 in mep_register_reggroup_p (gdbarch=0x62100056f510, regnum=152, group=0x55fe2924d540 <save_group>) at /home/simark/src/binutils-gdb/gdb/mep-tdep.c:1029
#15 0x000055fe2555ad87 in gdbarch_register_reggroup_p (gdbarch=0x62100056f510, regnum=152, reggroup=0x55fe2924d540 <save_group>) at /home/simark/src/binutils-gdb/gdb/gdbarch.c:3622
#16 0x000055fe25c61d45 in reg_buffer::save(gdb::function_view<register_status (int, unsigned char*)>) (this=0x7ffc61a0ed90, cooked_read=...)
at /home/simark/src/binutils-gdb/gdb/regcache.c:247
#17 0x000055fe2552ac60 in readonly_detached_regcache::readonly_detached_regcache(gdbarch*, gdb::function_view<register_status (int, unsigned char*)>) (this=0x7ffc61a0ed90,
gdbarch=0x62100056f510, cooked_read=...) at /home/simark/src/binutils-gdb/gdb/regcache.h:444
#18 0x000055fe25c61867 in readonly_detached_regcache::readonly_detached_regcache (this=0x7ffc61a0ed90, src=...) at /home/simark/src/binutils-gdb/gdb/regcache.c:212
#19 0x000055fe25c6a5ca in selftests::cooked_read_test (gdbarch=0x62100056f510) at /home/simark/src/binutils-gdb/gdb/regcache.c:1613
The problems is that mep's code ends up calling inferior_thread, which
calls find_thread_ptid. find_thread_ptid searches for a thread by ptid
in the thread list of the inferior that is expected to contain that
thread.
However, the thread list of the mock inferior set up in cooked_read_test
is never initialized. So find_thread_ptid doesn't find the thread,
which is an unexpected situation for inferior_thread.
This is failing since this commit:
080363310650c93ad8e93018bcb6760ba5d32d1c
Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc.
Fix it by putting the mock thread in the thread list of the mock
inferior in cooked_read_test.
gdb/ChangeLog:
* regcache.c (cooked_read_test): Initialize thread list of
mock_inferior.
Simon Marchi [Wed, 4 Dec 2019 18:33:02 +0000 (13:33 -0500)]
Remove unused includes in aarch64-linux-tdep.c
include-what-you-use reports:
../../../src/binutils-gdb/gdb/aarch64-linux-tdep.c should remove these lines:
- #include "arch-utils.h" // lines 24-24
- #include "auxv.h" // lines 48-48
- #include "cli/cli-utils.h" // lines 39-39
- #include "elf/common.h" // lines 49-49
- #include "inferior.h" // lines 35-35
Add an include for "target/target.h", otherwise target_read_memory isn't
found.
gdb/ChangeLog:
* aarch64-linux-tdep.c: Remove includes.
Simon Marchi [Wed, 4 Dec 2019 18:32:33 +0000 (13:32 -0500)]
Remove unused includes in aarch64-tdep.c
include-what-you-use reports:
../../../src/binutils-gdb/gdb/aarch64-tdep.c should remove these lines:
- #include "ax.h" // lines 45-45
- #include "elf-bfd.h" // lines 52-52
- #include "elf/aarch64.h" // lines 53-53
- #include "infcall.h" // lines 44-44
- #include "inferior.h" // lines 24-24
- #include "language.h" // lines 43-43
gdb/ChangeLog:
* aarch64-tdep.c: Remove includes.
Simon Marchi [Wed, 4 Dec 2019 18:27:21 +0000 (13:27 -0500)]
Compare iterators, not values, in filtered_iterator::operator{==,!=}
The == and != operators on filtered_iterator are not doing the
right thing, they compare values pointed by the wrapped iterators
instead of comparing the iterators themselves.
As a result, operator== will return true if the two iterators point to
two equal values at different positions. operator!= will fail
similarly.
Also, this causes it to deference past-the-end iterators when doing.
For example, in
for (iter = ...; iter != end_iter; ++iter)
the != comparison dereferences end_iter. I don't think this should
happen.
I don't think it's a problem today, given that we only use
filtered_iterator to wrap linked lists of threads and inferiors.
Dereferencing past-the-end iterators of these types is not fatal, it
just returns NULL, which is not a value we otherwise find in the lists.
But in other contexts, it could become problematic.
I have added a simple self test that fails without the fix applied.
gdb/ChangeLog:
* filtered-iterator.h (filtered_iterator) <operator==,
operator!=>: Compare wrapped iterators, not wrapped pointers.
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/filtered_iterator-selftests.c.
* unittests/filtered_iterator-selftests.c: New file.
Pavel I. Kryukov [Sat, 30 Nov 2019 22:40:21 +0000 (01:40 +0300)]
sim-utils.c: prevent buffer overflow.
Representation of max 32-bit integer is 10 chars.
The potential issue is observed by GCC 7 targeted to AArch64.
sim/common/ChangeLog:
2019-12-01 Pavel I. Kryukov <kryukov@frtk.ru>
* sim-utils.c: Prevent buffer overflow.
Tom Tromey [Mon, 25 Nov 2019 20:37:15 +0000 (13:37 -0700)]
Add bit-field test for scalar_storage_order
This adds a bit-field test for scalar_storage_order.
gdb/testsuite/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdb.base/endianity.c (struct other) <x>: New field.
(main): Initialize it.
* gdb.base/endianity.exp: Update.
Change-Id: I9e07d1b3e08e7c3384832b68ef286afe1d11479a
Tom Tromey [Mon, 25 Nov 2019 20:04:52 +0000 (13:04 -0700)]
Propagate endianity to subrange types
A subrange type should inherit its endianity from its base type.
gdb/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (create_range_type): Inherit endianity
from base type.
gdb/testsuite/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/scalar_storage/storage.adb: New file.
* gdb.ada/scalar_storage/pck.adb: New file.
* gdb.ada/scalar_storage/pck.ads: New file.
* gdb.ada/scalar_storage.exp: New file.
Change-Id: I2998ab919dc28aeff097763c4242f9bfb90823a3
Tom Tromey [Mon, 25 Nov 2019 19:31:02 +0000 (12:31 -0700)]
Remove gdbarch_bits_big_endian
From what I can tell, set_gdbarch_bits_big_endian has never been used.
That is, all architectures since its introduction have simply used the
default, which is simply check the architecture's byte-endianness.
Because this interferes with the scalar_storage_order code, this patch
removes this gdbarch setting entirely. In some places,
type_byte_order is used rather than the plain gdbarch.
gdb/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* ada-lang.c (decode_constrained_packed_array)
(ada_value_assign, value_assign_to_component): Update.
* dwarf2loc.c (rw_pieced_value, access_memory)
(dwarf2_compile_expr_to_ax): Update.
* dwarf2read.c (dwarf2_add_field): Update.
* eval.c (evaluate_subexp_standard): Update.
* gdbarch.c, gdbarch.h: Rebuild.
* gdbarch.sh (bits_big_endian): Remove.
* gdbtypes.h (union field_location): Update comment.
* target-descriptions.c (make_gdb_type): Update.
* valarith.c (value_bit_index): Update.
* value.c (struct value) <bitpos>: Update comment.
(unpack_bits_as_long, modify_field): Update.
* value.h (value_bitpos): Update comment.
Change-Id: I379b5e0c408ec8742f7a6c6b721108e73ed1b018
Tom Tromey [Mon, 25 Nov 2019 18:14:50 +0000 (11:14 -0700)]
Move type_byte_order earlier
I failed to notice that the scalar_storage_order patch put
type_byte_order at the end of gdbtypes.c. The end of the file is
normally where the file's _initialize function goes. This moves
type_byte_order earlier, into a more relevant section.
gdb/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (type_byte_order): Move earlier. Assert for unknown
endian-ness.
Change-Id: I4666431ecbb32ec98918f39f72d22c86b2bc8dde
Tom Tromey [Mon, 25 Nov 2019 18:13:52 +0000 (11:13 -0700)]
Add scalar_storage_order support for floating point
Testing the scalar_storage_order patch pointed out that it does not
handle floating point properly. This patch fixes this problem.
gdb/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* dwarf2read.c (dwarf2_init_float_type)
(dwarf2_init_complex_target_type): Add byte_order parameter.
(read_base_type): Compute byte order earlier.
* gdbtypes.c (init_float_type): Add byte_order parameter.
* gdbtypes.h (init_float_type): Add byte_order parameter.
gdb/testsuite/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdb.base/endianity.c (struct otherendian) <f>: New field.
(main): Initialize it.
* gdb.base/endianity.exp: Update.
Change-Id: Ic02eb711d80ce678ef0ecf8c506a626e441b8440
Tom Tromey [Wed, 4 Dec 2019 15:08:13 +0000 (08:08 -0700)]
Fix another build failure in tui-selftests.c
Christian had emailed me to say that the TUI unit test broke the mingw
build, but I erroneously thought this was fixed by the earlier patch
that made the test body conditional on the TUI being built.
However, I was wrong about this -- tui-selftests.c unconditionally
includes tui-winsource.h, which fails if curses is not available.
This patch fixes the build problem by moving this include into the
"#ifdef TUI" section.
Tested by rebuilding a mingw-hosted gdb.
gdb/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* unittests/tui-selftests.c: Conditionally include tui-winsource.h.
Change-Id: If608649ef5cbef8ea92192e11c53379742967ee7
Tom Tromey [Wed, 4 Dec 2019 14:46:59 +0000 (07:46 -0700)]
Silence maybe-uninitialized warning in dwarf2read.c
I upgraded to Fedora 30 recently. It includes GCC 9, which gives a
warning for dwarf2read.c:
../../binutils-gdb/gdb/dwarf2read.c:16103:24: warning: ‘discr_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]
This patch fixes the problem by initializing discr_offset.
Tested by rebuilding.
gdb/ChangeLog
2019-12-04 Tom Tromey <tromey@adacore.com>
* dwarf2read.c (process_structure_scope): Initialize
"discr_offset".
Change-Id: I76a6157921c9beacb641b8a41e10026006621b95
Andrew Burgess [Mon, 14 Oct 2019 23:02:51 +0000 (00:02 +0100)]
gdb/mi: Add -max-results parameter to some -symbol-info-* commands
Adds a new parameter -max-results to -symbol-info-functions,
-symbol-info-variables, -symbol-info-types, and -symbol-info-modules.
This parameter limits the number of results returned.
This change still leaves -symbol-info-module-functions and
-symbol-info-module-variables always returning all results, fixing
these commands is slightly harder.
There's currently no mechanism for the user of these commands to know
if the result list has been truncated if you get back the maximum
number of results, so if there are exactly 10 functions and you call
'-symbol-info-functions --max-results 10' the reply would appear no
different than if you had 20 functions and called with a max of 10.
Right now, if you get back the maximum then you should assume that
there might be more results available.
One other thing to note is that the global_symbol_searcher::search by
default returns SIZE_MAX results, there's no longer a mechanism to
return an unlimited number of results, though hopefully this will not
be a huge issue.
gdb/ChangeLog:
* mi/mi-symbol-cmds.c (mi_symbol_info): Take extra parameter, and
add it into the search spec.
(parse_max_results_option): New function.
(mi_info_functions_or_variables): Parse -max-results flag and pass
it to mi_symbol_info.
(mi_cmd_symbol_info_modules): Likewise.
(mi_cmd_symbol_info_types): Likewise.
* symtab.c (global_symbol_searcher::add_matching_symbols): Change
return type to bool, change result container into a set, and don't
add new results if we have enough already.
(global_symbol_searcher::add_matching_msymbols): Change return
type to bool, and don't add new results if we have enough already.
(sort_search_symbols_remove_dups): Delete.
(global_symbol_searcher::search): Early exit from search loop when
we have enough results. Use a std::set to collect the results
from calling add_matching_symbols.
* symtab.h (global_symbol_searcher) <set_max_seach_results>: New
member function.
(global_symbol_searcher) <m_max_search_results>: New member
variable.
(global_symbol_searcher) <add_matching_symbols>: Update header
comment and change return type to bool.
(global_symbol_searcher) <add_matching_msymbols>: Update header
comment and change return type to bool.
gdb/doc/ChangeLog:
* doc/gdb.texinfo (GDB/MI Symbol Query): Add documentation of
-max-results to some -symbol-info-* commands.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-sym-info.exp: Add tests for -max-results parameter.
Change-Id: I90a28feb55b388fb46461a096c5db08b6b0bd427
Andrew Burgess [Mon, 2 Dec 2019 11:36:45 +0000 (11:36 +0000)]
gdb: Split global symbol search into separate functions
In preparation for the next commit, this commit restructures the code
by splitting global_symbol_searcher::search into separate functions.
There should be no functional changes after this commit.
gdb/ChangeLog:
* symtab.c (symbol_search::compare_search_syms): Update header
comment.
(global_symbol_searcher::is_suitable_msymbol): New function.
(global_symbol_searcher::expand_symtabs): New function.
(global_symbol_searcher::add_matching_symbols): New function.
(global_symbol_searcher::add_matching_msymbols): New function.
(global_symbol_searcher::search): Move most of the content
into the new functions above, and call them as needed.
* symtab.h (global_symbol_searcher) <expand_symtabs>: New member
function.
(global_symbol_searcher) <add_matching_symbols>: New member
function.
(global_symbol_searcher) <add_matching_msymbols>: New member
function.
(global_symbol_searcher) <is_suitable_msymbol>: New member
function.
Change-Id: I06b26920f35c268f7a38d8203dc2c2813aa501c6
Andrew Burgess [Fri, 4 Oct 2019 16:59:51 +0000 (17:59 +0100)]
gdb/mi: Add -symbol-info-module-{variables,functions}
Two new MI command -symbol-info-module-variables and
-symbol-info-module-functions, which are the equivalent of the CLI
command 'info module variables' and 'info module functions'. These
return information about functions and variables within Fortran
modules.
gdb/ChangeLog:
* mi/mi-cmds.c (mi_cmds): Add -symbol-info-module-functions and
-symbol-info-module-variables entries.
* mi/mi-cmds.h (mi_cmd_symbol_info_module_functions): Declare.
(mi_cmd_symbol_info_module_variables): Declare.
* mi/mi-symbol-cmds.c
(module_symbol_search_iterator): New typedef.
(output_module_symbols_in_single_module_and_file): New function.
(output_module_symbols_in_single_module): New function.
(mi_info_module_functions_or_variables): New function.
(mi_cmd_symbol_info_module_functions): New function.
(mi_cmd_symbol_info_module_variables): New function.
* NEWS: Mention new MI command.
gdb/doc/ChangeLog:
* doc/gdb.texinfo (GDB/MI Symbol Query): Document new MI command
-symbol-info-module-functions and -symbol-info-module-variables.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-fortran-modules.exp: Add additional tests for
-symbol-info-module-functions and -symbol-info-module-variables.
Change-Id: Ic96f12dd14bd7e34774c3cde008fec30a4055bfe
Jan Beulich [Wed, 4 Dec 2019 09:45:17 +0000 (10:45 +0100)]
x86-64: accept 64-bit LFS/LGS/LSS forms with suffix or operand size specifier
Since we accept these without suffix / operand size specifier, we should
also do so with one. (The fact that we unilaterally accept these, other
than far branches, rather than limiting them to Intel64 mode, will be
taken care of later on.)
Also take the opportunity and make sure "lfs <reg>, tbyte ptr <mem>"
et al get rejected outside of 64-bit mode. This became broken by
dc2be329b950 ("i386: Only check suffix in instruction mnemonic").
Furthermore cover lgdt et al in the Intel syntax handling as well, which
continued to work after said commit just by coincidence.
Jan Beulich [Wed, 4 Dec 2019 09:44:27 +0000 (10:44 +0100)]
x86-64/Intel: fix CALL/JMP with dword operand
While
dc2be329b950 ("i386: Only check suffix in instruction mnemonic")
has made the assembler accept these in the first place (they were wrongly
rejected before), the generated code was still wrong in that it lacked
an operand size override. (In 64-bit code, other than in 16- and 32-bit
ones, CALL and JMP with memory operands are all entirely unambiguous: No
operand size can have two meanings.)
Jan Beulich [Wed, 4 Dec 2019 09:43:50 +0000 (10:43 +0100)]
x86: consolidate tracking of MMX register use
Just like for XMM/YMM/ZMM don't key this to any Cpu* flags. Instead
include the two special insns (not having register operands) explicitly.
Jan Beulich [Wed, 4 Dec 2019 09:41:43 +0000 (10:41 +0100)]
x86/Intel: extend MOVDIRI testing
Test also memory operands with operand size specifier, which was broken
prior to
dc2be329b950 ("i386: Only check suffix in instruction
mnemonic"), due to the template not permitting any suffixes. Note that
this uncovered a disassembler issue, which is being fixed here as well.
Jan Beulich [Wed, 4 Dec 2019 09:40:40 +0000 (10:40 +0100)]
x86: make sure all PUSH/POP honor DefaultSize
While segment registers are registers, their use doesn't allow sizing
of insns without suffix / explicit operand size specifier. Prevent
PUSH and POP of segment registers from entering that path, instead
allowing them to observe the stackop_size setting just like other
PUSH/POP and alike do.
Jan Beulich [Wed, 4 Dec 2019 09:40:02 +0000 (10:40 +0100)]
x86: drop some stray/bogus DefaultSize
Insns permitting only GPR operands (and hence implicit sizing when
there's no suffix) don't ever have their DefaultSize attribute
inspected, so it shouldn't be there in the first place.
Additionally XBEGIN is like JMP, not CALL, and hence shouldn't be
converted to 32-bit operand size in .code16gcc mode. While the same is
true for SYSRET, it permitting more than one suffix makes it FLDENV-
like, and hence rather than dropping the attribute, for now add it to
the exclusion list to avoid it getting an operand size prefix emitted
in .code16gcc mode. (This will be dealt with later, perhaps together
with FLDENV and friends.)
GDB Administrator [Wed, 4 Dec 2019 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Tue, 3 Dec 2019 00:58:35 +0000 (18:58 -0600)]
Replace hash function from bcache with fast_hash
This function is not just slower than xxhash, it is slower than
even libiberty's iterative_hash, so there does not seem to be
a reason for it to exist.
------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------
BM_xxh3 11 ns 11 ns
66127192
BM_xxh32 19 ns 19 ns
36792609
BM_xxh64 16 ns 16 ns
42941328
BM_city32 26 ns 26 ns
27028370
BM_city64 17 ns 17 ns
40472793
BM_iterative_hash 77 ns 77 ns
9088854
BM_bcache_hash 125 ns 125 ns
5599232
gdb/ChangeLog:
2019-12-03 Christian Biesinger <cbiesinger@google.com>
* bcache.c (hash): Remove.
(hash_continue): Remove.
* bcache.h (hash): Remove.
(hash_continue): Remove.
(struct bcache) <ctor>: Update.
* psymtab.c (psymbol_hash): Update.
* stabsread.c (hashname): Update.
* utils.h (fast_hash): Add an argument for a start value,
defaulting to zero.
Change-Id: I107f013eda5fdd3293326b5a206be43155dae0f8
Philippe Waroquiers [Sun, 1 Dec 2019 16:24:41 +0000 (17:24 +0100)]
Fix leak of symbol name in block_symbol_cache
A symbol not found inserted in the cache has a xstrdup-ed name
that must be freed, but only the struct block_symbol_cache is freed.
Add a function destroy_block_symbol_cache that clears all slots
before releasing the cache.
2019-12-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* symtab.c (symbol_cache_clear_slot): Move close to cleared type.
(destroy_block_symbol_cache): New function.
(symbol_cache:~symbol_cache) Call destroy_block_symbol_cache.
(resize_symbol_cache): Likewise.
Alan Modra [Mon, 2 Dec 2019 13:07:34 +0000 (23:37 +1030)]
PR25230, addr2line fails on dwz output
This patch remedies the following DW_FORM_GNU_ref_alt related problem:
/* FIXME: Do we need to locate the correct CU, in a similar
fashion to the code in the DW_FORM_ref_addr case above ? */
Without the correct CU the wrong abbrevs are used, resulting in
errors and/or wrong file names.
There is scope for further work here. Parsing of CUs should be a two
step process, with the first stage just finding the bounds of the CU.
This would allow find_abstract_instance to quickly find the CU
referenced by DW_FORM_ref_addr or DW_FORM_GNU_ref_alt, then take the
second stage of CU parsing where abbrevs, ranges and suchlike consume
time and memory. As it is, we just process CUs from the start of
.debug_info until we find the one of interest. The testcase in the PR
takes 98G of virtual memory.
PR 25230
* dwarf2.c (struct dwarf2_debug_file): Add line_table and
abbrev_offsets.
(struct abbrev_offset_entry): New.
(hash_abbrev, eq_abbrev, del_abbrev): New functions.
(read_abbrevs): Check whether we have already read abbrevs at
given offset, and add new offset/abbrev to hash table.
(decode_line_info): Keep line table at offset zero in file struct.
Return this for a cu reusing the same dir/file list.
(find_abstract_instance): Find cu for DW_FORM_GNU_ref_alt.
(_bfd_dwarf2_slurp_debug_info): Create offset/abbrev hash tables.
(_bfd_dwarf2_cleanup_debug_info): Adjust deletion of lines and
abbrevs.
Alan Modra [Sat, 30 Nov 2019 06:27:55 +0000 (16:57 +1030)]
PR25230, dwarf2.c per file stash
This is just moving things around, in preparation for parsing alt
file debug_info.
PR 25230
* dwarf2.c (struct dwarf2_debug_file): New struct.
(struct dwarf2_debug): Delete fields now in dwarf2_debug_file.
Add f, alt fields.
(struct comp_unit): Add file field.
(read_indirect_string, read_indirect_line_string): Adjust to suit.
(read_alt_indirect_string, read_alt_indirect_ref): Likewise.
(read_debug_ranges, find_abstract_instance, read_rangelist): Likewise.
(_bfd_dwarf2_stash_syms, place_sections): Likewise.
(stash_maybe_update_info_hash_tablse): Likewise.
(stash_verify_info_hash_table): Likewise.
(_bfd_dwarf2_slurp_debug_info): Likewise.
(_bfd_dwarf2_find_symbol_bias): Likewise.
(_bfd_dwarf2_find_nearest_line): Likewise.
(_bfd_dwarf2_cleanup_debug_info): Likewise.
(read_abbrevs): Add file param and adjust. Update calls.
(stash_comp_unit): Likewise.
(decode_line_info): Delete stash param and adjust. Update calls.
(comp_unit_find_nearest_line): Likewise.
(comp_unit_maybe_decode_line_info): Likewise.
(comp_unit_find_line): Likewise.
(parse_comp_unit): Add file and info_ptr param and adjust. Update
calls.
Alan Modra [Fri, 29 Nov 2019 22:42:29 +0000 (09:12 +1030)]
dwarf2.c: read_abbrevs fail cleanup, and offset checking
read_section does offset checking, reporting an error on out of
bounds. There's no need to duplicate the check in functions calling
read_section. Also, I spotted a place where a pointer difference
expression was being cast to unsigned int, possibly truncating
relevant bits on a 64-bit host.
* dwarf2.c (read_indirect_string): Don't duplicate offset check
done in read_section.
(read_indirect_line_string): Likewise.
(read_alt_indirect_string): Likewise.
(read_alt_indirect_ref): Likewise.
(read_abbrevs): Likewise. Free memory on all failure paths.
Use correct unsigned type for pointer difference comparison.
Alan Modra [Tue, 3 Dec 2019 03:00:33 +0000 (13:30 +1030)]
dwarf2.c stash->sec_info_ptr and stash->sec
These are unused. Remove them. Also fix the wrong sort of 0 being
returned from read_alt_indirect_ref.
* dwarf2.c (struct dwarf2_debug): Update comments. Remove sec
and sec_info_ptr.
(_bfd_dwarf2_slurp_debug_info): Don't set sec or sec_info_ptr.
(stash_comp_unit): Likewise.
(read_alt_indirect_ref): Return NULL not FALSE.
Alan Modra [Sat, 30 Nov 2019 07:38:09 +0000 (18:08 +1030)]
_bfd_dwarf2_find_nearest_line comment fix
These lines should have been removed along with the addr_size parameter.
* dwarf2.c (_bfd_dwarf2_find_nearest_line): Correct function comment.
GDB Administrator [Tue, 3 Dec 2019 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 2 Dec 2019 23:12:19 +0000 (16:12 -0700)]
Fix build breakage with --disable-tui
An earlier patch introduced a unit test for tui_copy_source_line.
However if the TUI is not built (as is apparently the case on some of
the buildbot builders), then this will fail to link.
This patch fixes the problem. Tested by rebuilding with the TUI
disabled.
gdb/ChangeLog
2019-12-02 Tom Tromey <tom@tromey.com>
* unittests/tui-selftests.c (run_tests): Make conditional.
(_initialize_tui_selftest): Make conditional.
Change-Id: I964811c7635be24cf6c53920e74e920914503674
Christian Biesinger [Mon, 2 Dec 2019 18:33:38 +0000 (12:33 -0600)]
Change type of debug_aix_thread to bool
This fixes AIX build breakage from commit
491144b5e21bbfd41969c175aebb663976f59058
Thanks to Sangamesh Mallayya for pointing this out to me.
gdb/ChangeLog:
2019-12-02 Christian Biesinger <cbiesinger@google.com>
* aix-thread.c (debug_aix_thread): Change type to bool.
Change-Id: Ie7b2eab97b75b48067ef77e414e7510d1f79a525
Luis Machado [Wed, 27 Nov 2019 20:25:05 +0000 (17:25 -0300)]
Remove stale FIXME comment
While debugging something, i noticed this odd FIXME comment. It seems stale
and therefore here's a patch removing it.
gdb/ChangeLog:
2019-12-02 Luis Machado <luis.machado@linaro.org>
* infrun.c (follow_fork_inferior): Remove outdated FIXME comment.
Change-Id: I2436ca4ae4a6741012cafe8123325f738b692c9c
GDB Administrator [Mon, 2 Dec 2019 00:00:21 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 29 Nov 2019 00:14:35 +0000 (00:14 +0000)]
gdb: Dynamic string length support
Add support for strings with dynamic length using the DWARF attribute
DW_AT_string_length.
Currently gFortran generates DWARF for some strings that make use of
DW_AT_string_length like this:
<1><2cc>: Abbrev Number: 20 (DW_TAG_string_type)
<2cd> DW_AT_string_length: 5 byte block: 99 bd 1 0 0 (DW_OP_call4: <0x1bd>)
<2d3> DW_AT_byte_size : 4
<2d4> DW_AT_sibling : <0x2e2>
In this type entry the DW_AT_string_length attribute references a
second DW_TAG_formal_parameter that contains the string length. The
DW_AT_byte_size indicates that the length is a 4-byte value.
This commit extends GDB's DWARF parsing for strings so that we can
create dynamic types as well as static types, based on the attribute
the DWARF contains.
I then extend the dynamic type resolution code in gdbtypes.c to add
support for resolving dynamic strings.
gdb/ChangeLog:
* dwarf2read.c (read_tag_string_type): Read the fields required to
make a dynamic string, and possibly create a dynamic range for the
string.
(attr_to_dynamic_prop): Setup is_reference based on the type of
attribute being processed.
* gdbtypes.c (is_dynamic_type_internal): Handle TYPE_CODE_STRING.
(resolve_dynamic_array): Rename to...
(resolve_dynamic_array_or_string): ...this, update header comment,
and accept TYPE_CODE_STRING.
(resolve_dynamic_type_internal): Handle TYPE_CODE_STRING.
gdb/testsuite/ChangeLog:
* gdb.fortran/array-slices.exp: Add test for dynamic strings.
Change-Id: I03f2d181b26156f48f27a03c8a59f9bd4d71ac17
Andrew Burgess [Fri, 29 Nov 2019 00:13:19 +0000 (00:13 +0000)]
gdb/dwarf: Introduce dwarf2_per_cu_int_type function
This is a minor refactor in preparation for the next commit. Splits
the core of dwarf2_per_cu_addr_sized_int_type out into a separate
function. There should be no user visible changes after this commit.
gdb/ChangeLog:
* dwarf2read.c (dwarf2_per_cu_int_type): New function, takes most
of its implementation from...
(dwarf2_per_cu_addr_sized_int_type): ...here, which now just calls
the new function.
Change-Id: I8b849dd338012ec033b3f0a57d65cec0d7a3bd97
Andrew Burgess [Thu, 24 Oct 2019 10:12:11 +0000 (11:12 +0100)]
gdb/fortran: array stride support
Currently GDB supports a byte or bit stride on arrays, in DWARF this
would be DW_AT_bit_stride or DW_AT_byte_stride on DW_TAG_array_type.
However, DWARF can also support DW_AT_byte_stride or DW_AT_bit_stride
on DW_TAG_subrange_type, the tag used to describe each dimension of an
array.
Strides on subranges are used by gFortran to represent Fortran arrays,
and this commit adds support for this to GDB.
I've extended the range_bounds struct to include the stride
information. The name is possibly a little inaccurate now, but this
still sort of makes sense, the structure represents information about
the bounds of the range, and also how to move from the lower to the
upper bound (the stride).
I've added initial support for bit strides, but I've never actually
seen an example of this being generated. Further, I don't really see
right now how GDB would currently handle a bit stride that was not a
multiple of the byte size as the code in, for example,
valarith.c:value_subscripted_rvalue seems geared around byte
addressing. As a consequence if we see a bit stride that is not a
multiple of 8 then GDB will give an error.
gdb/ChangeLog:
* dwarf2read.c (read_subrange_type): Read bit and byte stride and
create a range with stride where appropriate.
* f-valprint.c: Include 'gdbarch.h'.
(f77_print_array_1): Take the stride into account when walking the
array. Also convert the stride into addressable units.
* gdbtypes.c (create_range_type): Initialise the stride to
constant zero.
(create_range_type_with_stride): New function, initialise the
range as normal, and then setup the stride.
(has_static_range): Include the stride here. Also change the
return type to bool.
(create_array_type_with_stride): Consider the range stride if the
array isn't given its own stride.
(resolve_dynamic_range): Resolve the stride if needed.
* gdbtypes.h (struct range_bounds) <stride>: New member variable.
(struct range_bounds) <flag_is_byte_stride>: New member variable.
(TYPE_BIT_STRIDE): Define.
(TYPE_ARRAY_BIT_STRIDE): Define.
(create_range_type_with_stride): Declare.
* valarith.c (value_subscripted_rvalue): Take range stride into
account when walking the array.
gdb/testsuite/ChangeLog:
* gdb.fortran/derived-type-striding.exp: New file.
* gdb.fortran/derived-type-striding.f90: New file.
* gdb.fortran/array-slices.exp: New file.
* gdb.fortran/array-slices.f90: New file.
Change-Id: I9af2bcd1f2d4c56f76f5f3f9f89d8f06bef10d9a
Tom Tromey [Wed, 20 Nov 2019 23:02:29 +0000 (16:02 -0700)]
Treat inactive TUI specially in "info win"
I noticed that "info win" will print the table header, but no windows,
when the TUI is inactive. This patch changes this to print a message
instead.
gdb/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* tui/tui-win.c (tui_all_windows_info): Treat inactive TUI
specially.
Change-Id: Ia860be8c786a71289da6609aa14d86b8365424db
Tom Tromey [Sun, 17 Nov 2019 22:50:31 +0000 (15:50 -0700)]
Fix latent bug in tui_copy_source_line
tui_copy_source_line has a bug, where it can advance past the
terminating \0 in its input string. This patch fixes the bug and adds
a test case for this function.
gdb/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_copy_source_line): Don't advance past
\0.
* unittests/tui-selftests.c: New file.
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add tui-selftests.c.
Change-Id: I46cdabe6e57549983149b8f640cda5edd16fa260
Tom Tromey [Sun, 10 Nov 2019 16:11:42 +0000 (09:11 -0700)]
Re-highlight windows when needed during TUI startup
I noticed that "tui enable" did not correctly show the source window
as having the focus. Debugging showed that the problem was that
tui_update_variables was called after the windows were drawn, and its
result was being ignored. This changed the code to re-highlight the
windows if the value changed.
gdb/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_enable): Call tui_update_variables earlier.
Change-Id: I1a4563fb431833dd3211a224c9e2df3b936fe9ce
Tom Tromey [Sat, 9 Nov 2019 21:13:13 +0000 (14:13 -0700)]
Add TUI border colors
This adds the ability to change the color of the TUI borders, both
ordinary and active. Unlike other styling options, this doesn't allow
setting the intensity, because that is already done by the TUI in a
different way.
gdb/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* NEWS: Document new settings.
* tui/tui-wingeneral.c (box_win): Apply appropriate border style.
* tui/tui-win.c (_initialize_tui_win): Add border style
observers.
* tui/tui-io.h (tui_apply_style): Declare.
* tui/tui-io.c (tui_apply_style): Rename from apply_style. No
longer static.
(apply_ansi_escape, tui_set_reverse_mode): Update.
* cli/cli-style.h (class cli_style_option) <add_setshow_commands>:
Add "skip_intensity" parameter.
<changed>: New member.
<do_set_value>: Declare.
(tui_border_style, tui_active_border_style): Declare.
* cli/cli-style.c (tui_border_style, tui_active_border_style): New
globals.
(cli_style_option): Initialize "changed".
(cli_style_option::do_set_value): New function.
(cli_style_option::add_setshow_commands): Add "skip_intensity"
parameter. Update.
(STYLE_ADD_SETSHOW_COMMANDS): Add "SKIP" parameter.
(_initialize_cli_style): Update. Create TUI border style
commands.
gdb/doc/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* gdb.texinfo (TUI Configuration): Mention TUI border styles.
(Output Styling): Document new settings.
Change-Id: Id13e2af0af2a0bde61282752f2c379db3220c9fc
Tom Tromey [Thu, 11 Jul 2019 23:06:00 +0000 (17:06 -0600)]
Allow using less horizontal space in TUI source window
The source window currently uses a field width of 6 for line numbers,
and it further aligns to the next tab stop. This seemed a bit
wasteful of horizontal space to me, so I changed that in an earlier
patch.
However, that change wasn't universally popular. This patch instead
adds the option to use less horizontal space in the TUI source window.
gdb/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_copy_source_line): Add "ndigits"
parameter.
* tui/tui-winsource.c (tui_copy_source_line): Add "ndigits"
parameter.
* tui/tui-win.h (compact_source): Declare.
* tui/tui-win.c (compact_source): New global.
(tui_set_compact_source, tui_show_compact_source): New functions.
(_initialize_tui_win): Add "compact-source" setting.
* tui/tui-source.c (tui_source_window::set_contents): Handle
compact_source setting.
* tui/tui-disasm.c (tui_disasm_window::set_contents): Update.
* NEWS: Document new setting.
gdb/doc/ChangeLog
2019-12-01 Tom Tromey <tom@tromey.com>
* gdb.texinfo (TUI Configuration): Document new setting.
Change-Id: I46ce9a68b12c9c79332d510f9c14b3c84b7efadd
Tom Tromey [Sat, 30 Nov 2019 17:05:23 +0000 (10:05 -0700)]
Correctly compute length of DW_TAG_variant_part union
Currently, gdb internally transforms DW_TAG_variant_part into a union
(with some special attbributes). When doing so, it computes the
length of this union from the length of the fields. However, this
computation didn't include the offset of these fields, resulting in
the length being too short.
This is not a problem given the way the code currently works.
However, I have a patch series to switch gdb to value-based printing,
where this does have an impact.
Tested on x86-64 Fedora 28; and, considering that this only affects
Rust, I am checking it in.
gdb/ChangeLog
2019-11-30 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_add_field): Include field offset when
computing variant part length.
Change-Id: I25d84fc237eb3c1e7f11f6eaf35ffe198efde6cc
GDB Administrator [Sun, 1 Dec 2019 00:01:06 +0000 (00:01 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Sat, 28 Sep 2019 17:30:08 +0000 (19:30 +0200)]
Document define-prefix command and the use of . in command names.
gdb/ChangeLog
2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention define-prefix. Tell that command names can now
contain a . character.
gdb/doc/ChangeLog
2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Define): Indicate that user-defined prefix can
be used in 'define' command. Document 'define-prefix' command.
Philippe Waroquiers [Sun, 8 Sep 2019 19:54:18 +0000 (21:54 +0200)]
Allow . character as part of command names.
This patch adds . as an allowed character for user defined commands.
Combined with 'define-prefix', this allows to e.g. define a set of Valgrind
specific user command corresponding to the Valgrind monitor commands
(such as check_memory, v.info, v.set, ...).
gdb/ChangeLog
2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* command.h (valid_cmd_char_p): Declare.
* cli/cli-decode.c (valid_cmd_char_p): New function factorizing
the check of valid command char.
(find_command_name_length, valid_user_defined_cmd_name_p): Use
valid_cmd_char_p.
* cli/cli-script.c (validate_comname): Likewise.
* completer.c (gdb_completer_command_word_break_characters):
Do not remove . from the word break char, update comments.
(complete_line_internal_1): Use valid_cmd_char_p.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
gdb/testsuite/ChangeLog
2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/define.exp: Test . in command names.
* gdb.base/setshow.exp: Update test, as . is now part of
command name.
Philippe Waroquiers [Sun, 8 Sep 2019 17:22:35 +0000 (19:22 +0200)]
Test define-prefix.
Adds a test testing the new define-prefix command.
2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/define-prefix.exp: New file.
Philippe Waroquiers [Sun, 8 Sep 2019 13:48:32 +0000 (15:48 +0200)]
Implement user defined prefix.
This patch adds the new 'define-prefix' command that creates (or mark an
existing user defined command) as a prefix command.
This approach was preferred compared to add a -prefix option to
'define' command : with define-prefix, a command can be defined and
afterwards marked as a prefix. Also, it is easier to define a
'prefix' only command in one operation.
This patch also adds completers for the 'define' and 'document' commands.
This makes it easier for the user to type the prefixes for 'define'
and type the documented command name for 'document'.
gdb/ChangeLog
2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* cli/cli-script.c (do_define_command): Ensure a redefined
prefix command is kept as a prefix command.
(define_prefix_command): New function.
(show_user_1): Report user defined prefixes.
(_initialize_cli_script): Create the new 'define-prefix' command.
Add completers for 'define' and 'document'.
* top.c (execute_command): If command is a user-defined prefix only
command, report the list of commands for this prefix command.
GDB Administrator [Sat, 30 Nov 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Tankut Baris Aktemur [Fri, 29 Nov 2019 11:17:36 +0000 (12:17 +0100)]
gdb: improve debug output of function overload resolution
Function overload resolution prints debug output if turned on via the
'set debug overload' command. The output includes the badness vector
(BV). For each function, this vector contains a badness value of the
length of parameters as its first element. So, BV[0] does not
correspond to a parameter. The badness values of parameters start
with BV[1].
A badness value is a pair; it contains a rank and a subrank. Printing
both fields provides useful information.
Improve printing the badness vector along these lines.
gdb/ChangeLog:
2019-11-29 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* valops.c (find_oload_champ): Improve debug output.
Change-Id: I771017e7afbbaf4809e2238a9b23274f55c61f55
Tankut Baris Aktemur [Fri, 29 Nov 2019 11:17:36 +0000 (12:17 +0100)]
gdb: fix segfault in overload resolution debug output
A segfault occurs if overload resolution debug mode is turned on via
the 'set debug overload' command. E.g.:
~~~
$ gdb ./a.out
...
(gdb) start
...
(gdb) set debug overload 1
(gdb) print foo(5)
-- Arg is int [8], parm is double [9]
Overloaded function instance (null) # of parms 1
Segmentation fault
$
~~~
The problem is, GDB tries to print the badness vector after it has
been std::move'd. Fix the problem by printing the vector before it is
moved.
gdb/ChangeLog:
2019-11-29 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* valops.c (find_oload_champ): Print part of debug messages
before the badness vector is std::move'd.
Change-Id: Ia623f9637e82ec332bfeac23eb6b0f2ffdcdde27
GDB Administrator [Fri, 29 Nov 2019 00:00:14 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 27 Nov 2019 01:49:32 +0000 (18:49 -0700)]
Fix creal_internal_fn comment
I noticed that the comment before creal_internal_fn refers to $_cimag,
but should refer to $_creal.
gdb/ChangeLog
2019-11-28 Tom Tromey <tom@tromey.com>
* value.c (creal_internal_fn): Fix comment.
Change-Id: I5665aceb4be5aae7014e914cfb39db184c65d5ea
Tom Tromey [Thu, 28 Nov 2019 03:42:57 +0000 (20:42 -0700)]
Make two range_bounds bitfields unsigned
While debugging gdb, I noticed that the bitfields in a range_bounds
were signed, causing the values of these fields to be -1.
I think this is odd; and while we haven't yet committed to boolean
bitfields, I think it is a small improvement to change these types to
unsigned.
gdb/ChangeLog
2019-11-28 Tom Tromey <tom@tromey.com>
* gdbtypes.h (struct range_bounds) <flag_upper_bound_is_count,
flag_bound_evaluated>: Now unsigned.
Change-Id: Ia377fd931594bbf8653180d4dcb4e60354d90139
Tom Tromey [Wed, 27 Nov 2019 18:18:15 +0000 (11:18 -0700)]
Remove unused declaratoin from guile
guile-internal.h declares a function that is never defined. This
removes the declaration.
gdb/ChangeLog
2019-11-28 Tom Tromey <tom@tromey.com>
* guile/guile-internal.h (vlscm_scm_from_value_unsafe): Don't
declare.
Change-Id: I2dca228534bc1325d2d4bb319c31328121edecc4
Mihails Strasuns [Thu, 28 Nov 2019 08:59:23 +0000 (09:59 +0100)]
jit: minor improvement to debug logging
gdb/ChangeLog:
2019-11-28 Mihails Strasuns <mihails.strasuns@intel.com>
* jit.c (jit_bfd_try_read_symtab): Fix printed function name in the
debug output.
* jit.c (jit_unregister_code): Add debug print to match
`jit_register_code`.
Change-Id: Ie66064f3aaa1c74facfc025c8d87f3a057869779
Andrew Burgess [Mon, 18 Nov 2019 18:08:50 +0000 (18:08 +0000)]
gdb/testsuite: Fix minor bug in skip_btrace*tests procs
The two guard functions skip_btrace_tests and skip_btrace_pt_tests
have a minor bug, if the check function fails to compile then surely
we should skip the btrace tests - currently we return 0 to indicate
don't skip.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (skip_btrace_tests): Return 1 if the test fails to
compile.
(skip_btrace_pt_tests): Likewise.
Change-Id: I6dfc04b4adcf5b9424fb542ece7ddbe751bee301
Andrew Burgess [Mon, 4 Nov 2019 23:03:10 +0000 (23:03 +0000)]
gas/riscv: Produce version 3 DWARF CIE by default
The flag controlling the default DWARF CIE version to produce now
starts with the value -1. This can be modified with the command line
flag as before, but after command line flag processing, in
md_after_parse_args targets can, if the global still has the value -1,
override this value. This gives a target specific default.
If a CIE version is not select either by command line flag, or a
target specific default, then some new code in dwarf2_init now select
a global default. This remains as version 1 to match previous
behaviour.
This RISC-V has a target specific default of version provided, this
make the return column uleb128, which means we can use all DWARF
registers include CSRs.
I chose to switch to version 3 rather than version 4 as this is most
similar to the global default (version 1). Switching to version 4
adds additional columns to the CIE header.
gas/ChangeLog:
* as.c (flag_dwarf_cie_version): Change initial value to -1, and
update comment.
* config/tc-riscv.c (riscv_after_parse_args): Set
flag_dwarf_cie_version if it has not already been set.
* dwarf2dbg.c (dwarf2_init): Initialise flag_dwarf_cie_version if
needed.
* testsuite/gas/riscv/default-cie-version.d: New file.
* testsuite/gas/riscv/default-cie-version.s: New file.
ld/ChangeLog:
* testsuite/ld-elf/eh5.d: Accept version 3 DWARF CIE.
Change-Id: Ibbfe8f0979fba480bf0a359978b09d2b3055555e
Andrew Burgess [Mon, 4 Nov 2019 22:44:48 +0000 (22:44 +0000)]
gas: Check for overflow on return column in version 1 CIE DWARF
In version 1 of DWARF CIE format, the return register column is just a
single byte. For targets with large numbers of DWARF registers, any
use of a register with a high number for the return column
will (currently) silently overflow giving incorrect DWARF.
This commit adds an error when the overflow occurs.
gas/ChangeLog:
* dw2gencfi.c (output_cie): Error on return column overflow.
* testsuite/gas/riscv/cie-rtn-col-1.d: New file.
* testsuite/gas/riscv/cie-rtn-col-3.d: New file.
* testsuite/gas/riscv/cie-rtn-col.s: New file.
Change-Id: I1809f739ba7771737ec012807f0260e1a3ed5e64
Andrew Burgess [Mon, 18 Nov 2019 16:00:59 +0000 (16:00 +0000)]
binutils/gas/riscv: Add DWARF register numbers for CSRs
This commit gives DWARF register numbers to the RISC-V CSRs inline
with the RISC-V ELF specification here:
https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md
The CSRs are defined being numbered from 4096 to 8191.
This adds support to the assembler, required in order to reference
CSRs in, for example .cfi directives.
I have then extended dwarf.c in order to support printing CSR names in
the dumped DWARF output. As the CSR name space is quite large and
only sparsely populated, I have provided a new function to perform
RISC-V DWARF register name lookup which uses a switch statement rather
than the table base approach that other architectures use.
Any CSR that does not have a known name will return a name based on
'csr%d' with the %d being replaced by the offset of the CSR from 4096.
gas/ChangeLog:
* config/tc-riscv.c (tc_riscv_regname_to_dw2regnum): Lookup CSR
names too.
* testsuite/gas/riscv/csr-dw-regnums.d: New file.
* testsuite/gas/riscv/csr-dw-regnums.s: New file.
binutils/ChangeLog:
* dwarf.c (regname_internal_riscv): New function.
(init_dwarf_regnames_riscv): Use new function.
Change-Id: I3f70bc24fa8b3c75744e6775eeeb87db70c7ecfb
Andrew Burgess [Mon, 18 Nov 2019 15:28:20 +0000 (15:28 +0000)]
binutils: Make DWARF register name lookup be via a function pointer
Add a layer of indirection for DWARF register name lookup by
introducing a function pointer. Right now all targets use the same
table based implementation that they always have, however, this will
change in a later commit.
binutils/ChangeLog:
* dwarf.c (typedef dwarf_regname_lookup_ftype): New typedef.
(dwarf_regnames_lookup_func): New static global.
(init_dwarf_regnames_i386): Set dwarf_regnames_lookup_func.
(init_dwarf_regnames_iamcu): Likewise.
(init_dwarf_regnames_x86_64): Likewise.
(init_dwarf_regnames_aarch64): Likewise.
(init_dwarf_regnames_s390): Likewise.
(init_dwarf_regnames_riscv): Likewise.
(init_dwarf_regnames_by_elf_machine_code): Reset
dwarf_regnames_lookup_func to NULL.
(init_dwarf_regnames_by_bfd_arch_and_mach): Likewise.
(regname_internal_by_table_only): New function.
(regname): Make use of dwarf_regnames_lookup_func.
Change-Id: Ibbff61c0abea32927f35c9e478793039ab8bb57d
Andrew Burgess [Mon, 18 Nov 2019 12:13:24 +0000 (12:13 +0000)]
binutils: Make some functions static in dwarf.c
The architecture specific register name initialisation routines no
longer need to be externally visible, so make them static.
binutils/ChangeLog:
* dwarf.c (init_dwarf_regnames_i386): Make static.
(init_dwarf_regnames_iamcu): Make static.
(init_dwarf_regnames_x86_64): Make static.
(init_dwarf_regnames_aarch64): Make static.
(init_dwarf_regnames_s390): Make static.
(init_dwarf_regnames_riscv): Make static.
* dwarf.h (init_dwarf_regnames_i386): Delete declaration.
(init_dwarf_regnames_iamcu): Delete declaration.
(init_dwarf_regnames_x86_64): Delete declaration.
(init_dwarf_regnames_aarch64): Delete declaration.
(init_dwarf_regnames_s390): Delete declaration.
(init_dwarf_regnames_riscv): Delete declaration.
Change-Id: I9e350f76f98f46e9e3dd88d502f2a2a83e44cb36
Andrew Burgess [Mon, 18 Nov 2019 12:09:04 +0000 (12:09 +0000)]
binutils: Add a new function to initialise DWARF register name state
Adds a new API function init_dwarf_regnames_by_bfd_arch_and_mach to
initialise the register name state from a BFD architecture and machine
type.
There should be no user visible changes after this commit.
binutils/ChangeLog:
* dwarf.c (init_dwarf_regnames_by_bfd_arch_and_mach): New
function.
* dwarf.h (init_dwarf_regnames_by_bfd_arch_and_mach): Declare.
* objdump.c (dump_dwarf): Call new function instead of calling
specific initialization routines. Restrucure so that eh_addr_size
is still calculated correctly.
Change-Id: I346d665d2079a18ec4d04bd41893d0e9dc05e4b3
Andrew Burgess [Mon, 18 Nov 2019 11:56:51 +0000 (11:56 +0000)]
binutils: Rename init_dwarf_regnames
As part of a process to change how dwarf.c figures out the correct
name for a register I wanted to clean up how we initialise the
register name tracking state.
As part of this I rename init_dwarf_regnames to
init_dwarf_regnames_by_elf_machine_code, later commits will add a
different entry point to initialise the register name state.
There should be no user visible changes after this commit.
binutils/ChangeLog:
* dwarf.c (init_dwarf_regnames): Renamed to...
(init_dwarf_regnames_by_elf_machine_code): ...this.
* dwarf.h (init_dwarf_regnames): Renamed to...
(init_dwarf_regnames_by_elf_machine_code): ...this.
* readelf.c (process_file_header): Update call to use new name.
Change-Id: Ic8d2ef5fb62a8590ecd8cbb7e6258e11c6263594
Andrew Burgess [Tue, 29 Oct 2019 14:50:46 +0000 (14:50 +0000)]
binutils: Be more forgiving of targets with large numbers of registers
Currently if a target has a large ( > 1024 ) number of registers then
we get a warning when dumping the DWARF whenever a register over the
1024 limit is referenced, this occurs in dwarf.c:frame_need_space.
This check was initially introduced to guard against corrupted DWARF
referencing stupidly large numbers of registers.
The frame_need_space function already has a check in place so that, if
a target specifies a set of known DWARF register names then we must
only reference a register within this set, it is only after this check
that we check for the 1024 limit.
What this means is that if a target DOES NOT define a set of known
register names and if we reference more than 1024 registers
frame_need_space will give a warning.
If a target DOES define a set of known registers and there are more
than 1024 defined registers, and we try to reference a register beyond
1024 we will again get an error.
This second case feels wrong to me. My thinking is that if a target
defines a set of registers then it is not unreasonable to assume the
tools can cope with that number of registers. And so, if the target
defines 2000 named DWARF registers, frame_need_space should allow
access to all of these registers.
If a target does not define a set of named registers then the 1024
limit should remain. This is pretty arbitrary, but we do need to have
some limit in place I think, so for now that seems as good as any.
This is an entirely theoretical fix - there are no targets that define
such large numbers of registers, but while experimenting with adding
support for RISC-V CSRs I ran into this issue and felt like it was a
good improvement.
binutils/ChangeLog:
* dwarf.c (frame_need_space): Compare dwarf_regnames_count against
0, and only warn about large numbers of registers if the number is
more than the dwarf_regnames_count.
Change-Id: Ifac1a999ff0677676e81ee373c4c044b6a700827
Andrew Burgess [Tue, 29 Oct 2019 12:56:50 +0000 (12:56 +0000)]
gas/riscv: Remove unneeded structure
We build a hash table of all register classes and numbers. The hash
key is the register name and the hash value is the class and number
encoded into a single value, which is of type 'void *'.
When we pull the values out of the hash we cast them to be a pointer
to a structure, however, we never access the fields of that structure,
we just decode the register class and number from the pointer value
itself.
This commit removes the structure and treats the encoded class and
number as a 'void *' during hash lookup.
gas/ChangeLog:
* config/tc-riscv.c (struct regname): Delete.
(hash_reg_names): Handle value as 'void *'.
Change-Id: Ie7d8f46ca3798f56f4af94395279de684f87f9cc
GDB Administrator [Thu, 28 Nov 2019 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Christian Biesinger [Wed, 27 Nov 2019 21:41:25 +0000 (15:41 -0600)]
Add missing ChangeLog entry for the previous commit
Change-Id: Ibc5788e1879ece9cac637d5c99f92ff4084c8ba1
Christian Biesinger [Tue, 26 Nov 2019 21:59:36 +0000 (15:59 -0600)]
Add a NEWS entry for multithreaded symbol loading
Just to let people know that this is available and how to use it.
Also updates the description of the setting to say the default is 0.
gdb/ChangeLog:
2019-11-26 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention the new multithreaded symbol loading.
Change-Id: I263add6aae03b523f0870ad4d1e972eada4b382a
Christian Biesinger [Tue, 19 Nov 2019 02:48:36 +0000 (20:48 -0600)]
Turn off threaded minsym demangling by default
Per discussion on gdb-patches with Joel, this patch turns off multihreaded
symbol loading by default. It can be turned on using:
maint set worker-threads unlimited
To keep the behavior as close as possible to the old code, it still
calls symbol_set_names in the old place if n_worker_threads is 0.
gdb/ChangeLog:
2019-11-27 Christian Biesinger <cbiesinger@google.com>
* maint.c (n_worker_threads): Default to 0.
(worker_threads_disabled): New function.
* maint.h (worker_threads_disabled): New function.
* minsyms.c (minimal_symbol_reader::record_full): Call symbol_set_names
here if worker_threads_disabled () is true.
(minimal_symbol_reader::install): Skip all threading if
worker_threads_disabled () is true.
Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Christian Biesinger [Mon, 30 Sep 2019 21:47:37 +0000 (16:47 -0500)]
Compute msymbol hash codes in parallel
This is for the msymbol_hash and msymbol_demangled_hash hashtables
in objfile_per_bfd_storage. This basically computes those hash
codes together with the demangled symbol name in the background,
before it inserts the symbols in the hash table.
gdb/ChangeLog:
2019-11-27 Christian Biesinger <cbiesinger@google.com>
* minsyms.c (add_minsym_to_hash_table): Use a previously computed
hash code if possible.
(add_minsym_to_demangled_hash_table): Likewise.
(minimal_symbol_reader::install): Compute the hash codes for msymbol
on the background thread.
* symtab.h (struct minimal_symbol) <hash_value, demangled_hash_value>:
Add these fields.
Change-Id: Ifaa3346e9998f05743bff9e2eaad3f83b954d071
Christian Biesinger [Thu, 3 Oct 2019 18:05:06 +0000 (13:05 -0500)]
Precompute hash value for symbol_set_names
We can also compute the hash for the mangled name on a background
thread so make this function even faster (about a 7% speedup).
gdb/ChangeLog:
2019-11-27 Christian Biesinger <cbiesinger@google.com>
* minsyms.c (minimal_symbol_reader::install): Also compute the hash
of the mangled name on the background thread.
* symtab.c (symbol_set_names): Allow passing in the hash of the
linkage_name.
* symtab.h (symbol_set_names): Likewise.
Change-Id: I044449e7eb60cffc1c43efd3412f2b485bd9faac
Andrew Burgess [Wed, 27 Nov 2019 21:18:38 +0000 (21:18 +0000)]
gdb/testsuite: Fix race condition compiling fortran test
The Fortran test gdb.fortran/info-modules compiles the files
info-types.f90 and info-types-2.f90 in that order. Unfortunately
info-types.f90 makes use of a module defined in info-types-2.f90.
This currently doesn't cause a problem if you run all of the Fortran
tests as the info-types.exp test already compiles info-types-2.f90 and
so the module description file 'mod2.mod' will be created, and can
then be found by info-modules.exp during its compile.
If however you try to run just info-modules.exp in a clean build
directory, the test will fail to compile.
Fix this by compiling the source files in the reverse order so that
the module is compiled first, then the test program that uses the
module.
gdb/testsuite/ChangeLog:
* gdb.fortran/info-modules.exp: Compile source files in correct
order.
Change-Id: Ic3a1eded0486f6264ebe3066cf1beafbd2534a91
Kevin Buettner [Sun, 13 Oct 2019 06:12:29 +0000 (23:12 -0700)]
Test case for BZ 25065
Running a GDB with the fix for BZ 25065 should cause these new tests
to all pass.
When run against a GDB without the fix, there will be 2 unresolved
testcases. This is what I see in the gdb.sum file when I try it using
a GDB without the fix:
ERROR: GDB process no longer exists
UNRESOLVED: gdb.dwarf2/imported-unit.exp: ptype main::Foo
ERROR: Couldn't send ptype main::foo to GDB.
UNRESOLVED: gdb.dwarf2/imported-unit.exp: ptype main::foo
These are "unresolved" versus outright failures due to the fact that
GDB dies (segfaults) during the running of the test.
gdb/testsuite/ChangeLog:
* gdb.dwarf2/imported-unit.exp: New file.
* gdb.dwarf2/imported-unit.c: New file.
Change-Id: I073fe69b81bd258951615f752df8e95b6e33a271