Tom Tromey [Sat, 14 Nov 2020 16:44:56 +0000 (09:44 -0700)]
Use "bool" in fetch_inferior_event
A while back I noticed that fetch_inferior_event used "int" for
should_stop, whereas it can be bool. The method it is assigned from:
should_stop = thread_fsm->should_stop (thr);
... already returns bool.
Tested by rebuilding.
gdb/ChangeLog
2020-11-14 Tom Tromey <tom@tromey.com>
* infrun.c (fetch_inferior_event): Use "bool" for should_stop.
Tom Tromey [Sat, 14 Nov 2020 16:22:17 +0000 (09:22 -0700)]
Add use of const in opencl-lang.c
I found another expression-related spot that could use constification.
This patch adds it. Tested by rebuilding.
gdb/ChangeLog
2020-11-14 Tom Tromey <tom@tromey.com>
* opencl-lang.c (opencl_component_ref): Make "comps" const.
Simon Marchi [Sat, 14 Nov 2020 16:16:41 +0000 (11:16 -0500)]
gdb: fix comment in arm-tdep.c
gdb/ChangeLog:
* arm-tdep.c (class arm_instruction_reader) <read>: Fix comment.
Change-Id: I8f5355b314e8db643b645a6281042f514b46a908
Borislav Petkov [Sat, 14 Nov 2020 14:16:26 +0000 (06:16 -0800)]
x86: Ignore CS/DS/ES/SS segment-override prefixes in 64-bit mode
"In 64-bit mode, the CS, DS, ES, and SS segment-override prefixes have
no effect. These four prefixes are not treated as segment-override
prefixes for the purposes of multiple-prefix rules. Instead, they are
treated as null prefixes." (AMD APM v2).
However, objdump disassembles instructions containing those ignored
prefixes by still generating that segment override:
66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1)
00 00 00 00
Print those segment override prefixes as excessive ones:
66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1)
00 00 00 00
which is what they actually are - they have no effect and the decoding
hardware ignores them.
gas/
2020-11-14 Borislav Petkov <bp@suse.de>
* testsuite/gas/i386/x86-64-segovr.d: Adjust regexes.
* testsuite/gas/i386/x86-64-nops.d: Likewise.
* testsuite/gas/i386/x86-64-nops-1.d: Likewise.
* testsuite/gas/i386/x86-64-nops-1-g64.d: Likewise.
* testsuite/gas/i386/x86-64-nops-1-core2.d: Likewise.
* testsuite/gas/i386/x86-64-nops-1-k8.d: Likewise.
* testsuite/gas/i386/x86-64-nops-2.d: Likewise.
* testsuite/gas/i386/x86-64-nops-3.d: Likewise.
* testsuite/gas/i386/x86-64-nops-4.d: Likewise.
* testsuite/gas/i386/x86-64-nops-4-core2.d: Likewise.
* testsuite/gas/i386/x86-64-nops-4-k8.d: Likewise.
* testsuite/gas/i386/x86-64-nops-5.d: Likewise.
* testsuite/gas/i386/x86-64-nops-5-k8.d: Likewise.
* testsuite/gas/i386/x86-64-nops-7.d: Likewise.
* testsuite/gas/i386/x86-64-nop-1.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1a.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1b.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1c.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1d.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-1g.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-2c.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-6.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-7.d: Likewise.
* testsuite/gas/i386/x86-64-align-branch-8.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-1.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-2.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-3.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-4.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops-5.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-nops.d:: Likewise.
ld/
2020-11-14 Borislav Petkov <bp@suse.de>
* testsuite/ld-x86-64/pe-x86-64-4.od: Adjust regexes.
* testsuite/ld-x86-64/tlsld3.dd: Likewise.
* testsuite/ld-x86-64/tlsld4.dd: Likewise.
opcodes/
2020-11-14 Borislav Petkov <bp@suse.de>
* i386-dis.c (ckprefix): Do not assign active_seg_prefix in
64-bit addressing mode.
(NOTRACK_Fixup): Test prefixes for PREFIX_DS, instead of
active_seg_prefix.
Tom Tromey [Sat, 14 Nov 2020 02:40:29 +0000 (19:40 -0700)]
Use const more in c-lang.c
This changes a few functions in c-lang.c to add "const" to parameters
and return types. Tested by rebuilding.
gdb/ChangeLog
2020-11-13 Tom Tromey <tom@tromey.com>
* c-lang.c (convert_ucn, convert_octal, convert_hex)
(convert_escape, parse_one_string): Constify.
GDB Administrator [Sat, 14 Nov 2020 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 13 Nov 2020 23:44:35 +0000 (15:44 -0800)]
elf: Set rel_from_abs to 1 for __ehdr_start
bfdlink.h has
/* Symbol will be converted from absolute to section-relative. Set for
symbols defined by a script from "dot" (also SEGMENT_START or ORIGIN)
outside of an output section statement. */
unsigned int rel_from_abs : 1;
linker.c has
.{* Return TRUE if the symbol described by a linker hash entry H
. is going to be absolute. Linker-script defined symbols can be
. converted from absolute to section-relative ones late in the
. link. Use this macro to correctly determine whether the symbol
. will actually end up absolute in output. *}
.#define bfd_is_abs_symbol(H) \
. (((H)->type == bfd_link_hash_defined \
. || (H)->type == bfd_link_hash_defweak) \
. && bfd_is_abs_section ((H)->u.def.section) \
. && !(H)->rel_from_abs)
.
Set rel_from_abs to 1 for __ehdr_start which will be converted from
absolute to section-relative in assign_file_positions_for_load_sections.
PR ld/26869
* ldelf.c (ldelf_before_allocation): Set rel_from_abs to 1 for
__ehdr_start.
* testsuite/ld-i386/i386.exp: Run pr26869.
* testsuite/ld-i386/pr26869.d: New file.
* testsuite/ld-i386/pr26869.s: Likewise.
Keith Seitz [Fri, 13 Nov 2020 17:31:49 +0000 (09:31 -0800)]
Exclude debuginfo files from "outside of ELF segments" warning
When GDB loads an ELF file, it will warn when a section is not located
in an ELF segment:
$ ./gdb -q -iex "set build-id-verbose 0" --ex "b systemctl_main" -ex "r" -batch --args systemctl kexec
Breakpoint 1 at 0xc24d: file ../src/systemctl/systemctl.c, line 8752.
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libgcc_s.so.1
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libcap.so.2
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libacl.so.1
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libcryptsetup.so.12
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libgcrypt.so.20
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libip4tc.so.2
[snip]
This has feature has also been reported by various users, most notably
the Fedora-EOL'd bug
1553086.
Mark Wielaard explains the issue quite nicely in
https://sourceware.org/bugzilla/show_bug.cgi?id=24717#c2
The short of it is, the ELF program headers for debuginfo files are
not suited to this particular use case. Consequently, the warning
generated above really is useless and should be ignored.
This patch follows the same heuristic that BFD itself uses.
gdb/ChangeLog
2020-11-13 Keith Seitz <keiths@redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=
1553086
* elfread.c (elf_symfile_segments): Omit "Loadable section ...
outside of ELF segments" warning for debugin
Keith Seitz [Fri, 13 Nov 2020 17:28:50 +0000 (09:28 -0800)]
Add file name to "Loadable section ... outside of ELF segments" warning
As requested in gdb/23034, I would like to extend the warning message
GDB displays when it detects a loadable section that is outside any
ELF segment.
Before:
$ gdb -q --ex "b systemctl_main" -ex "r" -batch --args systemctl kexec
Breakpoint 1 at 0xc24d: file ../src/systemctl/systemctl.c, line 8752.
warning: Loadable section ".note.gnu.property" outside of ELF segments
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
warning: Loadable section ".note.gnu.property" outside of ELF segments
[snip]
Breakpoint 1, systemctl_main (argv=0x7fffffffd348, argc=2) at ../src/systemctl/systemctl.c:8752
8752 r = systemctl_main(argc, argv);
After:
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libcap.so.2
warning: Loadable section ".note.gnu.property" outside of ELF segments
in .gnu_debugdata for /lib64/libacl.so.1
[snip]
I think this is eminently more useful output.
gdb/ChangeLog
2020-11-13 Keith Seitz <keiths@redhat.com>
PR gdb/23034
* elfread.c (elf_symfile_segments): Output a BFD file name
for the "Loadable section ... outside of ELF segments" warning.
Simon Marchi [Fri, 13 Nov 2020 16:58:37 +0000 (11:58 -0500)]
gdb/arm: avoid undefined behavior shift when decoding immediate value
When loading the code file provided in PR 26828 and GDB is build with
UBSan, we get:
Core was generated by `./Foo'.
Program terminated with signal SIGABRT, Aborted.
#0 0xb6c3809c in pthread_cond_wait () from /home/simark/build/binutils-gdb/gdb/repo/lib/libpthread.so.0
[Current thread is 1 (LWP 29367)]
(gdb) bt
/home/simark/src/binutils-gdb/gdb/arm-tdep.c:1551:30: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
The sequence of instructions at pthread_cond_wait, in the
libpthread.so.0 library, contains this instruction with an immediate
constant with a "rotate amount" of 0:
e24dd044 sub sp, sp, #68 ; 0x44
Since arm_analyze_prologue shifts by "32 - rotate amount", it does a 32
bit shift of a 32 bit type, which is caught by UBSan.
Fix it by factoring out the decoding of immediates in a new function,
arm_expand_immediate.
I added a selftest for arm_analyze_prologue that replicates the
instruction sequence. Without the fix, it crashes GDB if it is build
with --enable-ubsan.
I initially wanted to re-use the abstract_memory_reader class already in
arm-tdep.c, used to make arm_process_record testable. However,
arm_process_record and arm_analyze_prologue don't use the same kind of
memory reading functions. arm_process_record uses a function that
returns an error status on failure while arm_analyze_prologue uses one
that throws an exception. Since i didn't want to introduce any other
behavior change, I decided to just introduce a separate interface
(arm_instruction_reader). It is derived from
abstract_instruction_reader in aarch64-tdep.c.
gdb/ChangeLog:
PR gdb/26835
* arm-tdep.c (class arm_instruction_reader): New.
(target_arm_instruction_reader): New.
(arm_analyze_prologue): Add instruction reader parameter and use
it. Use arm_expand_immediate.
(class target_arm_instruction_reader): Adjust.
(arm_skip_prologue): Adjust.
(arm_expand_immediate): New.
(arm_scan_prologue): Adjust.
(arm_analyze_prologue_test): New.
(class test_arm_instruction_reader): New.
Change-Id: Ieb1c1799bd66f8c7421384f44f5c2777b578ff8d
Joseph Myers [Fri, 13 Nov 2020 16:35:02 +0000 (16:35 +0000)]
Fix Windows-target testing in gdb_file_cmd
GCC for Windows target produces executables called foo.exe when given
"-o foo". (More specifically, it's done that for native compilers for
a long time, and for cross compilers to Windows target since GCC
commit
5bc86b599054f494ec0a45e49b82749320eaa9c4, in GCC 8 and later.)
This causes problems for many GDB tests expecting a program to have
the exact file name passed to -o.
Fix this by checking for the case where only the .exe exists in
gdb_file_cmd and adjusting the name passed to the file command
accordingly. There may well be other places with this issue in the
GDB testsuite, but this fix allows many tests to succeed that
previously fell over.
2020-11-12 Joseph Myers <joseph@codesourcery.com>
* lib/gdb.exp (gdb_file_cmd): Check for case where $arg.exe exists
but $arg does not.
Nick Clifton [Fri, 13 Nov 2020 16:02:39 +0000 (16:02 +0000)]
Fix readelf's and objdump's dislplay of DWO links when multiple links are present.
PR 26829
* dwarf.c (struct dwo_info): Add cu_offset field.
(add_dwo_info): Add cu_offset parameter. Record in new dwo_info
struct.
(add_dwo_name): Add cu_offset field.
(add_dwo_dir): Add cu_offset field.
(add_dwo_id): Add cu_offset field.
(read_and_display_attr_value): Pass cu_offset to dwo recording
functions.
(load_separate_debug_files): Accumulate name, dir and id values
and display once for each CU.
* testsuite/binutils-all/dwo.sL Use a separate CU for the second
dwo link.
* testsuite/binutils-all/readelf.k2: Update expected output.
Andrew Burgess [Fri, 13 Nov 2020 11:03:05 +0000 (11:03 +0000)]
gdb: delete a couple of declarations from f-lang.h
One declaration in f-lang.h is for a function that doesn't even exist,
another is for a function that is only used within f-lang.c.
One declaration is deleted, the other function I make static in
f-lang.c.
gdb/ChangeLog:
* f-lang.c (fortran_argument_convert): Add declaration. Add
header comment, taken from f-lang.h. Make static.
* f-lang.h (f77_get_dynamic_array_length): Delete declaration.
(fortran_argument_convert): Delete declaration.
Andre Vieira [Fri, 13 Nov 2020 08:59:48 +0000 (08:59 +0000)]
gas, arm: PR26858 Fix availability of single precision vmul/vmla in arm mode
This patch fixes a mistake when enabling MVE instructions that disabled support
for single precision vmla and vmul for arm mode.
gas/ChangeLog:
2020-11-12 Andre Vieira <andre.simoesdiasvieira@arm.com>
PR 26858
* config/tc-arm.c (asm_opcode insns): Fix vmul and vmla's ARM_VARIANT.
* testsuite/gas/arm/pr26858.s: New test.
* testsuite/gas/arm/pr26858.d: New test.
GDB Administrator [Fri, 13 Nov 2020 00:00:20 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 30 Oct 2020 20:40:59 +0000 (20:40 +0000)]
gdb: rewrite how per language primitive types are managed
Consider the following GDB session:
$ gdb
(gdb) set language c
(gdb) ptype void
type = void
(gdb) set language fortran
(gdb) ptype void
No symbol table is loaded. Use the "file" command.
(gdb)
With no symbol file loaded GDB and the language set to C GDB knows
about the type void, while when the language is set to Fortran GDB
doesn't know about the void, why is that?
In f-lang.c, f_language::language_arch_info, we do have this line:
lai->primitive_type_vector [f_primitive_type_void]
= builtin->builtin_void;
where we add the void type to the list of primitive types that GDB
should always know about, so what's going wrong?
It turns out that the primitive types are stored in a C style array,
indexed by an enum, so Fortran uses `enum f_primitive_types'. The
array is allocated and populated in each languages language_arch_info
member function. The array is allocated with an extra entry at the
end which is left as a NULL value, and this indicates the end of the
array of types.
Unfortunately for Fortran, a type is not assigned for each element in
the enum. As a result the final populated array has gaps in it, gaps
which are initialised to NULL, and so every time we iterate over the
list (for Fortran) we stop early, and never reach the void type.
This has been the case since 2007 when this functionality was added to
GDB in commit
cad351d11d6c3f6487cd.
Obviously I could just fix Fortran by ensuring that either the enum is
trimmed, or we create types for the missing types. However, I think a
better approach would be to move to C++ data structures and removed
the fixed enum indexing into the array approach.
After this commit the primitive types are pushed into a vector, and
GDB just iterates over the vector in the obvious way when it needs to
hunt for a type. After this commit all the currently defined
primitive types can be found when the language is set to Fortran, for
example:
$ gdb
(gdb) set language fortran
(gdb) ptype void
type = void
(gdb)
A new test checks this functionality.
I didn't see any other languages with similar issues, but I could have
missed something.
gdb/ChangeLog:
* ada-exp.y (find_primitive_type): Make parameter const.
* ada-lang.c (enum ada_primitive_types): Delete.
(ada_language::language_arch_info): Update.
* c-lang.c (enum c_primitive_types): Delete.
(c_language_arch_info): Update.
(enum cplus_primitive_types): Delete.
(cplus_language::language_arch_info): Update.
* d-lang.c (enum d_primitive_types): Delete.
(d_language::language_arch_info): Update.
* f-lang.c (enum f_primitive_types): Delete.
(f_language::language_arch_info): Update.
* go-lang.c (enum go_primitive_types): Delete.
(go_language::language_arch_info): Update.
* language.c (auto_or_unknown_language::language_arch_info):
Update.
(language_gdbarch_post_init): Use obstack_new, use array indexing.
(language_string_char_type): Add header comment, call function in
language_arch_info.
(language_bool_type): Likewise
(language_arch_info::bool_type): Define.
(language_lookup_primitive_type_1): Delete.
(language_lookup_primitive_type): Rewrite as a templated function
to call function in language_arch_info, then instantiate twice.
(language_arch_info::type_and_symbol::alloc_type_symbol): Define.
(language_arch_info::lookup_primitive_type_and_symbol): Define.
(language_arch_info::lookup_primitive_type): Define twice with
different signatures.
(language_arch_info::lookup_primitive_type_as_symbol): Define.
(language_lookup_primitive_type_as_symbol): Rewrite to call a
member function in language_arch_info.
* language.h (language_arch_info): Complete rewrite.
(language_lookup_primitive_type): Make templated.
* m2-lang.c (enum m2_primitive_types): Delete.
(m2_language::language_arch_info): Update.
* opencl-lang.c (OCL_P_TYPE): Delete.
(enum opencl_primitive_types): Delete.
(opencl_type_data): Delete.
(builtin_opencl_type): Delete.
(lookup_opencl_vector_type): Update.
(opencl_language::language_arch_info): Update, lots of content
moved from...
(build_opencl_types): ...here. This function is now deleted.
(_initialize_opencl_language): Delete.
* p-lang.c (enum pascal_primitive_types): Delete.
(pascal_language::language_arch_info): Update.
* rust-lang.c (enum rust_primitive_types): Delete.
(rust_language::language_arch_info): Update.
gdb/testsuite/ChangeLog:
* gdb.fortran/types.exp: Add more tests.
Simon Marchi [Thu, 12 Nov 2020 22:42:55 +0000 (17:42 -0500)]
gdb/dwarf: fix call to dwarf2_queue_guard in dw2_do_instantiate_symtab
It took me a while to understand why that would even compile: it looks
like we pass a type name as a pointer, that makes no sense. By looking
at the DWARF, I understood that the compiler actually interprets it as a
function declaration. So the statement was doing nothing, no
dwarf2_queue_guard was instantiated. Fix it by passing the right
variable name.
gdb/ChangeLog:
* dwarf2/read.c (dw2_do_instantiate_symtab): Fix call to
dwarf2_queue_guard.
Change-Id: I3a7bdead9e8c39f8342a471f10181b85b8f0d801
Dimitar Dimitrov [Thu, 12 Nov 2020 20:23:26 +0000 (22:23 +0200)]
sim: pru: Add support for LMBD instruction
Binutils support for LMBD instruction was merged [1]. So add it also
to simulator.
LMBD instruction does left-most-bit-detection. It returns 32 if
the given bit value is not found in the provided word value.
[1] https://sourceware.org/pipermail/binutils/2020-October/113901.html
sim/pru/ChangeLog:
* pru.h (RS1SEL): New macro.
(RS1_WIDTH): New macro.
* pru.isa: Describe the LMBD instruction.
sim/testsuite/sim/pru/ChangeLog:
* lmbd.s: New test.
Simon Marchi [Thu, 12 Nov 2020 19:59:35 +0000 (14:59 -0500)]
gdb/dwarf: fix typo in dwarf2/read.c
gdb/ChangeLog:
* dwarf2/read.c (dw2_do_instantiate_symtab): Fix typo in
comment.
Change-Id: I6cb98768c04a537cf3d427648bddc57c631518e5
Simon Marchi [Thu, 12 Nov 2020 19:43:58 +0000 (14:43 -0500)]
gdb: convert "set debug dwarf-read" to new style
Add dwarf_read_debug_printf and dwarf_read_debug_printf_v macros and use
them throughout dwarf2/read.c. The second one is used for "verbose"
prints, when the value of "set debug dwarf-read" is >= 2.
gdb/ChangeLog:
* dwarf2/read.c (dwarf_read_debug_printf,
dwarf_read_debug_printf_v): New macros, use throughout the file.
Change-Id: I694da69da2e1f2caa4c27a421a975790636411e2
Jozef Lawrynowicz [Thu, 12 Nov 2020 19:10:18 +0000 (19:10 +0000)]
MSP430: gas: Ignore -md option required for GCC backward compatibility
The redundant -md option was removed in
e4ae357fe8, but it is required
for backwards compatibility with GCC 10, which passes it to the
assembler implicitly in certain situations.
It is now silently ignored.
gas/ChangeLog:
* config/tc-msp430.c (OPTION_MOVE_DATA): Define.
(md_parse_option): Ignore OPTION_MOVE_DATA.
(md_longopts): Handle -md option.
* testsuite/gas/msp430/msp430.exp: Run new test.
* testsuite/gas/msp430/empty.s: New test.
* testsuite/gas/msp430/ignore-md.d: New test.
Shahab Vahedi [Thu, 12 Nov 2020 11:50:33 +0000 (12:50 +0100)]
arc: Write correct "eret" value during register collection
In collect_register() function of arc-linux-tdep.c, the "eret"
(exception return) register value was not being reported correctly.
This patch fixes that.
Background:
When asked for the "pc" value, we have to update the "eret" register
with GDB's STOP_PC. The "eret" instructs the kernel code where to
jump back when an instruction has stopped due to a breakpoint. This
is how collect_register() was doing so:
--------------8<--------------
if (regnum == gdbarch_pc_regnum (gdbarch))
regnum = ARC_ERET_REGNUM;
regcache->raw_collect (regnum, buf + arc_linux_core_reg_offsets[regnum]);
-------------->8--------------
Root cause:
Although this is using the correct offset (ERET register's), it is also
changing the REGNUM itself. Therefore, raw_collect (regnum, ...) is
not reading from "pc" anymore.
v2:
- Fix a copy/paste issue as rightfully addressed by Tom [1].
[1]
https://sourceware.org/pipermail/gdb-patches/2020-November/173208.html
gdb/ChangeLog:
* arc-linux-tdep.c (collect_register): Populate "eret" by
"pc" value from the regcache when asked for "pc" value.
Tom Tromey [Thu, 12 Nov 2020 15:47:09 +0000 (08:47 -0700)]
Fix Rust regression with -readnow
PR rust/26799 points out that a certain test case fails with -readnow.
This happens because, with -readnow, there are no partial symtabs; but
find_symbol_at_address requires these.
This patch fixes this problem by searching all of an objfile's
compunit symtabs if it does not have partial symbols.
Note that this test will still fail with .gdb_index. I don't think
that is readily fixable.
gdb/ChangeLog
2020-11-12 Tom Tromey <tom@tromey.com>
PR rust/26799:
* symtab.c (find_symbol_at_address): Search symtabs if no psymtabs
exist.
gdb/testsuite/ChangeLog
2020-11-12 Tom Tromey <tom@tromey.com>
PR rust/26799:
* gdb.rust/traits.exp: Remove kfails.
Gary Benson [Thu, 12 Nov 2020 15:05:22 +0000 (15:05 +0000)]
Fix gdb.threads/tls-so_extern.exp with Clang
Clang fails to compile gdb.threads/tls-so_extern_main.c, giving the
following error:
/gdbtest/src/gdb/testsuite/gdb.threads/tls-so_extern_main.c:28:1:
warning: non-void function does not return a value [-Wreturn-type]
This commit adds a return statement to the offending function.
gdb/testsuite/ChangeLog:
* gdb.threads/tls-so_extern_main.c (tls_ptr): Add missing return
statement.
Nick Clifton [Thu, 12 Nov 2020 13:22:26 +0000 (13:22 +0000)]
Fix up changelog entry of previous delta
Nick Clifton [Thu, 12 Nov 2020 12:22:18 +0000 (12:22 +0000)]
m32r sim: Add prototypes for functions that pass/return DI values
* m32r-sim.h (m32rbf_h_accum_get_handler): Always provide a
prototype for this function.
(m32rbf_h_accum_set_handler): Likewise.
(m32r2f_h_accums_get_handler): Prototype.
(m32r2f_h_accums_set_handler): Prototype.
Nick Clifton [Thu, 12 Nov 2020 11:43:20 +0000 (11:43 +0000)]
Stop Gas from generating line info or address ranges for sections that do not contain code or are not loaded.
PR 26850
* dwarf2dbg.c (dwarf2_gen_line_info_1): Do not record lines in
sections that are not executable or not loadable.
(out_debug_line): Move warning message into dwarf2_gen_line_info_1.
* testsuite/gas/elf/dwarf2-20.s: New test.
* testsuite/gas/elf/dwarf2-20.d: New test driver.
* testsuite/gas/elf/elf.exp: Run the new test.
* testsuite/gas/elf/warn-2.s: Use the .nop directive.
Andrew Burgess [Sun, 11 Oct 2020 18:26:59 +0000 (19:26 +0100)]
gdb: add an option flag to 'maint print c-tdesc'
GDB has two approaches to generating the target descriptions found in
gdb/features/, the whole description approach, where the XML file
contains a complete target description which is then used to generate
a single C file that builds that target description. Or, the split
feature approach, where the XML files contain a single target feature,
each feature results in a single C file to create that one feature,
and then a manually written C file is used to build a complete target
description from individual features.
There's a Makefile, gdb/features/Makefile, which is responsible for
managing the regeneration of the C files from the XML files.
However, some of the logic that selects between the whole description
approach, or the split feature approach, is actually hard-coded into
GDB, inside target-descriptions.c:maint_print_c_tdesc_cmd we check the
path to the incoming XML file and use this to choose which type of C
file we should generate.
This commit removes this hard coding from GDB, and makes the Makefile
entirely responsible for choosing the approach. This makes sense as
the Makefile already has the XML files partitioned based on which
approach they should use.
In order to allow this change the 'maint print c-tdesc' command is
given a new command option '-single-feature', which tells GDB which
type of C file should be created. The makefile now supplies this flag
to GDB.
This did reveal a bug in features/Makefile, the rx.xml file was in the
wrong list, this didn't matter previously as the actual choice of
which approach to use was done in GDB. Now the Makefile decides, so
placing each XML file in the correct list is critical.
Tested this by doing 'make GDB=/path/to/gdb clean-cfiles cfiles' to
regenerate all the C files from their XML source. There are no
changes after this commit.
gdb/ChangeLog:
* features/Makefile (XMLTOC): Add rx.xml.
(FEATURE_XMLFILES): Remove rx.xml.
(FEATURE_CFILES rule): Pass '-single-feature' flag.
* features/rx.c: Regenerate.
* features/rx.xml: Wrap in `target` tags, and reindent.
* target-descriptions.c (struct maint_print_c_tdesc_options): New
structure.
(maint_print_c_tdesc_opt_def): New typedef.
(maint_print_c_tdesc_opt_defs): New static global.
(make_maint_print_c_tdesc_options_def_group): New function.
(maint_print_c_tdesc_cmd): Make use of command line flags, only
print single feature C file for target descriptions containing a
single feature.
(maint_print_c_tdesc_cmd_completer): New function.
(_initialize_target_descriptions): Update call to register command
completer, and include command line flag in help text.
gdb/doc/ChangeLog:
* gdb.texinfo (Maintenance Commands): Update description of 'maint
print c-tdesc'.
GDB Administrator [Thu, 12 Nov 2020 00:00:15 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Wed, 11 Nov 2020 16:18:10 +0000 (11:18 -0500)]
gdb/testsuite: add "breakpoint always-inserted" axis in gdb.base/continue-after-aborted-step-over.exp
The test gdb.base/continue-after-aborted-step-over.exp fails on ROCm GDB
[1] when using the unix board (when debugging a standard x86-64/Linux
program), with:
(gdb) b *0^M
Breakpoint 2 at 0x0^M
Warning:^M
Cannot insert breakpoint 2.^M
Cannot access memory at address 0x0^M
^M
(gdb) FAIL: gdb.base/continue-after-aborted-step-over.exp: displaced-stepping=off: b *0
This happens because that build of GDB defaults to "set breakpoint
always-inserted on", for reasons that are unrelevant to explain here.
As soon as the breakpoint is created, GDB tries to insert it and
(expectedly) fails. This causes more text to be output than what the
pattern expects.
It is actually be relevant to run the test with both "set breakpoint
always-inserted" on and off. With it on, it mimics what happens when
running in non-stop mode, with other threads running. This is relevant
for upstream even outside of the ROCm port, so here's a patch for it.
Add this other axis and adjust the "b *0" test to handle the extra
output when it is on.
[1] https://github.com/ROCm-Developer-Tools/ROCgdb
gdb/testsuite/ChangeLog:
* gdb.base/continue-after-aborted-step-over.exp: Add "breakpoint
always-inserted" axis.
(do_test): Add breakpoint_always_inserted parameter.
Change-Id: I95126cae563a0b9a72f4a99627809fc34340cd5e
Przemyslaw Wirkus [Wed, 11 Nov 2020 15:28:48 +0000 (15:28 +0000)]
aarch64: Allow LS64 feature with Armv8.6
Allow users to use LS64 extension with Armv8.6 architecture.
Bernd Edlinger [Wed, 11 Nov 2020 14:31:46 +0000 (14:31 +0000)]
readelf: Fix output of rnglists section
* dwarf.c (display_debug_rnglists_list): Only bias the
DW_RLS_offset_pair with the base address.
Tom Tromey [Tue, 10 Nov 2020 16:15:31 +0000 (09:15 -0700)]
Fix Windows-x-PPC build
A recent BFD change caused a build failure for a Windows->PPC cross:
ld.exe: ../bfd/libbfd.a(coff-rs6000.o):coff-rs6000.c:(.text+0x4571): undefined reference to `getuid'
ld.exe: ../bfd/libbfd.a(coff-rs6000.o):coff-rs6000.c:(.text+0x457e): undefined reference to `getgid'
This patch fixes the problem by moving the replacement definitions of
getuid and getgid to system.h.
bfd/ChangeLog
2020-11-11 Tom Tromey <tromey@adacore.com>
* archive.c (getuid, getgid): Move...
* sysdep.h (getuid, getgid): ...here.
Andrew Burgess [Wed, 11 Nov 2020 11:55:08 +0000 (11:55 +0000)]
gdb/riscv: add ability to decode dwarf CSR numbers
Extends riscv_dwarf_reg_to_regnum to add the ability to convert the
DWARF register numbers for CSRs into GDB's internal numbers.
gdb/ChangeLog:
* riscv-tdep.c (riscv_dwarf_reg_to_regnum): Decode DWARF CSR
numbers.
* riscv-tdep.h (RISCV_DWARF_FIRST_CSR, RISCV_DWARF_LAST_CSR): New
enum values.
Andrew Burgess [Tue, 10 Nov 2020 17:54:05 +0000 (17:54 +0000)]
gdbserver: add missing --disable-packet options to help text
The help text for the --disable-packet option was missing one of the
possible values.
As this option is for maintainers only it is explicitly not documented
in gdb/doc/gdb.texinfo, so no update is needed there.
gdbserver/ChangeLog:
* server.cc (gdbserver_usage): Add missing option to usage text.
(gdbserver_show_disableable): Likewise.
GDB Administrator [Wed, 11 Nov 2020 00:00:11 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 10 Nov 2020 22:46:17 +0000 (15:46 -0700)]
Make internalvar_name return a const char *
This changes internalvar_name to return a const char *.
gdb/ChangeLog
2020-11-10 Tom Tromey <tom@tromey.com>
* value.h (internalvar_name): Update.
* value.c (internalvar_name): Make return type const.
Tom Tromey [Tue, 10 Nov 2020 22:46:17 +0000 (15:46 -0700)]
Use "const" more in ax-gdb.c
This changes a few spots in ax-gdb.c to use a "const char *" rather
than a non-const one.
gdb/ChangeLog
2020-11-10 Tom Tromey <tom@tromey.com>
* ax-gdb.c (gen_struct_elt_for_reference, gen_namespace_elt)
(gen_maybe_namespace_elt, gen_aggregate_elt_ref, gen_expr): Use
const.
Tom Tromey [Tue, 10 Nov 2020 22:46:17 +0000 (15:46 -0700)]
Constify value_nsstring
This changes the "ptr" parameter to value_nsstring to be const.
gdb/ChangeLog
2020-11-10 Tom Tromey <tom@tromey.com>
* objc-lang.h (value_nsstring): Update.
* objc-lang.c (value_nsstring): Make "ptr" const.
Tom Tromey [Mon, 9 Nov 2020 13:55:39 +0000 (06:55 -0700)]
Move include block to pathstuff.h
A recent commit caused pathstuff.cc to fail to compile on mingw, like:
../../binutils-gdb/gdbsupport/pathstuff.cc:324:1: error: no previous declaration for 'std::string find_gdb_home_config_file(const char*, _stati64*)' [-Werror=missing-declarations]
Some newly-added #includes were changing which "stat" was being seen
by the compiler. This patch moves the includes to the header, so that
the declaration and definition now agree.
2020-11-10 Tom Tromey <tromey@adacore.com>
PR build/26848:
* pathstuff.h: Move include block here...
* pathstuff.cc: ... from here.
Nick Clifton [Tue, 10 Nov 2020 17:31:14 +0000 (17:31 +0000)]
oops - forgot to include the changelog update for the latest binutils/dwarf.c patch
Tom Tromey [Tue, 10 Nov 2020 17:06:08 +0000 (10:06 -0700)]
Fix bug in gdb.ada/bias.exp
While working on a different bug in the Ada support, I found that the
gdb.ada/bias.exp test is slightly incorrect. In particular, it is
using a range type, which it then overflows during an operation.
This patch changes the test so that the computed values remain in
range.
gdb/testsuite/ChangeLog
2020-11-10 Tom Tromey <tromey@adacore.com>
* gdb.ada/bias.exp: Update.
* gdb.ada/bias/bias.adb (X): Change value.
Gary Benson [Tue, 10 Nov 2020 16:40:40 +0000 (16:40 +0000)]
Prevent false passes in gdb.base/vla-optimized-out.exp
The "vla_optimized_out" procedure in gdb.base/vla-optimized-out.exp
accepts a "sizeof_result" argument which is substituted into the
regular expression used to check the result of printing the sizeof
a VLA. The -O3 test variants, however, pass a regular expression
fragment as that argument, which expands into a regular expression
that matches any result with a "6" in it. This commit wraps the
substitution with parentheses to prevent these false matches.
gdb/testsuite/ChangeLog:
* gdb.base/vla-optimized-out.exp (p sizeof (a)): Wrap supplied
regexp fragment in parentheses to prevent false matching.
Gary Benson [Tue, 10 Nov 2020 16:40:40 +0000 (16:40 +0000)]
Prevent inlining in gdb.base/vla-optimized-out.c
The function f1 in gdb.base/vla-optimized-out.c sets various
attributes to prevent its being inlined, but Clang inlines it
anyway, causing the test that uses it to fail. This commit
adds the "weak" attribute to cause Clang to keep the function
fully out of line so the test can operate as it should.
gdb/testsuite/ChangeLog:
* gdb.base/vla-optimized-out.c (f1): Add __attribute__ ((weak)).
Gary Benson [Tue, 10 Nov 2020 16:07:36 +0000 (16:07 +0000)]
Fix gdb.cp/step-and-next-inline.exp with Clang
Clang fails to compile gdb.cp/step-and-next-inline.cc, with the
following error:
clang-12: error: unknown argument: '-gstatement-frontiers'
compiler exited with status 1
This commit fixes the testcase by only passing -gstatement-frontiers
when building with GCC. This commit also alters two checks marked as
known failures, to mark them as known failures only when built using
GCC.
gdb/testsuite/ChangeLog:
* gdb.cp/step-and-next-inline.exp: Only require
-gstatement-frontiers when building with GCC.
Only setup KFAIL's for GCC issues when using
a GCC-built executable.
Nick Clifton [Tue, 10 Nov 2020 11:55:18 +0000 (11:55 +0000)]
Accept the DW_FORM_ref8 type when parsing DWARF types.
* dwarf.c (skip_attr_bytes): Correctly handle DW_FORM_ref8.
(get_type_abbrev_from_form): Accept DW_FORM_ref8.
GDB Administrator [Tue, 10 Nov 2020 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Nick Clifton [Mon, 9 Nov 2020 16:47:29 +0000 (16:47 +0000)]
Revert delta accidentally applied with commit
9372689d72f902c8bae90536acc4747fb0a4b1e1
Denys Zagorui [Mon, 9 Nov 2020 15:39:10 +0000 (15:39 +0000)]
gas: improve reproducibility for stabs debugging data format
* config/obj-elf (obj_elf_init_stab_section): Improve
reproducibility for stabs debugging data format
Alan Modra [Mon, 9 Nov 2020 12:53:34 +0000 (23:23 +1030)]
asan: vms-alpha: stack buffer overflow
32 bits is too big for the field.
* vms-alpha.c (alpha_vms_write_exec): Write 16 bits to eihd.alias.
Spencer E. Olson [Mon, 9 Nov 2020 12:41:09 +0000 (12:41 +0000)]
Add support for the LMBD (left-most bit detect) instruction to the PRU assembler.
include * opcode/pru.h: Add LMBD (left-most bit detect) opcode index
opcodes * pru-opc.c: Add opcode description for LMBD (left-most bit detect)
gas * testsuite/gas/pru/misc.s: Add tests for lmbd (left-most bit detect)
* testsuite/gas/pru/misc.d: Add tests for lmbd (left-most bit
Przemyslaw Wirkus [Mon, 9 Nov 2020 11:30:22 +0000 (11:30 +0000)]
aarch64: Update LS64 feature with system register
This patch:
+ Adds new ACCDATA_EL1 (Accelerator Data) system register, see [0].
+ Adds LS64 instruction tests.
+ Update LS64 feature test with new register.
+ Fix comment for AARCH64_OPND_Rt_LS64.
[0] https://developer.arm.com/docs/ddi0595/i/aarch64-system-registers/accdata_el1
Note: as this is register only extension we do not want to hide these
registers behind -march flag going forward (they should be enabled by
default).
Przemyslaw Wirkus [Mon, 9 Nov 2020 11:09:12 +0000 (11:09 +0000)]
aarch64: Limit Rt register number for LS64 load/store instructions
Atomic 64-byte load/store instructions limit Rt register number to
values matching below condition (register <Xt> number must be even
and <= 22):
if Rt<4:3> == '11' || Rt<0> == '1' then UNDEFINED;
This patch adds check if Rt fulfills above requirement.
For more details regarding atomic 64-byte load/store instruction for
Armv8.7 please refer to Arm A64 Instruction set documentation for
Armv8-A architecture profile, see document page 157 for load
instruction, and pages 414-418 for store instructions of [0].
[0]: https://developer.arm.com/docs/ddi0596/i
Andreas Schwab [Sat, 7 Nov 2020 20:28:47 +0000 (21:28 +0100)]
Fix regexp for development.exp
binutils/:
* Makefile.am (development.exp): Fix regexp.
* Makefile.in: Regenerate.
gas/:
* Makefile.am (development.exp): Fix regexp.
* Makefile.in: Regenerate.
ld/:
* Makefile.am (development.exp): Fix regexp.
* Makefile.in: Regenerate.
Nick Clifton [Mon, 9 Nov 2020 10:37:51 +0000 (10:37 +0000)]
Extend the DWARF decoder to display FORM names when operating in wide mode.
PR 26847
* dwarf.c (read_and_display_attr_value): In wide mode, display the
name of the form.
Alan Modra [Sun, 8 Nov 2020 23:09:53 +0000 (09:39 +1030)]
elfedit false "may be used uninitialised"
elfedit.c:904:15: error: 'osabi' may be used uninitialised in this function [-Werror=maybe-uninitialized]
904 | osabi = concat (osabi, "|", osabis[i].name, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* elfedit (usage): Avoid false positive "may be used uninitialised".
Don't leak memory.
Alan Modra [Mon, 9 Nov 2020 02:34:04 +0000 (13:04 +1030)]
xcoff dependency list for static libraries
This patch fixes fails adding library dependencies for xcoff, and
improves the error message should stat fail for an archive member.
"tmpdir/artest.a: File not found" is plainly wrong.
Fixes these fails:
powerpc-aix5.1 +FAIL: ar adding library dependencies
powerpc-aix5.2 +FAIL: ar adding library dependencies
rs6000-aix4.3.3 +FAIL: ar adding library dependencies
rs6000-aix5.1 +FAIL: ar adding library dependencies
rs6000-aix5.2 +FAIL: ar adding library dependencies
* archive.c (bfd_ar_hdr_from_filesystem): Use bfd_set_input_error
when stat of archive member fails.
* coff-rs6000.c (xcoff_write_archive_contents_old),
(xcoff_write_archive_contents_big): Likewise, and handle in-memory
bfd.
Howard Chu [Sun, 8 Nov 2020 15:07:28 +0000 (15:07 +0000)]
Re: dependency list for static libraries
This feature doesn't actually require plugin support, that was a
mistake in the previous patch. Fixes these fails:
hppa-hp-hpux10 +FAIL: ar adding library dependencies
i386-bsd +FAIL: ar adding library dependencies
i386-msdos +FAIL: ar adding library dependencies
ns32k-netbsd +FAIL: ar adding library dependencies
ns32k-pc532-mach +FAIL: ar adding library dependencies
pdp11-dec-aout +FAIL: ar adding library dependencies
* ar.c (main): Use plugin_target rather than "target" when
resetting libdeps_bfd target.
Nelson Chu [Mon, 19 Oct 2020 05:10:42 +0000 (22:10 -0700)]
RISC-V: Update ABI to the elf_flags after parsing elf attributes.
Originally, if the -mabi option isn't set, then assembler will set the
abi according to the architecture string in the riscv_after_parse_args.
But we should also check and reset the abi later since the architecture
string may be reset by the elf attributes. Therefore, set the abi to
the elf_flags in the riscv_after_parse_args seems too early. Besides,
we have to set the abi_xlen before assembling any instruction, so it
should be safe to call riscv_set_abi_by_arch at the place that we set
start_assemble to TRUE. However, one minor case is that we won't call
the md_assemble when we are assembling an file without any instruction.
It seems that we still need to set the abi in riscv_elf_final_processing,
to make sure that abi can be updated according to the elf arch attributes.
For the rv32i and most elf toolchains, this patch can fix the mis-matched
ABI errors for Run pr26391-5 and Run pr26391-6 testcases. Besides, it
also correct the elf header flags of the output objects. Consider the
new testcases, mabi-fail-02 and mabi-noabi-attr-[01|02|03], they are
failed before applying this patch.
But I still get the mis-matched ABI errors for the following toolchains
when runnung the riscv-gnu-toolchain regressions,
newlib-rv32imafc-ilp32f-[medlow|medany]
linux-rv32imac-ilp32-[medlow|medany]
linux-rv32imafdc-ilp32-[medlow|medany}
linux-rv64imac-lp64-[medlow|medany]
linux-rv64imafdc-lp64-[medlow|medany}
For the newlib-rv32imafc-ilp32f, although we try to choose the abi
according to the elf attributes, we will use FLOAT_ABI_SOFT rather
than the FLOAT_ABI_SINGLE for the assmebly file wihtout setting the
-mabi, but compiler will set the abi to FLOAT_ABI_SINGLE for the
C files.
As for the linux toolchains, we also get fails for Run pr26391-5 and
Run pr26391-6 testcases. Since the linux toolchain won't generate elf
attributes to correct the ISA, and the --with-arch configure option
isn't set, assembler will try to set the default arch to rv[32|64]g,
which means the FLOAT_ABI_DOUBLE will be choosed, and may be conflict
with the abi set by the toolchain.
Therefore, I would suggest that it's is more safe to set the --with-arch
when building binutils, but it may break some testcases. For example,
ld-scripts/fill and ld-scripts/empty-address-2 may be broken when c-ext
is set. We might insert R_RISCV_ALIGN to make sure the 4-byte alignment,
but the dump result will be a bit different from what the testcase expected.
However, this patch only fix the problem - the abi, elf_flags and the
instruction, which is generated according to the abi_xlen, are all fixed
once the elf attributes are set for most elf toolchains. Other mis-matched
ABI problems should be fixed when we always build the binutils with the
--with-arch= configure option.
gas/
* config/tc-riscv.c (explicit_mabi): New boolean to indicate if
the -mabi= option is explictly set.
(md_parse_option): Set explicit_mabi to TRUE if -mabi is set.
(riscv_set_abi_by_arch): New function. If the -mabi option isn't
set, then we set the abi according to the architecture string.
Otherwise, check if there are conflicts between architecture
and abi setting.
(riscv_after_parse_args): Move the abi setting to md_assemble nad
riscv_elf_final_processing.
(md_assemble): Call the riscv_set_abi_by_arch when we set the
start_assemble to TRUE.
(riscv_elf_final_processing): Likewise, in case the file without
any instruction.
* testsuite/gas/riscv/mabi-attr-01.s: New testcase.
* testsuite/gas/riscv/mabi-attr-02.s: Likewise.
* testsuite/gas/riscv/mabi-attr-03.s: Likewise.
* testsuite/gas/riscv/mabi-fail-01.d: Likewise.
* testsuite/gas/riscv/mabi-fail-01.l: Likewise.
* testsuite/gas/riscv/mabi-fail-02.d: Likewise.
* testsuite/gas/riscv/mabi-fail-02.l: Likewise.
* testsuite/gas/riscv/mabi-noabi-attr-01a.d: Likewise.
* testsuite/gas/riscv/mabi-noabi-attr-01b.d: Likewise.
* testsuite/gas/riscv/mabi-noabi-attr-02a.d: Likewise.
* testsuite/gas/riscv/mabi-noabi-attr-02b.d: Likewise.
* testsuite/gas/riscv/mabi-noabi-attr-03a.d: Likewise.
* testsuite/gas/riscv/mabi-noabi-attr-03b.d: Likewise.
* testsuite/gas/riscv/mabi-noabi-march-01.d: Likewise.
* testsuite/gas/riscv/mabi-noabi-march-02.d: Likewise.
* testsuite/gas/riscv/mabi-noabi-march-03.d: Likewise.
GDB Administrator [Mon, 9 Nov 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Sun, 8 Nov 2020 12:10:01 +0000 (04:10 -0800)]
gold: Avoid sharing Plugin_list::iterator
class Plugin_manager has
// A pointer to the current plugin. Used while loading plugins.
Plugin_list::iterator current_;
The same iterator is shared by all threads. It is OK to use it to load
plugins since only one thread loads plugins. Avoid sharing Plugin_list
iterator in all other cases.
PR gold/26200
* plugin.cc (Plugin_manager::claim_file): Don't share Plugin_list
iterator.
(Plugin_manager::all_symbols_read): Likewise.
(Plugin_manager::cleanup): Likewise.
GDB Administrator [Sun, 8 Nov 2020 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 7 Nov 2020 00:00:17 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Fri, 6 Nov 2020 13:40:22 +0000 (13:40 +0000)]
gdb: fix debug expression dumping of function call expressions
In commit:
commit
6d81691950f8c4be4a49a85a672255c140e82468
CommitDate: Sat Sep 19 09:44:58 2020 +0100
gdb/fortran: Move Fortran expression handling into f-lang.c
A bug was introduced that broke GDB's ability to perform debug dumps
of expressions containing function calls. For example this would no
longer work:
(gdb) set debug expression 1
(gdb) print call_me (&val)
Dump of expression @ 0x4eced60, before conversion to prefix form:
Language c, 12 elements, 16 bytes each.
Index Opcode Hex Value String Value
0 OP_VAR_VALUE 40 (...............
1 OP_M2_STRING
79862864 P...............
2 unknown opcode: 224
79862240 ................
3 OP_VAR_VALUE 40 (...............
4 OP_VAR_VALUE 40 (...............
5 OP_RUST_ARRAY
79861600 `...............
6 UNOP_PREDECREMENT
79861312 @...............
7 OP_VAR_VALUE 40 (...............
8 UNOP_ADDR 61 =...............
9 OP_FUNCALL 46 ................
10 BINOP_ADD 1 ................
11 OP_FUNCALL 46 ................
Dump of expression @ 0x4eced60, after conversion to prefix form:
Expression: `call_me (&main::val, VAL(Aborted (core dumped)
The situation was even worse for Fortran function calls, or array
indexes, which both make use of the same expression opcode.
The problem was that in a couple of places the index into the
expression array was handled incorrectly causing GDB to interpret
elements incorrectly. These issues are fixed in this commit.
There are already some tests to check GDB when 'set debug expression
1' is set, these can be found in gdb.*/debug-expr.exp. Unfortunately
the cases above were not covered.
In this commit I have cleaned up all of the debug-expr.exp files a
little, there was a helper function that had clearly been copied into
each file, this is now moved into lib/gdb.exp.
I've added a gdb.fortran/debug-expr.exp test file, and extended
gdb.base/debug-expr.exp to cover the function call case.
gdb/ChangeLog:
* expprint.c (print_subexp_funcall): Increment expression position
after reading argument count.
* f-lang.c (print_subexp_f): Skip over opcode before calling
common function.
(dump_subexp_body_f): Likewise.
gdb/testsuite/ChangeLog:
* gdb.base/debug-expr.c: Add extra function to allow for an
additional test.
* gdb.base/debug-expr.exp (test_debug_expr): Delete, replace calls
to this proc with gdb_test_debug_expr. Add an extra test.
* gdb.cp/debug-expr.exp (test_debug_expr): Delete, replace calls
to this proc with gdb_test_debug_expr, give the tests names
* gdb.dlang/debug-expr.exp (test_debug_expr): Delete, replace
calls to this proc with gdb_test_debug_expr, give the tests names
* gdb.fortran/debug-expr.exp: New file.
* gdb.fortran/debug-expr.f90: New file.
* lib/gdb.exp (gdb_test_debug_expr): New proc.
Simon Marchi [Fri, 6 Nov 2020 18:09:58 +0000 (13:09 -0500)]
gdb/testsuite: make DWARF assembler's ranges' "base" and "range" procs
When creating a .debug_ranges section using the testsuite's DWARF
assembler, it currently looks like this:
ranges {
sequence {
{base ...}
{range ...}
{range ...}
}
}
The sub-tree of sequence is manually traversed as a list of lists. I
think it would be nicer if `base` and `range` where procedure, just like
the other levels:
ranges {
sequence {
base ...
range ...
range ...
}
}
That makes the implementation more robust, and the usage a bit nicer
(less special characters). It also allows having comments in between
the range list entries:
ranges {
sequence {
base ...
range ...
# Hello world.
range ...
}
}
... which doesn't work with the current approach.
gdb/testsuite/ChangeLog:
* lib/dwarf.exp (ranges): Handle "base" and "range" as
proceduresu.
* gdb.dwarf/dw2-bad-elf.exp: Adjust.
* gdb.dwarf2/dw2-inline-many-frames.exp: Adjust.
* gdb.dwarf2/dw2-inline-stepping.exp: Adjust.
* gdb.dwarf2/dw2-ranges-base.exp: Adjust.
* gdb.dwarf2/dw2-ranges-func.exp: Adjust.
* gdb.dwarf2/dw2-ranges-overlap.exp: Adjust.
* gdb.dwarf2/dw2-ranges-psym.exp: Adjust.
* gdb.dwarf2/enqueued-cu-base-addr.exp: Adjust.
Change-Id: I0b2af480faff54d0fd4214e0cc8d042d9583a865
Romain Geissler [Fri, 6 Nov 2020 17:47:21 +0000 (17:47 +0000)]
gdb: better static python detection in configure machinery
In python 3, itertools is a builtin module, so whether or not the
python you link against is a shared or a static one, importing it
works.
Change the import test to use ctypes which is a dynamic module in both
python 2 and 3.
gdb/ChangeLog:
PR python/26832
* configure: Regenerate.
* configure.ac: Check for python modules ctypes instead of
itertools.
Pedro Alves [Fri, 6 Nov 2020 17:19:02 +0000 (17:19 +0000)]
Split macro_buffer in two classes, fix Clang build
GDB currently fails to build with (at least) Clang 10 and 11, due to:
$ make
CXX macroexp.o
../../src/gdb/macroexp.c:125:3: error: definition of implicit copy constructor for 'macro_buffer' is deprecated because it has a user-declared destructor [-Werror,-Wdeprecated-copy-dtor]
~macro_buffer ()
^
Now, we could just add the copy constructor, like we already have a
copy assignment operator. And like that assignment operator, we would
assert that only shared buffers can be copied from.
However, it is hard to see why only shared buffers need to be copied.
I mean, it must be true, otherwise macro support would be broken,
since currently GDB is relying on the default implementation of the
copy constructor, which just copies the fields, which can't work
correctly for the non-shared version. Still, it's not easy to tell
from the code that that is indeed correct, that there isn't some
corner case that would require copying a non-shared buffer.
Or to put it simply - the tangling of shared and non-shared buffers in
the same macro_buffer struct makes this structure hard to understand.
My reaction was -- try splitting the macro_buffer class into two
classes, one for non-shared buffers, and another for shared buffers.
Comments and asserts like these:
...
SRC must be a shared buffer; DEST must not be one. */
static void
scan (struct macro_buffer *dest,
struct macro_buffer *src,
struct macro_name_list *no_loop,
const macro_scope &scope)
{
gdb_assert (src->shared);
gdb_assert (! dest->shared);
... made me suspect it should be possible. Then after the split it
should be easier to reimplement either of the classes if we want.
So I decided to try splitting the struct in two distinct types, and
see where that leads. It turns out that there is really no good
reason for a single struct, no code that wants to work with either
shared or non-shared buffers. It's always shared for input being
parsed, and non-shared for output.
This commit is the result. I named the new classes
shared_macro_buffer and growable_macro_buffer.
A future direction could be for example to make shared_macro_buffer
wrap a string_view and growable_macro_buffer a std::string. With that
in mind, other than text/len, only the 'last_token' field is common to
both classes. I didn't feel like creating a base class just for that
single field.
I constified shared_macro_buffer's 'text' field, which of course had
some knock-on effects, fixed in the patch.
On the original warning issued by Clang -- now it is clear that only
the shared version needs to be copied. Since this class doesn't need
a user-declared destructor, the default implementations of the copy
assign/ctor can be used, and Clang no longer warns.
The growable version doesn't need to be copied, so I disabled
copy/assign for it.
gdb/ChangeLog:
* macroexp.c (struct macro_buffer): Split in two classes. Add
uses adjusted.
(struct shared_macro_buffer): New, factored out from struct
macro_buffer.
(struct growable_macro_buffer): New, factored out from struct
macro_buffer.
(set_token, get_comment, get_identifier, get_pp_number)
(get_character_constant, get_string_literal, get_punctuator)
(get_next_token_for_substitution): Constify parameters.
(substitute_args): Constify locals.
Change-Id: I5712e30e826d949715703b2e9172adf04e63b152
Nick Clifton [Fri, 6 Nov 2020 14:36:45 +0000 (14:36 +0000)]
Extend ld's -Map=<dir> functionality by allowing '%' to be replaced with the output file path.
* lexsup.c (parse_args): Add more checks of the mapfile. If it is
a directory use the basename of the output file as the file
component. If the % character is present, replace it with the
full output filepath.
* testsuite/ld-scripts/map-address.exp: Add test of %
functionality.
* ld.texi: Document the new behaviour.
H.J. Lu [Fri, 6 Nov 2020 14:04:32 +0000 (06:04 -0800)]
elfedit: Update help message
Update elfedit message to
$ elfedit --help
Usage: elfedit <option(s)> elffile(s)
Update the ELF header of ELF files
The options are:
--input-mach [none|i386|iamcu|l1om|k1om|x86_64]
Set input machine type
--output-mach [none|i386|iamcu|l1om|k1om|x86_64]
Set output machine type
--input-type [none|rel|exec|dyn]
Set input file type
--output-type [none|rel|exec|dyn]
Set output file type
--input-osabi [none|HPUX|NetBSD|GNU|Linux|Solaris|AIX|Irix|FreeBSD|TRU64|Modesto|OpenBSD|OpenVMS|NSK|AROS|FenixOS]
Set input OSABI
--output-osabi [none|HPUX|NetBSD|GNU|Linux|Solaris|AIX|Irix|FreeBSD|TRU64|Modesto|OpenBSD|OpenVMS|NSK|AROS|FenixOS]
Set output OSABI
--enable-x86-feature [ibt|shstk]
Enable x86 feature
--disable-x86-feature [ibt|shstk]
Disable x86 feature
-h --help Display this information
-v --version Display the version number of elfedit
Report bugs to <http://www.sourceware.org/bugzilla/>
* elfedit.c: Include "libiberty.h".
(usage): Update help message.
Przemyslaw Wirkus [Fri, 6 Nov 2020 13:09:51 +0000 (13:09 +0000)]
aarch64: Extract Pointer Authentication feature from Armv8.3-A
Extract PAC (Pointer Authentication) feature from Armv8.3-A.
Please note that PAC stays a Armv8.3-A feature but now can be
assigned to other architectures or CPUs.
Nick Clifton [Fri, 6 Nov 2020 12:41:29 +0000 (12:41 +0000)]
Updated Serbian translation for the ld subdirectory
Tom Tromey [Fri, 6 Nov 2020 01:27:43 +0000 (18:27 -0700)]
Remove objfile parameter from abbrev_table::read
In a longer series that I am working on, I needed to remove the
objfile parameter from abbrev_table::read. It seemed to me that this
was a simple and relatively harmless patch, so I'm sending it now.
gdb/ChangeLog
2020-11-05 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (read_cutu_die_from_dwo)
(cutu_reader::cutu_reader, cutu_reader::cutu_reader)
(build_type_psymtabs_1): Update.
* dwarf2/abbrev.h (struct abbrev_table): Remove objfile
parameter.
* dwarf2/abbrev.c (abbrev_table::read): Remove objfile parameter.
Don't read section. Add assert.
GDB Administrator [Fri, 6 Nov 2020 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 5 Nov 2020 00:00:13 +0000 (00:00 +0000)]
Automatic date update in version.in
Przemyslaw Wirkus [Wed, 4 Nov 2020 20:47:06 +0000 (20:47 +0000)]
aarch64: Update feature RAS system registers
This patch:
+ updates RAS feature system registers with new RAS 1.1 regs.
+ extends RAS/RAS 1.1 support for all architecture levels of Armv8-A.
Please note that early Armv8-A architectures do not officially support RAS
extension.
Rationale of the patch:
To ease development so that user-friendly RAS system registers operands can be
used. Certain use cases require developers to enable only more generic
architecture (e.g. -march=armv8-a) during system development. Users must use
RAS extension registers bearing in mind that system they use must support it.
The RAS (Reliability, Availability, Serviceability) extension is a
system-level extension that defines a number of system registers.
RAS 1.1 (FEAT_RASv1p1) introduces five new system registers:
ERXPFGCTL_EL1, ERXPFGCDN_EL1, ERXMISC2_EL1, ERXMISC3_EL1 and
ERXPFGF_EL1.
For details see [0].
[0] https://developer.arm.com/docs/ddi0595/i/
Tom Tromey [Wed, 4 Nov 2020 16:17:58 +0000 (09:17 -0700)]
Handle __XVL fields in Ada type printing
Sometimes the Ada compiler will emit an "__XVL" name for a field. The
Ada compiler describes:
-- Second, the variable-length fields themselves are represented by
-- replacing the type by a special access type. The designated type of
-- this access type is the original variable-length type, and the fact
-- that this field has been transformed in this way is signalled by
-- encoding the field name as:
-- field___XVL
Currently gdb describes such fields as having "access" type, but this
is inaccurate. This patch changes gdb to avoid printing "access" in
this case.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* ada-typeprint.c (ada_print_type): Handle __XVL fields.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/funcall_ref.exp: Update.
* gdb.ada/var_rec_arr.exp: Update.
Tom Tromey [Wed, 4 Nov 2020 16:17:58 +0000 (09:17 -0700)]
Print Ada type name in more cases
In some cases the name of an Ada type cannot be decoded by
decoded_type_name. For example, the name
"p__complex_variable_record_type__T9s" in the included test case is
rejected due to the "T". This causes ptype to display the full
contents of a record type -- when in fact the name is available and
ought to be printed.
Fixing this in decoded_type_name isn't possible because the "__T" name
is not the real name of the type -- it is just a compiler-assigned
name of convenience.
This patch fixes the problem by using the resolved type's name when
the original type's name isn't suitable.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* ada-typeprint.c (ada_print_type): Handle __T types.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/rec_ptype.exp: New file.
* gdb.ada/rec_ptype/main.adb: New file.
* gdb.ada/rec_ptype/p.ads: New file.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Recognize names of array types
With -fgnat-encodings=minimal, Gnat will emit DW_TAG_array_type that
has a name -- and this is the only time the name is emitted for the
type. (For comparison, in C a typedef would be emitted in this
situation.)
This patch changes gdb to recognize the name of an array type. This
is limited to Ada, to avoid any potential problems if some rogue DWARF
happens to name an array type in some other language, and to avoid
loading unnecessary partial DIEs.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (add_partial_symbol, process_die):
Handle DW_TAG_array_type.
(is_type_tag_for_partial): Add "lang" parameter.
(load_partial_dies, new_symbol): Handle DW_TAG_array_type.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/tick_length_array_enum_idx.exp: Add ptype test.
* gdb.ada/tick_length_array_enum_idx/foo_n207_004.adb
(PT_Full): New variable.
* gdb.ada/tick_length_array_enum_idx/pck.adb
(Full_PT): New type.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Use bit stride when taking slice of array
Testing with -fgnat-encodings=minimal showed that the Ada code failed
to use the bit stride of an array when taking a slice. This patch
fixes the oversight.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_value_slice_from_ptr): Use bit size.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/array_of_variant.exp: New file.
* gdb.ada/array_of_variant/p.adb: New file.
* gdb.ada/array_of_variant/pck.ads: New file.
* gdb.ada/array_of_variant/pck.adb: New file.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Only use stride for final element type
A DWARF array type may specify a stride. Currently, the DWARF reader
applies this stride to every dimension of an array. However, this
seems incorrect to me -- only the innermost array ought to use the
stride, while outer arrays should compute a stride based on the size
of the inner arrays. This patch arranges to apply the stride only to
the innermost array type. This fixes a bug noticed when running some
Ada tests with -fgnat-encodings=minimal.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (read_array_type): Only apply stride to innermost
array.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/enum_idx_packed.exp: Add test.
* gdb.ada/enum_idx_packed/foo.adb (Multi_Access):
New variable.
* gdb.ada/enum_idx_packed/pck.ads (Short)
(Multi_Dimension, Multi_Dimension_Access): New types.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Fix bit strides for -fgnat-encodings=minimal
With -fgnat-encodings=minimal, the enum_idx_packed.exp test will fail.
In this test case, we have an array (with dynamic length) of arrays,
and the inner array has a bit stride. In this situation, the outer
array's bit stride must be updated to account for the entire bit
length of the inner array.
Here, again, some tests must be kfail'd when an older version of GNAT
is in use.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (update_static_array_size): Handle bit stride.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/enum_idx_packed.exp: Test two forms of -fgnat-encodings.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Resolve dynamic type in ada_value_struct_elt
An internal AdaCore test case showed that gdb mishandled a case of
assigning to an array element in a packed array inside a variant
record. This problem can only be seen with -fgnat-encodings=minimal,
which isn't yet widely used. This patch fixes the bug, and also
updates an existing test to check this case.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_value_struct_elt): Resolve dynamic type.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/set_pckd_arr_elt.exp: Also test
-fgnat-encodings=minimal. Add tests.
* gdb.ada/set_pckd_arr_elt/foo.adb (Foo): Add VA variable.
Call Update_Small a second time.
* gdb.ada/set_pckd_arr_elt/pck.adb (New_Variant): New function.
* gdb.ada/set_pckd_arr_elt/pck.ads (Buffer, Variant)
(Variant_Access): New types.
(New_Variant): Declare.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Reject slicing a packed array
In Ada mode, gdb rejects slicing a packed array. However, with
-fgnat-encodings=minimal, gdb will instead print incorrect results.
This patch changes gdb to also reject slicing a packed array in this
mode.
FWIW I believe that this rejection is a gdb limitation. Removing it
looked complicated, though, and meanwhile my main goal for the time
being is to bring the DWARF encodings up to par with Gnat encodings.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_is_any_packed_array_type): New function.
(ada_evaluate_subexp) <case TERNOP_SLICE>: Use it.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/mod_from_name.exp: Test printing slice.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Synthesize array descriptors with -fgnat-encodings=minimal
When -fgnat-encodings=minimal, the compiler will avoid the special
GNAT-specific "encodings" format, and instead emit ordinary DWARF as
much as possible.
When emitting DWARF for thick pointers to arrays, the compiler emits
something like:
<1><11db>: Abbrev Number: 7 (DW_TAG_array_type)
<11dc> DW_AT_name : (indirect string, offset: 0x1bb8): string
<11e0> DW_AT_data_location: 2 byte block: 97 6
(DW_OP_push_object_address; DW_OP_deref)
<11e3> DW_AT_type : <0x1173>
<11e7> DW_AT_sibling : <0x1201>
<2><11eb>: Abbrev Number: 8 (DW_TAG_subrange_type)
<11ec> DW_AT_type : <0x1206>
<11f0> DW_AT_lower_bound : 6 byte block: 97 23 8 6 94 4
(DW_OP_push_object_address; DW_OP_plus_uconst: 8; DW_OP_deref;
DW_OP_deref_size: 4)
<11f7> DW_AT_upper_bound : 8 byte block: 97 23 8 6 23 4 94 4
(DW_OP_push_object_address; DW_OP_plus_uconst: 8; DW_OP_deref;
DW_OP_plus_uconst: 4; DW_OP_deref_size: 4)
If you read between the lines, the "array" is actually a structure
with two elements. One element is a pointer to the array data, and
the other structure describes the bounds of the array. However, the
compiler doesn't emit this explicitly, but instead hides it behind
these location expressions.
gdb can print such objects, but currently there is no way to construct
one. So, this patch adds some code to the DWARF reader to recognize
this construct, and then synthesize an array descriptor. This
descriptor is then handled by the existing Ada code.
Internally, we've modified GCC to emit the structure type explicitly
(we will of course be sending this upstream). In this case, the array
still has the DW_AT_data_location, though. This patch also modifies
gdb to ignore the data location in this case -- this is preferred
because the location only serves to confuse the Ada code that already
knows where to find the data. In the future I hope to move some of
this handling to the gdb core, so that Ada-specific hacks are not
needed; however I have not yet done this.
Because parallel types are not emitted with -fgnat-encodings=minimal,
some changes to the Ada code were also required.
The change ina ada-valprint.c was needed to avoid infinite recursion
when trying to print a constrained packed array. And, there didn't
seem to be any need for a recursive call here -- the value could
simply be returned instead.
Finally, gdb.ada/frame_arg_lang.exp no longer works in C mode, because
we drop back to the structure approach now. As mentioned earlier,
future work should probably fix this again; meanwhile, this doesn't
seem to be a big problem, because it is what is currently done (users
as a rule don't use -fgnat-encodings=minimal -- which is what I am
ultimately trying to fix).
Note that a couple of tests have an added KFAIL. Some
-fgnat-encodings=minimal changes have landed in GNAT, and you need
something very recent to pass all the tests. I'm using git gcc to
accomplish this.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* dwarf2/read.c (recognize_bound_expression)
(quirk_ada_thick_pointer): New functions.
(read_array_type): Call quirk_ada_thick_pointer.
(set_die_type): Add "skip_data_location" parameter.
(quirk_ada_thick_pointer): New function.
(process_structure_scope): Call quirk_ada_thick_pointer.
* ada-lang.c (ada_is_unconstrained_packed_array_type)
(decode_packed_array_bitsize): Handle thick pointers without
parallel types.
(ada_is_gnat_encoded_packed_array_type): Rename from
ada_is_packed_array_type.
(ada_is_constrained_packed_array_type): Update.
* ada-valprint.c (ada_val_print_gnat_array): Remove.
(ada_value_print_1): Use ada_get_decoded_value.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/O2_float_param.exp: Test different -fgnat-encodings
values.
* gdb.ada/access_to_unbounded_array.exp: Test different
-fgnat-encodings values.
* gdb.ada/big_packed_array.exp: Test different -fgnat-encodings
values.
* gdb.ada/arr_enum_idx_w_gap.exp: Test different -fgnat-encodings
values.
* gdb.ada/array_ptr_renaming.exp: Test different -fgnat-encodings
values.
* gdb.ada/array_of_variable_length.exp: Test different
-fgnat-encodings values.
* gdb.ada/arrayparam.exp: Test different -fgnat-encodings values.
* gdb.ada/arrayptr.exp: Test different -fgnat-encodings values.
* gdb.ada/frame_arg_lang.exp: Revert -fgnat-encodings=minimal
change.
* gdb.ada/mi_string_access.exp: Test different -fgnat-encodings
values.
* gdb.ada/mod_from_name.exp: Test different -fgnat-encodings values.
* gdb.ada/out_of_line_in_inlined.exp: Test different
-fgnat-encodings values.
* gdb.ada/packed_array.exp: Test different -fgnat-encodings
values.
* gdb.ada/pckd_arr_ren.exp: Test different -fgnat-encodings
values.
* gdb.ada/unc_arr_ptr_in_var_rec.exp: Test different
-fgnat-encodings values.
* gdb.ada/variant_record_packed_array.exp: Test different
-fgnat-encodings values.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Fix decoding of multi-dimensional constrained packed arrays
Printing a multi-dimensional constrained packed array in Ada would not
show the correct values. The bug here is that, when decoding the type
of such an array, only the innermost dimension's element bitsize would
be correct. For outer dimensions, the bitsize must account for the
size of each sub-array, but this was not done.
This patch fixes the problem by arranging to compute these sizes after
decoding the array type. I've included a bit more test case than is
strictly necessary -- the current test here was derived from an
internal test, and this patch brings the two into sync.
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* ada-lang.c (recursively_update_array_bitsize): New function.
(decode_constrained_packed_array_type): Call it.
gdb/testsuite/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* gdb.ada/enum_idx_packed.exp: Add tests.
* gdb.ada/enum_idx_packed/foo.adb: Add variables.
* gdb.ada/enum_idx_packed/pck.adb: Add functions.
* gdb.ada/enum_idx_packed/pck.ads: Add types, function
declarations.
Tom Tromey [Wed, 4 Nov 2020 15:49:16 +0000 (08:49 -0700)]
Avoid crash in ada-lang.c:to_fixed_array_type
When debugging Ada programs compiled by certain versions of GNAT with
-fgnat-encodings=minimal, gdb can crash. These crashes occur when
running the gdb test suite, once some of the later patches in this
series have been applied.
This patch works around the bug by throwing an exception in the
failing case. I did not implement a full fix because GNAT has been
changed to emit better DWARF, and so in the near future this will stop
being a problem. (Currently, users don't generally use
-fgnat-encodings=minimal, and the GNAT default will only be changed in
a fully-patched compiler.)
gdb/ChangeLog
2020-11-04 Tom Tromey <tromey@adacore.com>
* ada-lang.c (to_fixed_array_type): Error if
decode_constrained_packed_array_type returns NULL.
Tom Tromey [Wed, 4 Nov 2020 15:21:36 +0000 (08:21 -0700)]
Rewrite leb.h:read_3_bytes
read_3_bytes assumes little-endian data, but in fact it depends on the
BFD. This patch rewrites this function to use bfd_get_24 instead.
2020-11-04 Tom Tromey <tromey@adacore.com>
* dwarf2/leb.h (read_3_bytes): Use bfd_get_24.
GDB Administrator [Wed, 4 Nov 2020 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Tue, 3 Nov 2020 16:41:11 +0000 (17:41 +0100)]
[gdb/testsuite] Fix .debug_abbrev terminators
The abbreviations table for a single compilation unit has two types of
terminators:
- a ".byte 0" pair denoting the end of an attribute list
- a single ".byte 0" denoting the end of the table
However, at the end of the .debug_abbrev section in dw2-line-number-zero-dw.S,
we have four ".byte 0" entries:
...
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x01 /* DW_FORM_addr */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
...
The first two are the attribute list terminator, the third is the end-of-table
terminator, and the last is superfluous/incorrect.
Fix this by emitting instead:
...
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x01 /* DW_FORM_addr */
.byte 0x0 /* DW_AT - Terminator */
.byte 0x0 /* DW_FORM - Terminator */
.byte 0x0 /* Abbrev end - Terminator */
...
where the last comment resembles the comment for other abbreviation codes:
...
.section .debug_abbrev
.Labbrev1_begin:
.uleb128 2 /* Abbrev start */
...
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-11-03 Tom de Vries <tdevries@suse.de>
* lib/dwarf.exp (Dwarf::_handle_DW_TAG): Improve attribute list
terminator comments.
(Dwarf::cu, Dwarf::tu): Remove superfluous abbreviation table
terminator.
Howard Chu [Tue, 3 Nov 2020 15:12:47 +0000 (15:12 +0000)]
Add an option to the archiver to add a section recording library dependencies.
* ar.c (long_options): Add --record-libdeps.
(usage): Mention the new option.
(decode_options): Handle the new option.
(replace_members): If necessary, create a bfd to hold the libdeps
description.
* binemul.c (ar_emul_append_bfd): New function.
(ar_emul_replace_bfd): New function.
(ar_emul_default_append): Replace file_name and target arguments
with new_bfd argument.
(ar_emul_default_replace): Likewise.
* binemul.h: Update prototypes.
(struct bin_emulation_xfer_struct): Update fields.
* doc/binutils.texi: Document the new option.
* NEWS: Mention the new feature.
* emul_aix.c (ar_emul_aix_append): Update.
(ar_emul_aix_replace): Likewise.
* testsuite/binutils-all/ar.exp: Add test of new feature.
Przemyslaw Wirkus [Tue, 3 Nov 2020 14:21:32 +0000 (14:21 +0000)]
[PATCH][GAS] aarch64: Add atomic 64-byte load/store instructions for Armv8.7
Armv8.7 architecture introduces the "accelerator extension", aka
load/store of 64 bytes. New atomic load/store instructions are: LD64B,
ST64B, ST64BV and ST64BV0.
This patch adds:
+ New feature +ls64 to -march command line.
+ New atomic load/store instructions associated with above feature.
For more details regarding atomic 64-byte load/store instruction for
Armv8.7 please refer to Arm A64 Instruction set documentation for
Armv8-A architecture profile, see document page 157 for load
instruction, and pages 414-418 for store instructions of [0].
[0]: https://developer.arm.com/docs/ddi0596/i
Alan Modra [Tue, 3 Nov 2020 10:21:13 +0000 (20:51 +1030)]
PowerPC problem building gold with clang
* powerpc.cc (Target_powerpc::tocsave_loc): Return a pointer.
(Target_powerpc::Relocate::relocate): Avoid -Wdangling-gsl error.
Przemyslaw Wirkus [Tue, 3 Nov 2020 11:55:14 +0000 (11:55 +0000)]
[PATCH] aarch64: Update missing ChangeLog for AArch64 commits
Patch with missing ChangeLog entries for GAS AArch64 files.
Nick Clifton [Tue, 3 Nov 2020 08:56:27 +0000 (08:56 +0000)]
Fix compile time warning
Christian Eggers [Sun, 1 Nov 2020 08:10:14 +0000 (09:10 +0100)]
gas: fix symbol value calculation for versioned symbol aliases
Symbol value is in bytes while fragS::fr_address is in octets. Fixes GAS
symver12 and symver13 tests on ELF targets with with OCTETS_PER_BYTE>1.
* config/obj-elf (elf_frob_symbol): Fix symbol value calculation
for versioned symbol aliases.
Signed-off-by: Christian Eggers <ceggers@gmx.de>
Alan Modra [Mon, 2 Nov 2020 23:53:03 +0000 (10:23 +1030)]
asan: leak in bfd_section_from_shdr
* elf.c (bfd_section_from_shdr): Free sections_being_created.
Use bfd_zmalloc.
Nick Gasson [Mon, 2 Nov 2020 04:02:05 +0000 (12:02 +0800)]
gold: ensure file_counts_lock is initialized before using
Since upgrading to binutils 2.35 I've been experiencing random memory
corruption related crashes with ld.gold --threads. It's caused by
multiple threads concurrently pushing elements onto the shared
std::vector in File_read::record_file_read(). This vector is supposed to
be protected by file_counts_lock, but that is initialized lazily and
might be NULL when File_read::open() is called, in which case
Hold_optional_lock silently skips locking it.
Fix by calling the initialize() method before attempting to acquire the
lock, the same as other places that use file_counts_lock.
PR 26827
* fileread.cc (File_read::open): Ensure file_counts_lock is
initialized.
* testsuite/Makefile.am (check_PROGRAMS): Add a test that passes
-Wl,--threads.
* testsuite/Makefile.in: Regenerate.
GDB Administrator [Tue, 3 Nov 2020 00:00:12 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 2 Nov 2020 21:35:47 +0000 (16:35 -0500)]
gdb/testsuite: fix failure in gdb.base/step-over-no-symbols.exp
This test fails on my machine:
p /x $pc^M
$2 = 0x55555555514e^M
(gdb) PASS: gdb.base/step-over-no-symbols.exp: displaced=off: get after PC
FAIL: gdb.base/step-over-no-symbols.exp: displaced=off: advanced
This is due to the check added in
5f0e2eb79e6b ("GDB/testsuite: Fix a
catastrophic step-over-no-symbols.exp failure"), that makes sure the PC
values are integer. As documented in the TCL doc [1], "string is
integer" returns 1 if the string is a valid 32-bit integer format. The
PC values are greater than 32 bits, so are not recognized as integers by
that test.
% string is integer -strict 0x55555555
1
% string is integer -strict 0x555555555
0
Replace the "string is integer" test with a regexp one, that verifies
the PC is a hex value.
[1] https://www.tcl.tk/man/tcl/TclCmd/string.htm#M21
gdb/testsuite/ChangeLog:
* gdb.base/step-over-no-symbols.exp (test_step_over): Replace
integer format test with regexp.
Change-Id: I71f8197e7b52e97b4901980544a8d1072aabd362
Tom Tromey [Thu, 29 Oct 2020 14:47:16 +0000 (08:47 -0600)]
Add x86_64 ravenscar support
Support for x86_64 ravenscar was recently added to the Ada runtime.
This patch updates gdb to follow.
As this is Ada-specific, and was reviewed internally by Joel, I am
checking it in.
2020-11-02 Tom Tromey <tromey@adacore.com>
* Makefile.in (ALL_64_TARGET_OBS): Add amd64-ravenscar-thread.o.
(ALLDEPFILES): Add amd64-ravenscar-thread.c.
(HFILES_NO_SRCDIR): Add amd64-ravenscar-thread.h.
* amd64-ravenscar-thread.c: New file.
* amd64-ravenscar-thread.h: New file.
* amd64-tdep.c (amd64_init_abi): Register ravenscar ops.
* configure.tgt (amd64_tobjs): Add ravenscar objects.