Alan Modra [Tue, 25 Oct 2022 23:11:55 +0000 (09:41 +1030)]
PR29720, objdump -S crashes if build-id is missing
PR 29720
* objdump.c (slurp_file): Don't call debuginfod_find_source
when build_id is NULL.
GDB Administrator [Wed, 26 Oct 2022 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Tue, 25 Oct 2022 02:05:15 +0000 (22:05 -0400)]
gdb: remove spurious spaces after frame_info_ptr
Fix some whitespace issues introduced with the frame_info_ptr patch.
Change-Id: I158d30d8108c97564276c647fc98283ff7b12163
Michael Matz [Thu, 20 Oct 2022 14:06:57 +0000 (16:06 +0200)]
x86-64: Use only one default max-page-size
On x86-64 the default ELF_MAXPAGESIZE depends on a configure
option (--disable-separate-code). Since
9833b775
("PR28824, relro security issues") we use max-page-size for relro
alignment (with a short interval, from
31b4d3a ("PR28824, relro
security issues, x86 keep COMMONPAGESIZE relro") to its revert
a1faa5ea, where x86-64 only used COMMONPAGESIZE as relro alignment
target).
But that means that a linker configured with --disable-separate-code
behaves different from one configured with --enable-separate-code
(the default), _even if using "-z {no,}separate-code" option to use
the non-configured behaviour_ . In particular it means that when
configuring with --disable-separate-code the linker will produce
binaries aligned to 2MB pages on disk, and hence generate 2MB
executables for a hello world (and even 6MB when linked with
"-z separate-code").
Generally we can't have constants that ultimately land in static
variables be depending on configure options if those only influence
behaviour that is overridable by command line options.
So, do away with that, make the default MAXPAGESIZE be 4k (as is default
for most x86-64 configs anyway, as most people won't configure with
--disable-separate-code). If people need more they can use the
"-z max-page-size" (with would have been required right now for a
default configure binutils).
bfd/
* elf64-x86-64.c (ELF_MAXPAGESIZE): Don't depend on
DEFAULT_LD_Z_SEPARATE_CODE.
Simon Marchi [Tue, 25 Oct 2022 13:50:56 +0000 (09:50 -0400)]
gdb/testsuite: make sure to consume the prompt in gdb.base/unwind-on-each-insn.exp
This test fails quite reliably for me when ran as:
$ taskset -c 1 make check TESTS="gdb.base/unwind-on-each-insn.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
or more simply:
$ make check-read1 TESTS="gdb.base/unwind-on-each-insn.exp"
The problem is that the gdb_test_multiple call that grabs the frame id
from "maint print frame-id" does not consume the prompt. Well, it does
sometimes due to the trailing .*, but not always. If the prompt is not
consumed, the tests that follow get confused:
FAIL: gdb.base/unwind-on-each-insn.exp: gdb_breakpoint: set breakpoint at *foo
FAIL: gdb.base/unwind-on-each-insn.exp: disassemble foo
FAIL: gdb.base/unwind-on-each-insn.exp: get $sp and frame base in foo: get hexadecimal valueof "$sp"
... many more ...
Use -wrap to make gdb_test_multiple consume the prompt.
While at it, remove the bit that consumes the command name and do
exp_continue, it's not really necessary. And for consistency, do the
same changes to the gdb_test_multiple that consumes the stack address,
although that one was fine, it did consume the prompt explicitly.
Change-Id: I2b7328c8844c7e98921ea494c4c05107162619fc
Reviewed-By: Bruno Larsen <blarsen@redhat.com>
Tom de Vries [Tue, 25 Oct 2022 12:14:34 +0000 (14:14 +0200)]
[gdb/testsuite] Handle missing .note.GNU-stack
On openSUSE Tumbleweed I run into this for the dwarf assembly test-cases, and
some hardcoded assembly test-cases:
...
Running gdb.dwarf2/fission-absolute-dwo.exp ...
gdb compile failed, ld: warning: fission-absolute-dwo.o: \
missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future \
version of the linker
=== gdb Summary ===
# of untested testcases 1
...
Fix the dwarf assembly test-cases by adding the missing .note.GNU-stack in
proc Dwarf::assemble.
Fix the hard-coded test-cases using this command:
...
$ for f in $(find gdb/testsuite/gdb.* -name *.S); do
if ! grep -q note.GNU-stack $f; then
echo -e "\t.section\t.note.GNU-stack,\"\",@progbits" >> $f;
fi;
done
...
Likewise for .s files, and gdb/testsuite/lib/my-syscalls.S.
The idiom for arm seems to be to use %progbits instead, see commit
9a5911c08be
("gdb/testsuite/gdb.dwarf2: Replace @ with % for ARM compatability"), so
hand-edit gdb/testsuite/gdb.arch/arm-disp-step.S to use %progbits instead.
Note that dwarf assembly testcases use %progbits as decided by proc _section.
Tested on x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29674
Tom de Vries [Tue, 25 Oct 2022 12:09:32 +0000 (14:09 +0200)]
[gdb/testsuite] Add missing skip_gdbserver_tests in gdb.multi/attach-no-multi-process.exp
I build gdb without gdbserver, and ran into:
...
(gdb) PASS: gdb.multi/attach-no-multi-process.exp: target_non_stop=off: \
switch to inferior 2
spawn of --once --multi localhost:2346 failed
ERROR: tcl error sourcing attach-no-multi-process.exp.
ERROR: tcl error code NONE
ERROR: Timeout waiting for gdbserver response.
...
Add the missing skip_gdbserver_tests.
Tested on x86_64-linux.
Tom de Vries [Tue, 25 Oct 2022 09:32:41 +0000 (11:32 +0200)]
[gdb] Rewrite RETHROW_ON_TARGET_CLOSE_ERROR into function
Recent commit
b2829fcf9b5 ("[gdb] Fix rethrow exception slicing in
insert_bp_location") introduced macro RETHROW_ON_TARGET_CLOSE_ERROR.
I wrote this as a macro in order to have the rethrowing throw be part of the
same function as the catch, but as it turns out that's not necessary.
Rewrite into a function.
Tested on x86_64-linux.
Simon Marchi [Tue, 25 Oct 2022 04:11:29 +0000 (00:11 -0400)]
gdb: internal_error -> internal_error_loc in gdb-gdb.gdb.in
Commit
f34652de0b ("internal_error: remove need to pass
__FILE__/__LINE__") renamed the internal_error function to
internal_error_loc. Change gdb-gdb.gdb.in accordingly.
Change-Id: I876e1623607b6becf74ade53d102ead53a74ed86
Nelson Chu [Mon, 24 Oct 2022 10:26:36 +0000 (18:26 +0800)]
RISC-V: Should reset `again' flag for _bfd_riscv_relax_pc.
The R_RISCV_DELETE relocations are no longer deleted at another relax pass,
so we should reset 'again' flag to true for _bfd_riscv_relax_pc, while the
deleted bytes are marked as R_RISCV_DELETE.
bfd/
* elfnn-riscv.c (_bfd_riscv_relax_pc): Set `again' to true while the
deleted bytes are marked as R_RISCV_DELETE.
Patrick O'Neill [Mon, 17 Oct 2022 01:37:35 +0000 (09:37 +0800)]
RISC-V: Improve link time complexity.
The riscv port does deletion and symbol table update for each relocation
while relaxing, so we are moving section bytes and scanning symbol table once
for each relocation. Compared to microblaze port, they record the relaxation
changes into a table, then do the deletion and symbol table update once per
section, rather than per relocation. Therefore, they should have better link
time complexity than us.
To improve the link time complexity, this patch try to make the deletion in
linear time. Compared to record the relaxation changes into a table, we
replace the unused relocation with R_RISCV_DELETE for the deleted bytes, and
then resolve them at the end of the section. Assuming the number of
R_RISCV_DELETE is m, and the number of symbols is n, the total link complexity
should be O(m) for moving section bytes, and O(m*n^2) for symbol table update.
If we record the relaxation changes into the table, and then sort the symbol
table by values, then probably can reduce the time complexity to O(m*n*log(n))
for updating symbol table, but it doesn't seem worth it for now.
bfd/
* elfnn-riscv.c (_riscv_relax_delete_bytes): Renamed from
riscv_relax_delete_bytes, updated to reduce the tiem complexity to O(m)
for memmove.
(typedef relax_delete_t): Function pointer declaration of delete functions.
(riscv_relax_delete_bytes): Can choose to use _riscv_relax_delete_piecewise
or _riscv_relax_delete_immediate for deletion.
(_riscv_relax_delete_piecewise): Just mark the deleted bytes as R_RISCV_DELETE.
(_riscv_relax_delete_immediate): Delete some bytes from a section while
relaxing.
(riscv_relax_resolve_delete_relocs): Delete the bytes for R_RISCV_DELETE
relocations from a section, at the end of _bfd_riscv_relax_section.
(_bfd_riscv_relax_call): Mark deleted bytes as R_RISCV_DELETE by reusing
R_RISCV_RELAX.
(_bfd_riscv_relax_lui): Likewise, but reuse R_RISCV_HI20 for lui, and reuse
R_RISCV_RELAX for c.lui.
(_bfd_riscv_relax_tls_le): Likewise, but resue R_RISCV_TPREL_HI20 and
R_RISCV_TPREL_ADD.
(_bfd_riscv_relax_pc): Likewise, but resue R_RISCV_PCREL_HI20 for auipc.
(_bfd_riscv_relax_align): Updated, don't need to resue relocation since
calling _riscv_relax_delete_immediate.
(_bfd_riscv_relax_delete): Removed.
(_bfd_riscv_relax_section): Set riscv_relax_delete_bytes for each relax_func,
to delete bytes immediately or later. Call riscv_relax_resolve_delete_relocs
to delete bytes for DELETE relocations from a section.
GDB Administrator [Tue, 25 Oct 2022 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Mon, 24 Oct 2022 17:04:42 +0000 (18:04 +0100)]
gdb/doc: reword description of DisassembleInfo.read_memory
While reading the documentation of DisassembleInfo.read_memory I
spotted the word 'available' in one sentence where it didn't make
sense.
Andrew Burgess [Wed, 19 Oct 2022 14:31:28 +0000 (15:31 +0100)]
sim/lm32: fix some missing function declaration warnings
In the lm32 simulator, I was seeing some warnings about missing
function declarations.
The lm32 simulator has a weird header structure, in order to pull in
the full cpu.h header we need to define WANT_CPU_LM32BF. This is done
in some files, but not in others. Critically, it's not done in some
files that then use functions declared in cpu.h
In this commit I added the missing #define so that the full cpu.h can
be included.
After doing this there are still a few functions that are used
undeclared, these functions appear to be missing any declarations at
all, so I've added some to cpu.h.
With this done all the warnings when compiling lm32 are resolved for
both gcc and clang, so I've removed the SIM_WERROR_CFLAGS line from
Makefile.in, this allows lm32 to build with -Werror.
Andrew Burgess [Wed, 19 Oct 2022 14:19:18 +0000 (15:19 +0100)]
sim/h8300: avoid self assignment
There are two places in the h8300 simulator where we assign a variable
to itself. Clang gives a warning for this, which is converted into an
error by -Werror.
Silence the warning by removing the self assignments. As these
assignments were in a complex if/then/else tree, rather than try to
adjust all the conditions, I've just replaced the self assignments
with a comment and an empty statement.
Andrew Burgess [Wed, 19 Oct 2022 14:16:53 +0000 (15:16 +0100)]
sim/aarch64: remove two unused functions
These functions are not used. Clang warns about the unused functions,
which is then converted into an error by -Werror.
Delete the unused functions.
Andrew Burgess [Wed, 19 Oct 2022 14:12:57 +0000 (15:12 +0100)]
sim/ppc: fix for operator precedence warning from clang
In the ppc simulator, clang was warning about some code like this:
busy_ptr->nr_writebacks = 1 + (PPC_ONE_BIT_SET_P(out_vmask)) ? 1 : 2;
The warning was:
operator '?:' has lower precedence than '+'; '+' will be evaluated first
I suspect that this is not the original authors intention.
PPC_ONE_BIT_SET_P is going to be 0 or 1, so if we evaluate the '+'
first, the condition will always be non-zero, so true. The whole
expression could then be simplified to just '1', which doesn't make
much sense.
I suspect the answer the author was expecting was either 2 or 3. Why
they didn't just write:
busy_ptr->nr_writebacks = (PPC_ONE_BIT_SET_P(out_vmask)) ? 2 : 3;
I have no clue, however, to keep the structure of the code unchanged,
I've updated things to:
busy_ptr->nr_writebacks = 1 + (PPC_ONE_BIT_SET_P (out_vmask) ? 1 : 2);
which silences the warning from clang, and is, I am guessing, what the
original author intended.
Andrew Burgess [Wed, 19 Oct 2022 14:07:40 +0000 (15:07 +0100)]
sim/ppc: initialize a memory buffer in all cases
In the ppc simulator's do_fstat function, which provides the fstat
call for the simulator, if the fstat is going to fail then we
currently write an uninitialized buffer into the simulated target.
In theory, I think this is fine, we also write the error status into
the simulated target, so, given that the fstat has failed, the target
shouldn't be relying on the buffer contents.
However, writing an uninitialized buffer means we might leak simulator
private data into the simulated target, which is probably a bad thing.
Plus it probably makes life easier if something consistent, like all
zeros, is written rather than random junk, which might look like a
successful call (except for the error code).
So, in this commit, I initialize the stat buffer to zero before
it is potentially used. If the stat call is not made then the buffer
will be left initialized as all zeros.
Andrew Burgess [Wed, 19 Oct 2022 14:06:10 +0000 (15:06 +0100)]
sim/ppc: don't try to print an uninitialized variable
The ppc simulator, in sim_create_inferior, tries to print the function
local entry_point variable before the variable is initialized.
In this commit, I defer the debug print line until the variable has
been initialized.
Andrew Burgess [Wed, 19 Oct 2022 14:04:14 +0000 (15:04 +0100)]
sim/sh: use fabs instead of abs
The sh simulator incorrectly uses integer abs instead of the floating
point fabs on some floating point values, fixed in this commit.
Tom de Vries [Mon, 24 Oct 2022 12:20:49 +0000 (14:20 +0200)]
[gdb] Fix rethrow exception slicing in insert_bp_location
The preferred way of rethrowing an exception is by using throw without
expression, because it avoids object slicing of the exception [1].
Fix this in insert_bp_location.
Tested on x86_64-linux.
[1] https://en.cppreference.com/w/cpp/language/throw
Approved-By: Andrew Burgess <aburgess@redhat.com>
Tom de Vries [Mon, 24 Oct 2022 12:20:49 +0000 (14:20 +0200)]
[gdb] Fix rethrow exception slicing in pretty_print_insn
The preferred way of rethrowing an exception is by using throw without
expression, because it avoids object slicing of the exception [1].
Fix this in gdb_pretty_print_disassembler::pretty_print_insn.
Tested on x86_64-linux.
[1] https://en.cppreference.com/w/cpp/language/throw
Approved-By: Andrew Burgess <aburgess@redhat.com>
Clément Chigot [Thu, 20 Oct 2022 13:32:00 +0000 (15:32 +0200)]
ld/testsuite: adjust ld-arm to run shared tests only when supported
If a custom arm-elf target is disabling the shared support, a lot of
failures are reported by the testsuite.
Moreover, some tests try to access libraries which have been explicitly
skipped earlier (eg mixed-lib.so).
ld/ChangeLog:
* testsuite/ld-arm/arm-elf.exp: Separate tests needing shared
lib support.
Clément Chigot [Thu, 20 Oct 2022 13:31:24 +0000 (15:31 +0200)]
ld/testsuite: skip ld-elf/exclude when -shared is not supported
ld/ChangeLog:
* testsuite/ld-elf/exclude.exp: Call check_shared_lib_support.
to skip for all targets without shared lib support.
Jan Beulich [Mon, 24 Oct 2022 07:34:23 +0000 (09:34 +0200)]
x86: consolidate VPCLMUL tests
There's little point in having Intel syntax disassembler tests when the
purpose of a test is assembler functionality: Drop all
*avx512*_vpclmulqdq-wig1-intel.
For *avx512*_vpclmulqdq-wig1 share source with *avx512*_vpclmulqdq.
Finally put in place similar tests for -mvexwig=1.
Jan Beulich [Mon, 24 Oct 2022 07:32:59 +0000 (09:32 +0200)]
x86: consolidate VAES tests
There's little point in having Intel syntax disassembler tests when the
purpose of a test is assembler functionality: Drop all
*avx512*_vaes-wig1-intel.
For *avx512*_vaes-wig1 share source with *avx512*_vaes. This in
particular makes sure that the 32-bit VL test actually tests any EVEX
encodings in the first place.
Finally put in place similar tests for -mvexwig=1.
Jan Beulich [Mon, 24 Oct 2022 07:30:58 +0000 (09:30 +0200)]
x86: emit {evex} prefix when disassembling ambiguous AVX512VL insns
When no AVX512-specific functionality is in use, the disassembly of
AVX512VL insns is indistinguishable from their AVX counterparts (if such
exist). Emit the {evex} pseudo-prefix in such cases.
Where applicable drop stray uses of PREFIX_OPCODE from table entries.
Tom de Vries [Mon, 24 Oct 2022 06:36:42 +0000 (08:36 +0200)]
[gdb/testsuite] Add skip_python_tests in gdb.python/tui-window-names.exp
I did a gdb build without python support, and during testing ran into FAILs in
test-case gdb.python/tui-window-names.exp.
Fix this by adding the missing skip_python_test.
Tested on x86_64-linux.
GDB Administrator [Mon, 24 Oct 2022 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sun, 23 Oct 2022 19:43:15 +0000 (01:28 +0545)]
sim: testsuite: update ignored .exp files [PR sim/29596]
Now that we run `check/foo.exp` instead of `check/./foo.exp`,
update the config/ & lib/ exceptions to cover both paths.
Bug: https://sourceware.org/PR29596
Mike Frysinger [Sun, 23 Oct 2022 19:11:46 +0000 (00:56 +0545)]
sim: testsuite: tweak parallel find invocation [PR sim/29596]
Make sure we invoke runtest with the same exp filenames when running in
parallel as it will find when run single threaded. When `runtest` finds
files itself, it will use paths like "aarch64/allinsn.exp". When we run
`find .` with the %p option, it produces "./aarch64/allinsn.exp". Switch
to %P to get "aarch64/allinsn.exp".
Bug: https://sourceware.org/PR29596
Mike Frysinger [Sun, 23 Oct 2022 17:01:16 +0000 (22:46 +0545)]
sim: mips/ppc/riscv: re-add AC_CANONICAL_SYSTEM [PR sim/29439]
These configure scripts check $target and change behavior. They
shouldn't be doing that, but until we can rework the sim to change
behavior based on the input ELF, restore AC_CANONICAL_SYSTEM to
these so that $target is correctly populated.
This was lost in the
d3562f83a7b8a1ae6e333cd5561419d3da18fcb4
("sim: unify toolchain probing logic") refactor as the logic was
hoisted up to the common code. But the fact the vars weren't
passed down to the sub-configure scripts was missed.
Bug: https://sourceware.org/PR29439
GDB Administrator [Sun, 23 Oct 2022 00:00:06 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 22 Oct 2022 03:58:15 +0000 (23:58 -0400)]
gdb/testsuite: add max number of instructions check in gdb.base/unwind-on-each-insn.exp
This test sends my CI in an infinite loop of failures. We expect to
have a handful of iterations (5 on my development machine, where the
test passes fine)but the log shows that it went up to 104340 iterations:
FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: maint print frame-id
DUPLICATE: gdb.base/unwind-on-each-insn.exp - instruction 104340: maint print frame-id
FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: [string equal $fid $main_fid]
FAIL: gdb.base/unwind-on-each-insn.exp - instruction 104340: get hexadecimal valueof "$pc"
Add a max instruction check, exit the loop if we reach 100 iterations.
This should allow the test to fail fast if there's a problem, but 100
iterations should be more than enough for when things are working.
Change-Id: I77978d593aca046068f9209272d82e1675ba17c2
GDB Administrator [Sat, 22 Oct 2022 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Pedro Alves [Fri, 30 Sep 2022 16:23:03 +0000 (17:23 +0100)]
Improve Python Unwinders documentation
- avoid "GDB proper" to refer to global locus, as object files and
program spaces are also GDB proper.
- gdb.register_unwinder does not accept locus=gdb.
- "a unwinder" -> "an unwinder"
Approved-by: Eli Zaretskii <eliz@gnu.org>
Change-Id: I98c1b1000e1063815238e945ca71ec6f37b5702e
Simon Marchi [Fri, 21 Oct 2022 13:17:53 +0000 (09:17 -0400)]
gdb: make inherit_abstract_dies use vector iterators
Small cleanup to use std::vector iterators rather than raw pointers.
Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I8d50dbb3f2d8dad7ff94066a578d523f1f31b590
Simon Marchi [Fri, 21 Oct 2022 13:08:03 +0000 (09:08 -0400)]
gdb: check for empty offsets vector in inherit_abstract_dies
When building GDB with clang and --enable-ubsan, I get:
UNRESOLVED: gdb.dwarf2/frame-inlined-in-outer-frame.exp: starti prompt
The cause being:
$ ./gdb --data-directory=data-directory -nx -q -readnow testsuite/outputs/gdb.dwarf2/frame-inlined-in-outer-frame/frame-inlined-in-outer-frame
Reading symbols from testsuite/outputs/gdb.dwarf2/frame-inlined-in-outer-frame/frame-inlined-in-outer-frame...
Expanding full symbols from testsuite/outputs/gdb.dwarf2/frame-inlined-in-outer-frame/frame-inlined-in-outer-frame...
/home/simark/src/binutils-gdb/gdb/dwarf2/read.c:11954:47: runtime error: applying non-zero offset 8 to null pointer
I found this to happen with ld-linux on at least Arch Linux and Ubuntu
22.04:
$ ./gdb --data-directory=data-directory -nx -q -readnow -iex "set debuginfod enabled on" /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/ld-linux-x86-64.so.2...
Reading symbols from /home/simark/.cache/debuginfod_client/
22bd7a2c03d8cfc05ef7092bfae5932223189bc1/debuginfo...
Expanding full symbols from /home/simark/.cache/debuginfod_client/
22bd7a2c03d8cfc05ef7092bfae5932223189bc1/debuginfo...
/home/simark/src/binutils-gdb/gdb/dwarf2/read.c:11954:47: runtime error: applying non-zero offset 8 to null pointer
The problem happens when doing this:
sect_offset *offsetp = offsets.data () + 1
When `offsets` is an empty vector, `offsets.data ()` returns nullptr.
Fix it by wrapping that in a `!offsets.empty ()` check.
Change-Id: I6d29ba2fe80ba4308f68effd9c57d4ee8d67c29f
Approved-By: Tom Tromey <tom@tromey.com>
Fangrui Song [Fri, 21 Oct 2022 16:33:38 +0000 (09:33 -0700)]
readelf: support zstd compressed debug sections [PR 29640]
Tom Tromey [Mon, 17 Oct 2022 18:21:10 +0000 (12:21 -0600)]
Fix incorrect .gdb_index with new DWARF scanner
PR symtab/29694 points out a regression caused by the new DWARF
scanner when the cc-with-gdb-index target board is used.
What happens here is that an older version of gdb will make an index
describing the "A" type as:
[737] A: 1 [global, type]
whereas the new gdb says:
[1008] A: 0 [global, type]
Here the old one is correct because the A in CU 0 is just a
declaration without a size:
<1><45>: Abbrev Number: 10 (DW_TAG_structure_type)
<46> DW_AT_name : A
<48> DW_AT_declaration : 1
<48> DW_AT_sibling : <0x6d>
This patch fixes the problem by introducing the idea of a "type
declaration". I think gdb still needs to recurse into these types,
searching for methods, but by marking the type itself as a
declaration, gdb can skip this type during lookups and when writing
the index.
Regression tested on x86-64 using the cc-with-gdb-index board.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29694
Tom Tromey [Tue, 27 Sep 2022 18:53:25 +0000 (12:53 -0600)]
Fix crash in value_print_array_elements
A user noticed that gdb would crash when printing a packed array after
doing "set lang c". Packed arrays don't exist in C, but it's
occasionally useful to print things in C mode when working in a non-C
language -- this lets you see under the hood a little bit.
The bug here is that generic value printing does not handle packed
arrays at all. This patch fixes the bug by introducing a new function
to extract a value from a bit offset and width.
The new function includes a hack to avoid problems with some existing
test cases when using -fgnat-encodings=all. Cleaning up this code
looked difficult, and since "all" is effectively deprecated, I thought
it made sense to simply work around the problems.
Tom Tromey [Tue, 20 Sep 2022 14:39:09 +0000 (08:39 -0600)]
Fix bug in Ada packed array handling
A user found a bug where an array of packed arrays was printed
incorrectly. The bug here is that the packed array has a bit stride,
but the outer array does not -- and should not. However,
update_static_array_size does not distinguish between an array of
packed arrays and a multi-dimensional packed array, and for the
latter, only the innermost array will end up with a stride.
This patch fixes the problem by adding a flag to indicate whether a
given array type is a constituent of a multi-dimensional array.
Simon Marchi [Fri, 21 Oct 2022 12:58:21 +0000 (08:58 -0400)]
gdb: declare variables on first use in inherit_abstract_dies
Move variable declarations to where they are first use, plus some random
style fixes.
Change-Id: Idf40d60f9034996fa6a234165cd989a721eb4148
Nick Clifton [Fri, 21 Oct 2022 11:20:09 +0000 (12:20 +0100)]
Add a -w option to the linker to suppress warning and error messages.
PR 29654
* ld.h (struct ld_config_type): Add no_warnings field.
* ldlex.h (enum option_values): Add OPTION_NO_WARNINGS.
* lexsup.c (ld_options): Add --no-warnings.
(parse_args): Add support for -w and --no-warnings.
* ldmisc.c (vfinfo): Return early if the message is a warning and
-w has been enabled.
* ld.texi (options): Document new command line option.
* NEWS: Mention the new feature.
Nick Clifton [Fri, 21 Oct 2022 10:58:47 +0000 (11:58 +0100)]
Add a note to the binutils/NEWS file about DCO signed contributions.
Bruno Larsen [Wed, 25 May 2022 18:02:47 +0000 (15:02 -0300)]
gdb/reverse: Fix stepping over recursive functions
Currently, when using GDB to do reverse debugging, if we try to use the
command "reverse next" to skip a recursive function, instead of skipping
all of the recursive calls and stopping in the previous line, we stop at
the second to last recursive call, and need to manually step backwards
until we leave the first call. This is well documented in PR gdb/16678.
This bug happens because when GDB notices that a reverse step has
entered into a function, GDB will add a step_resume_breakpoint at the
start of the function, then single step out of the prologue once that
breakpoint is hit. The problem was happening because GDB wouldn't give
that step_resume_breakpoint a frame-id, so the first time the breakpoint
was hit, the inferior would be stopped. This is fixed by giving the
current frame-id to the breakpoint.
This commit also changes gdb.reverse/step-reverse.c to contain a
recursive function and attempt to both, skip it altogether, and to skip
the second call from inside the first call, as this setup broke a
previous version of the patch.
Bruno Larsen [Fri, 19 Aug 2022 13:11:28 +0000 (15:11 +0200)]
Change calculation of frame_id by amd64 epilogue unwinder
When GDB is stopped at a ret instruction and no debug information is
available for unwinding, GDB defaults to the amd64 epilogue unwinder, to
be able to generate a decent backtrace. However, when calculating the
frame id, the epilogue unwinder generates information as if the return
instruction was the whole frame.
This was an issue especially when attempting to reverse debug, as GDB
would place a step_resume_breakpoint from the epilogue of a function if
we were to attempt to skip that function, and this breakpoint should
ideally have the current function's frame_id to avoid other problems
such as PR record/16678.
This commit changes the frame_id calculation for the amd64 epilogue,
so that it is always the same as the dwarf2 unwinder's frame_id.
It also adds a test to confirm that the frame_id will be the same,
regardless of using the epilogue unwinder or not, thanks to Andrew
Burgess.
Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
Nick Clifton [Fri, 21 Oct 2022 09:55:57 +0000 (10:55 +0100)]
Updated Hungarian translation for the gprof sub-directory.
* po/hu.po: Updated Hungarian translation.
Maciej W. Rozycki [Fri, 21 Oct 2022 07:54:18 +0000 (08:54 +0100)]
GDB/Python: Make `None' stand for `unlimited' in setting integer parameters
Similarly to booleans and following the fix for PR python/29217 make
`gdb.parameter' accept `None' for `unlimited' with parameters of the
PARAM_UINTEGER, PARAM_INTEGER, and PARAM_ZUINTEGER_UNLIMITED types, as
`None' is already returned by parameters of the two former types, so
one might expect to be able to feed it back. It also makes it possible
to avoid the need to know what the internal integer representation is
for the special setting of `unlimited'.
Expand the testsuite accordingly.
Approved-By: Simon Marchi <simon.marchi@polymtl.ca>
Maciej W. Rozycki [Fri, 21 Oct 2022 07:54:18 +0000 (08:54 +0100)]
GDB/testsuite: Expand Python integer parameter coverage across all types
Also verify PARAM_UINTEGER, PARAM_INTEGER, and PARAM_ZINTEGER parameter
types, in addition to PARAM_ZUINTEGER and PARAM_ZUINTEGER_UNLIMITED
already covered, and verify a choice of existing GDB parameters. Add
verification for reading parameters via `<parameter>.value' in addition
to `gdb.parameter('<parameter>')' as this covers different code paths.
Approved-By: Simon Marchi <simon.marchi@polymtl.ca>
Maciej W. Rozycki [Fri, 21 Oct 2022 07:54:18 +0000 (08:54 +0100)]
GDB/Guile: Don't assert that an integer value is boolean
Do not assert that a value intended for an integer parameter, of either
the PARAM_UINTEGER or the PARAM_ZUINTEGER_UNLIMITED type, is boolean,
causing error messages such as:
ERROR: In procedure make-parameter:
ERROR: In procedure gdbscm_make_parameter: Wrong type argument in position 15 (expecting integer or #:unlimited): 3
Error while executing Scheme code.
when initialization with a number is attempted. Instead assert that it
is integer. Keep matching `#:unlimited' keyword as an alternative. Add
suitable test cases.
Approved-By: Simon Marchi <simon.marchi@polymtl.ca>
Tom de Vries [Fri, 21 Oct 2022 06:36:18 +0000 (08:36 +0200)]
[gdb/testsuite] Silence compilation fail in gdb.base/rtld-step.exp
With gcc 7.5.0 and test-case gdb.base/rtld-step.exp, I run into:
...
gdb compile failed, gcc: error: unrecognized command line option \
'-static-pie'; did you mean '-static'?
...
Silence this by checking in the test-case that -static-pie is supported, and
emitting instead:
...
UNTESTED: gdb.base/rtld-step.exp: \
failed to compile (-static-pie not supported or static libc missing)
...
Tested on x86_64-linux, with:
- gcc 7.5.0: UNTESTED
- gcc 12.2.1 with static glibc not installed: UNTESTED
- gcc 12.2.1 with static glibc installed: PASS
Cui,Lili [Fri, 21 Oct 2022 02:01:12 +0000 (10:01 +0800)]
Support Intel AMX-FP16
gas/
* NEWS: Add support for Intel AMX-FP16 instruction.
* config/tc-i386.c: Add amx_fp16.
* doc/c-i386.texi: Document .amx_fp16.
* testsuite/gas/i386/i386.exp: Add AMX-FP16 tests.
* testsuite/gas/i386/x86-64-amx-fp16-intel.d: New test.
* testsuite/gas/i386/x86-64-amx-fp16.d: Likewise.
* testsuite/gas/i386/x86-64-amx-fp16.s: Likewise.
* testsuite/gas/i386/x86-64-amx-fp16-bad.d: Likewise.
* testsuite/gas/i386/x86-64-amx-fp16-bad.s: Likewise.
opcodes/
* i386-dis.c (MOD_VEX_0F385C_X86_64_P_3_W_0): New.
(VEX_LEN_0F385C_X86_64_P_3_W_0_M_0): Likewise.
(VEX_W_0F385C_X86_64_P_3): Likewise.
(prefix_table): Add VEX_W_0F385C_X86_64_P_3.
(vex_len_table): Add VEX_LEN_0F385C_X86_64_P_3_W_0_M_0.
(vex_w_table): Add VEX_W_0F385C_X86_64_P_3.
(mod_table): Add MOD_VEX_0F385C_X86_64_P_3_W_0.
* i386-gen.c (cpu_flag_init): Add AMX-FP16_FLAGS.
(CPU_ANY_AMX_TILE_FLAGS): Add CpuAMX_FP16.
(cpu_flags): Add CpuAMX-FP16.
* i386-opc.h (enum): Add CpuAMX-FP16.
(i386_cpu_flags): Add cpuamx_fp16.
* i386-opc.tbl: Add Intel AMX-FP16 instruction.
* i386-init.h: Regenerate.
* i386-tbl.h: Likewise.
Tsukasa OI [Mon, 10 Oct 2022 09:24:48 +0000 (09:24 +0000)]
sim: Remove unused CXXFLAGS substitution
Not only that sim/configure.ac does not AC_SUBST CXXFLAGS,
unless we need C++ compiler like CXX, substitution @CXXFLAGS@ is useless.
Because of this, this commit removes this substitution.
GDB Administrator [Fri, 21 Oct 2022 00:00:08 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Thu, 20 Oct 2022 16:18:19 +0000 (09:18 -0700)]
x86: Check VEX/EVEX encoding before checking vector operands
Since
commit
837e225ba1992f9745e5bbbd5e8443243a7f475f
Author: Jan Beulich <jbeulich@suse.com>
Date: Thu Oct 20 10:01:12 2022 +0200
x86: re-work AVX-VNNI support
moved AVX-VNNI after AVX512-VNNI, vector Disp8 is applied even when VEX
encoding is selected. Check VEX/EVEX encoding before checking vector
operands to avoid vector Disp8 with VEX encoding.
PR gas/29708
* config/tc-i386.c (match_template): Check VEX/EVEX encoding
before checking vector operands.
* testsuite/gas/i386/avx-vnni.d: Updated.
* testsuite/gas/i386/x86-64-avx-vnni.d: Likewise.
* testsuite/gas/i386/avx-vnni.s: Add a Disp32 test.
* testsuite/gas/i386/x86-64-avx-vnni.s: Likewise.
Andrew Burgess [Wed, 21 Sep 2022 15:23:02 +0000 (16:23 +0100)]
gdb/python: break more dependencies between gdbpy_initialize_* functions
In a later commit in this series I will propose removing all of the
explicit gdbpy_initialize_* calls from python.c and replace these
calls with a more generic mechanism.
One of the side effects of this generic mechanism is that the order in
which the various Python sub-systems within GDB are initialized is no
longer guaranteed.
On the whole I don't think this matters, most of the sub-systems are
independent of each other, though testing did reveal a few places
where we did have dependencies, though I don't think those
dependencies were explicitly documented in comment anywhere.
This commit is similar to the previous one, and fixes the second
dependency issue that I found.
In this case the finish_breakpoint_object_type uses the
breakpoint_object_type as its tp_base, this means that
breakpoint_object_type must have been initialized with a call to
PyType_Ready before finish_breakpoint_object_type can be initialized.
Previously we depended on the ordering of calls to
gdbpy_initialize_breakpoints and gdbpy_initialize_finishbreakpoints in
python.c.
After this commit a new function gdbpy_breakpoint_init_breakpoint_type
exists, this function ensures that breakpoint_object_type has been
initialized, and can be called from any gdbpy_initialize_* function.
I feel that this change makes the dependency explicit, which I think
is a good thing.
There should be no user visible changes after this commit.
Andrew Burgess [Wed, 21 Sep 2022 13:40:30 +0000 (14:40 +0100)]
gdb/python: break dependencies between gdbpy_initialize_* functions
In a later commit in this series I will propose removing all of the
explicit gdbpy_initialize_* calls from python.c and replace these
calls with a more generic mechanism.
One of the side effects of this generic mechanism is that the order in
which the various Python sub-systems within GDB are initialized is no
longer guaranteed.
On the whole I don't think this matters, most of the sub-systems are
independent of each other, though testing did reveal a few places
where we did have dependencies, though I don't think those
dependencies were explicitly documented in a comment anywhere.
This commit removes the first dependency issue, with this and the next
commit, all of the implicit inter-sub-system dependencies will be
replaced by explicit dependencies, which will allow me to, I think,
clean up how the sub-systems are initialized.
The dependency is around the py_insn_type. This type is setup in
gdbpy_initialize_instruction and used in gdbpy_initialize_record.
Rather than depend on the calls to these two functions being in a
particular order, in this commit I propose adding a new function
py_insn_get_insn_type. This function will take care of setting up the
py_insn_type type and calling PyType_Ready. This helper function can
be called from gdbpy_initialize_record and
gdbpy_initialize_instruction, and the py_insn_type will be initialized
just once.
To me this is better, the dependency is now really obvious, but also,
we no longer care in which order gdbpy_initialize_record and
gdbpy_initialize_instruction are called.
There should be no user visible changes after this commit.
Andrew Burgess [Tue, 4 Oct 2022 13:13:53 +0000 (14:13 +0100)]
gdb: some int to bool conversion in breakpoint.c
Some int to bool conversion in breakpoint.c. I've only updated the
function signatures of static functions, but I've updated some
function local variables throughout the file.
There should be no user visible changes after this commit.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Andrew Burgess [Wed, 5 Oct 2022 09:21:02 +0000 (10:21 +0100)]
gdb: make use of scoped_restore in unduplicated_should_be_inserted
I noticed that we could make use of a scoped_restore in the function
unduplicated_should_be_inserted. I've also converted the function
return type from int to bool.
This change shouldn't make any difference, as I don't think anything
within should_be_inserted could throw an exception, but the change
doesn't hurt, and will help keep us safe if anything ever changes in
the future.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Andrew Burgess [Tue, 4 Oct 2022 13:22:25 +0000 (14:22 +0100)]
gdb: used scoped_restore_frame in update_watchpoint
I was doing some int to bool cleanup in update_watchpoint, and I
noticed a manual version of scoped_restore_selected_frame. As always
when these things are done manually, there is the chance that, in an
error case, we might leave the wrong frame selected.
This commit updates things to use scoped_restore_selected_frame, and
also converts a local variable from int to bool.
The only user visible change after this commit is in the case where
update_watchpoint throws an error - we should now correctly restore
the previously selected frame. Otherwise, this commit should be
invisible to the user.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Andrew Burgess [Tue, 4 Oct 2022 12:51:32 +0000 (13:51 +0100)]
gdb: make some bp_location arguments const in breakpoint.c
I spotted a few places where I could make some 'bp_location *'
arguments constant in breakpoint.c.
There should be no user visible changes after this commit.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Дилян Палаузов [Thu, 20 Oct 2022 15:05:04 +0000 (17:05 +0200)]
Reapply "Don't build readline/libreadline.a, when --with-system-readline is supplied"
Commit
228cf97dd3c8 ("Merge configure.ac from gcc project") undid the
change originally done in commit
69961a84c9b ("Don't build
readline/libreadline.a, when --with-system-readline is supplied").
Re-apply it.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18632
Jan Beulich [Thu, 20 Oct 2022 08:01:12 +0000 (10:01 +0200)]
x86: re-work AVX-VNNI support
By putting the templates after their AVX512 counterparts, the AVX512
flavors will be picked by default. That way the need to always use {vex}
ceases to exist once respective CPU features (AVX512-VNNI or AVX512VL as
a whole) have been disabled. This way the need for the PseudoVexPrefix
attribute also disappears.
Tom de Vries [Thu, 20 Oct 2022 07:50:04 +0000 (09:50 +0200)]
[gdb/testsuite] Fix gdb.debuginfod/fetch_src_and_symbols.exp with check-read1
With test-case gdb.debuginfod/fetch_src_and_symbols.exp and check-read1, I run
into:
...
(gdb) FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: \
file fetch_src_and_symbols (got interactive prompt)
...
The problem is that this output:
...
Enable debuginfod for this session? (y or [n]) y^M
...
is matched using regexp "Enable debuginfod?.*" with matches only the first two
words of the output, after which an implicit clause in gdb_test_multiple triggers
on the second part containing the interactive prompt.
Fix this by included the interactive prompt in the regexp.
Tested on x86_64-linux.
Tom de Vries [Thu, 20 Oct 2022 07:02:18 +0000 (09:02 +0200)]
[gdb/testsuite] Fix gdb.mi/mi-disassemble.exp with check-read1
With test-case gdb.mi/mi-disassemble.exp and check-read1 I run into:
...
FAIL: gdb.mi/mi-disassemble.exp: disassemble /b main
FAIL: gdb.mi/mi-disassemble.exp: get valueof "*((unsigned char *) 0x400549)"
...
The problem for both FAILs is that the output is parsed using
gdb_test_multiple, which has implicit clauses using $gdb_prompt, which can
match before the explicit clauses using $mi_gdb_prompt.
Fix this by passing -prompt "$mi_gdb_prompt$" to gdb_test_multiple.
Tested on x86-64-linux.
Alan Modra [Thu, 20 Oct 2022 05:01:59 +0000 (15:31 +1030)]
Re: aarch64-pe support for LD, GAS and BFD
Fix dependencies for eaarch64pe.c. Generated files aren't handled
fully automatically.
Mark Harmstone [Sun, 16 Oct 2022 23:24:19 +0000 (00:24 +0100)]
ld: Add minimal pdb generation
Mark Harmstone [Sun, 16 Oct 2022 23:24:18 +0000 (00:24 +0100)]
ld: Add --pdb option
Second patch incorporates fixes for endian and UB issues in calc_hash, as per
https://sourceware.org/pipermail/binutils/2022-October/123514.html.
Kevin Buettner [Thu, 20 Oct 2022 02:36:07 +0000 (19:36 -0700)]
Test stepping within a runtime loader / dynamic linker
See the remarks in rtld-step.exp for a description of what this
test is about.
This test case has been tested using gcc on the following x86-64 Linux
distributions/releases:
Fedora 28
Fedora 32
Fedora 33
Fedora 34
Fedora 35
Fedora 36
Fedora 37
rawhide (f38)
RHEL 9.1
Ubuntu 22.04.1 LTS
It's also been tested (and found to be working) with
RUNTESTFLAGS="CC_FOR_TARGET=clang" on all of the above expect for
Fedora 28. The (old) version of clang available on F28 did not
accept the -static-pie option.
I also tried to make this test work on FreeBSD 13.1. While I think I
made significant progress, I was ultimately stymied by this message
which occurs when attempting to run the main program which has been
set to use the fake/pretend RTLD as the ELF interpreter:
ELF interpreter /path/to/rtld-step-rtld not found, error 22
I have left one of the flags (-static) in place which I believe
to be needed for FreeBSD (though since I never got it to work, I
don't know for sure.) I've also left some declarations needed
for FreeBSD in rtld-step-rtld.c. They're currently disabled via
a #if 0; you'll need to enable them if you want to try to make
it work on FreeBSD.
Kevin Buettner [Thu, 20 Oct 2022 02:36:07 +0000 (19:36 -0700)]
Allow debugging of runtime loader / dynamic linker
At present, GDB does not allow for the debugging of the runtime loader
and/or dynamic linker. Much of the time, this makes sense. An
application programmer doesn't normally want to see symbol resolution
code when stepping into a function that hasn't been resolved yet.
But someone who wishes to debug the runtime loader / dynamic linker
might place a breakpoint in that code and then wish to debug it
as normal. At the moment, this is not possible. Attempting to step
will cause GDB to internally step (and not stop) until code
unrelated to the dynamic linker is reached.
This commit makes a minor change to infrun.c which allows the dynamic
loader / linker to be debugged in the case where a step, next, etc.
is initiated from within that code.
While developing this fix, I tried some approaches which weren't quite
right. The GDB testusite definitely contains tests which FAIL when
it's done incorrectly. (At one point, I saw 17 regressions!) This
commit has been tested on x86-64 linux with no regressions.
Tsukasa OI [Mon, 10 Oct 2022 09:23:16 +0000 (09:23 +0000)]
binutils: Remove unused substitution PROGRAM
Unlike other substitution, this substitution of @PROGRAM@ was done in
binutils/Makefile and it was intended for binutils/cxxfilt.man. @PROGRAM@
in binutils/cxxfilt.man is removed in the commit
0285c67df190 ("Automate
generate on man pages") in 2001 and @PROGRAM@ is ineffective since then.
Because PROGRAM substitution does nothing, removing this manual
substitution should be completely safe.
binutils/ChangeLog:
* doc/local.mk: Remove unused substitution PROGRAM.
* Makefile.in: Regenerate.
GDB Administrator [Thu, 20 Oct 2022 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 19 Oct 2022 23:12:25 +0000 (09:42 +1030)]
Obsolete beos
* config.bfd: Obsolete *-*-beos*. Simplify x86 beos match.
Alan Modra [Wed, 19 Oct 2022 23:11:56 +0000 (09:41 +1030)]
Regen ld/po/BLD-POTFILES.in
Tom de Vries [Wed, 19 Oct 2022 15:41:47 +0000 (17:41 +0200)]
[gdb] Fix assert in handle_jit_event
With the cc-with-tweaks.sh patch submitted here (
https://sourceware.org/pipermail/gdb-patches/2022-October/192586.html ) we run
with:
...
$ export STRIP_ARGS_STRIP_DEBUG=--strip-all
$ make check RUNTESTFLAGS="gdb.base/jit-reader.exp \
--target_board cc-with-gnu-debuglink"
...
into the following assert:
...
(gdb) run ^M
Starting program: jit-reader ^M
gdb/jit.c:1247: internal-error: jit_event_handler: \
Assertion `jiter->jiter_data != nullptr' failed.^M
...
Fix this by handling the
jit_bp_sym.objfile->separate_debug_objfile_backlink != nullptr case in
handle_jit_event.
Tested on x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29277
Pedro Alves [Mon, 17 Oct 2022 16:12:20 +0000 (17:12 +0100)]
internal_error: remove need to pass __FILE__/__LINE__
Currently, every internal_error call must be passed __FILE__/__LINE__
explicitly, like:
internal_error (__FILE__, __LINE__, "foo %d", var);
The need to pass in explicit __FILE__/__LINE__ is there probably
because the function predates widespread and portable variadic macros
availability. We can use variadic macros nowadays, and in fact, we
already use them in several places, including the related
gdb_assert_not_reached.
So this patch renames the internal_error function to something else,
and then reimplements internal_error as a variadic macro that expands
__FILE__/__LINE__ itself.
The result is that we now should call internal_error like so:
internal_error ("foo %d", var);
Likewise for internal_warning.
The patch adjusts all calls sites. 99% of the adjustments were done
with a perl/sed script.
The non-mechanical changes are in gdbsupport/errors.h,
gdbsupport/gdb_assert.h, and gdb/gdbarch.py.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ia6f372c11550ca876829e8fd85048f4502bdcf06
Nick Clifton [Wed, 19 Oct 2022 14:09:12 +0000 (15:09 +0100)]
Fix an illegal memory access when parsing an ELF file containing corrupt symbol version information.
PR 29699
* elf.c (_bfd_elf_slurp_version_tables): Fail if the sh_info field
of the section header is zero.
Andrew Burgess [Wed, 12 Oct 2022 11:46:42 +0000 (12:46 +0100)]
sim/iq2000: silence pointer-sign warnings
When building the iq2000 simulator I see a few warnings like this:
/tmp/build/sim/../../src/sim/iq2000/iq2000.c: In function ‘fetch_str’:
/tmp/build/sim/../../src/sim/iq2000/iq2000.c:50:54: error: pointer targets in passing argument 3 of ‘sim_read’ differ in signedness [-Werror=pointer-sign]
50 | sim_read (CPU_STATE (current_cpu), CPU2DATA(addr), buf, nr);
| ^~~
| |
| char *
I've silenced these warnings by casting buf to 'unsigned char *'.
With this change I now see no warnings when compiling iq2000.c, so
I've removed the line from Makefile.in that disables -Werror.
Makefile.in was also disabling -Werror when compiling mloop.c,
however, I'm not seeing any warnings when compiling that file, so I've
removed the -Werror disable in that case too.
Andrew Burgess [Wed, 12 Oct 2022 10:45:53 +0000 (11:45 +0100)]
sim/erc32: avoid dereferencing type-punned pointer warnings
When building the erc32 simulator I get a few warnings like this:
/tmp/build/sim/../../src/sim/erc32/exec.c:1377:21: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
1377 | sregs->fs[rd] = *((float32 *) & ddata[0]);
| ~^~~~~~~~~~~~~~~~~~~~~~~
The type of '& ddata[0]' will be 'uint32_t *', which is what triggers
the warning.
This commit makes use of memcpy when performing the type-punning,
which resolves the above warnings.
With this change, I now see no warnings when compiling exec.c, which
means that the line in Makefile.in that disables -Werror can be
removed.
There should be no change in behaviour after this commit.
Andrew Burgess [Wed, 12 Oct 2022 10:14:26 +0000 (11:14 +0100)]
sim/ppc: mark device_error function as ATTRIBUTE_NORETURN
The device_error function always ends up calling the error function,
which is itself marked as ATTRIBUTE_NORETURN, so it makes sense that
device_error should also be marked ATTRIBUTE_NORETURN.
Doing this resolves a few warnings from hw_ide.c about possibly
uninitialized variables - the variables are only uninitialized after
passing through a call to device_error, which obviously means the
variables are never really used uninitialized, the simulation will
terminate with the device_error call.
Andrew Burgess [Wed, 12 Oct 2022 10:09:35 +0000 (11:09 +0100)]
sim/ppc: fix warnings related to printf format strings
This commit is a follow on to:
commit
182421c9d2eea8c4877d983a2124e591f0aca710
Date: Tue Oct 11 15:02:08 2022 +0100
sim/ppc: fixes for arguments to printf style functions
where commit
182421c9d2ee addressed issues with printf format
arguments that were causing the compiler to give an error, this commit
addresses issues that caused the compiler to emit a warning.
This commit is mostly either changing the format string to match the
argument, or in some cases, excess, unused arguments are removed.
Andrew Burgess [Wed, 12 Oct 2022 10:07:24 +0000 (11:07 +0100)]
sim/cgen: mask uninitialized variable warning in cgen-run.c
I see an uninitialized variable warning (with gcc 9.3.1) from
cgen-run.c, like this:
/tmp/build/sim/../../src/sim/cris/../common/cgen-run.c: In function ‘sim_resume’:
/tmp/build/sim/../../src/sim/cris/../common/cgen-run.c:259:5: warning: ‘engine_fns$’ may be used uninitialized in this function [-Wmaybe-uninitialized]
259 | (* engine_fns[next_cpu_nr]) (cpu);
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/build/sim/../../src/sim/cris/../common/cgen-run.c:232:14: note: ‘engine_fns$’ was declared here
232 | ENGINE_FN *engine_fns[MAX_NR_PROCESSORS];
| ^~~~~~~~~~
This is a false positive - we over allocate engine_fn, and then only
initialize the nr_cpus entries which we will later go on to use.
However, we can easily silence this warning by initializing the unused
entries in engine_fns to NULL, this might also help if anyone ever
looks at engine_fns in a debugger, it should now be obvious which
entries are in use, and which are not.
With this change the warning is gone.
There should be no change in behaviour with this commit.
Alan Modra [Wed, 19 Oct 2022 08:22:43 +0000 (18:52 +1030)]
Fix addr2line test for ppc64 elfv1 and mingw
* testsuite/binutils-all/addr2line.exp: Tidy. For powerpc64
arrange to pass --synthetic to nm, and extract .main and .fn
symbol address for addr2line test. Handle default executable
extension on cygwin/mingw compilers.
Nick Clifton [Wed, 19 Oct 2022 11:39:20 +0000 (12:39 +0100)]
Update MAINTAINERS file with details about accepting DCO signed contributions.
* MAINTAINERS: Add section on patches, copyright and DCO.
Andrew Burgess [Sun, 2 Oct 2022 14:31:16 +0000 (15:31 +0100)]
gdb/testsuite: avoid temporary file in gdb/testsuite (unittest.exp)
I spotted that the gdb.gdb/unittest.exp script causes a temporary file
inserters_extractors-2.txt to be created in build/gdb/testsuite/
instead of in build/gdb/testsuite/output/gdb.gdb/unittest/.
This is because some of the 'maint selftest' tests create temporary
files in GDB's current directory, specifically, the two source files:
gdb/unittests/basic_string_view/inserters/wchar_t/2.cc
gdb/unittests/basic_string_view/inserters/char/2.cc
both create a temporary file called inserters_extractors-2.txt, though
we only run the second of these as part of GDB's selftests.
I initially proposed just using GDB's 'cd' command in unittest.exp to
switch to the test output directory before running the selftests,
however, Pedro pointed out that there was a risk here that, if GDB
crashed during shutdown, the generated core file would be left in the
test output directory rather than in the testsuite directory. As a
result, our clever core file spotting logic would fail to spot the
core file and alert the user.
Instead, I propose this slightly more involved solution. I've added a
new with_gdb_cwd directory proc, used like this:
with_gdb_cwd $directory {
# Tests here...
}
The new proc temporarily switches to $directory and then runs the
tests within the block. After running the tests the previous current
working directory is restored.
Additionally, after switching back to the previous cwd, we check that
GDB is still responsive. This means that if GDB crashed immediately
prior to restoring the previous directory, and left the core file in
the wrong place, then the responsiveness check will fail, and a FAIL
will be emitted, this should be enough to alert the user that
something has gone wrong.
With this commit in place the unittest.exp script now leaves its
temporary file in the test output directory.
Andrew Burgess [Sun, 2 Oct 2022 14:18:15 +0000 (15:18 +0100)]
gdb/testsuite: avoid creating files in gdb/testsuite directory
I spotted that the test gdb.dwarf2/dw2-using-debug-str.exp was
creating an output file called debug_str_section in the root
build/gdb/testsuite directory instead of using the
build/gdb/testsuite/output/gdb.dwarf2/dw2-using-debug-str/ directory.
This appears to be caused by a missing '$' character. We setup a
variable debug_str_section which contains a path within the output
directory, but then when we build the objcopy command we use
'debug_str_section' without a '$' prefix, as a result, we create the
debug_str_section file.
This commit adds the missing '$', the file is now created in the
output directory.
Andrew Burgess [Wed, 19 Oct 2022 11:00:42 +0000 (12:00 +0100)]
bfd: fix undefined references to aarch64_pe_le_vec
After commit:
commit
c60b3806799abf1d7f6cf5108a1b0e733a950b13
Date: Wed Oct 19 10:57:12 2022 +0200
aarch64-pe support for LD, GAS and BFD
It appears that bfd/Makefile.in and bfd/configure were not regenerated
correctly. The differences in the configure file are only whitespace,
but in Makefile.in a critical reference to pe-aarch64.lo was missing.
Jedidiah Thompson [Wed, 19 Oct 2022 08:57:12 +0000 (10:57 +0200)]
aarch64-pe support for LD, GAS and BFD
Allows aarch64-pe to be targeted natively, not having to use objcopy to convert it from ELF to PE.
Based on initial work by Jedidiah Thompson
Co-authored-by: Jedidiah Thompson <wej22007@outlook.com>
Co-authored-by: Zac Walker <zac.walker@linaro.org>
rupesh potharla [Fri, 14 Oct 2022 13:17:49 +0000 (18:47 +0530)]
Binutils: Adding new testcase for addr2line.
* binutils/testsuite/config/default.exp: Set ADDR2LINE and ADDR2LINEFLAGS.
* binutils/testsuite/binutils-all/addr2line.exp: New file.
Tom de Vries [Wed, 19 Oct 2022 07:04:12 +0000 (09:04 +0200)]
[gdb/testsuite] Fix ERROR in gdb.python/py-breakpoint.exp
With test-case gdb.python/py-breakpoint.exp I run into:
...
(gdb) ERROR: tcl error sourcing gdb.python/py-breakpoint.exp.
ERROR: can't read "skip_hw_watchpoint_tests_p": no such variable
while executing
"if {$skip_hw_watchpoint_tests_p} {
gdb_test_no_output "set can-use-hw-watchpoints 0" ""
}"
...
Fix this by adding the missing "global skip_hw_watchpoint_tests_p" in two
procs.
Tested on x86_64-linux.
Andreas Krebbel [Wed, 19 Oct 2022 07:03:17 +0000 (09:03 +0200)]
IBM zSystems: Issue error for *DBL relocs on misaligned symbols
Relocs like PC32DBL require a right shift of the symbol value. There
is no situation where dropping symbol value bits with the right shift
is a good thing. Hence we now issue an error to detect such problems.
Simon Marchi [Tue, 18 Oct 2022 14:17:33 +0000 (10:17 -0400)]
gdb: check for groups with duplicate names in reggroups:add
In the downstream ROCm GDB port, we would create multiple register
groups with duplicate names. While it did not really hurt, it certainly
wasn't the intent. And I don't think it ever makes sense to do so.
To catch these, change the assert in reggroups::add to check for
duplicate names. It's no longer necessary to check for duplicate
reggroup pointers, because adding the same group twice would be caught
by the duplicate name check.
Change-Id: Id216a58acf91f1b314d3cba2d02de73656f8851d
Approved-By: Tom Tromey <tom@tromey.com>
GDB Administrator [Wed, 19 Oct 2022 00:00:07 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Tue, 18 Oct 2022 17:47:29 +0000 (10:47 -0700)]
x86: Disable AVX-VNNI when disabling AVX2
Since AVX-VNNI requires AVX2, disable AVX-VNNI when disabling AVX2.
* i386-gen.c (cpu_flag_init): Add CpuAVX_VNNI to
CPU_ANY_AVX2_FLAGS.
* i386-init.h: Regenerate.
Tom Tromey [Sun, 5 Jun 2022 16:22:40 +0000 (10:22 -0600)]
Remove dead code from py-finishbreakpoint.c
PR python/16324 points out that comparing a frame id to null_frame_id
can never succeed, and proposes simply removing the dead code. That
is what this patch does.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16324
Carl Love [Tue, 18 Oct 2022 15:25:36 +0000 (11:25 -0400)]
Update tests to use skip_hw_watchpoint_tests to test for HW watchpoint support.
The hardware watchpoint check has been updated in a couple of recent
patches. This patch updates the hardware watchpoint test in the remaining
gdb tests.
The issue is the PowerPC processors support hardware watchpoints with the
exception of Power 9. The hardware watchpoint support is disabled on
Power 9. The test skip_hw_watchpoint_tests must be used to correctly
determine if the PowerPC processor supports hardware watchpoints.
This patch fixes 6 test failures in test gdb.threads/watchpoint-fork.exp.
Test gdb.base/watch-vfork.exp runs with can-use-hw-watchpoints set to
true and false. When the test is run with can-use-hw-watchpoints set to
true, gdb just falls back to using software watchpoints. The
patch reduces the number of expected passes by 2 since because it now
only runs once with can-use-hw-watchpoints set to false.
Test gdb.mi/mi-watch.exp runs the test with argument hw and sw. If the
argument is hw and hardware watchpoints are not supported the test exits.
The number of expected passes is cut in half with the patch as it now only
runs the test using software breakpoints. Previously the pass to use
hardware watchpoints was not skipped and the test actually ran using
software watchpoints.
The following tests run the same with and without the patch. The tests
are supposed to execute the gdb command "set can-use-hw-watchpoints 0" if
the processor does not support hardware bwatchpoints. However the command
was not being executed and gdb was falling back to using software
watchpoints since the Power 9 watchpoint resource check fails. With the
patch, the tests now execute the command and the test runs using software
watchpoints as it did previously. The tests are:
gdb.base/commands.exp
gdb.base/cond-eval-mode.exp
gdb.base/display.exp
gdb.base/gdb11531.exp
gdb.base/recurse.exp
gdb.base/value-double-free.exp
gdb.base/watch-bitfields.exp
gdb.base/watch-cond-infcall.exp
gdb.base/watch-cond.exp
gdb.base/watchpoint-solib.exp
gdb.base/watchpoints.exp
The following two tests are not supported on the Power 9 system used to
test the changes. The patch does not change the tests results for these
tests:
gdb.python/py-breakpoint.exp
gdb.mi/mi-watch-nonstop.exp
Tom de Vries [Tue, 18 Oct 2022 13:32:47 +0000 (15:32 +0200)]
[gdb/testsuite] Handle header files with local-remote-host.exp
With test-case gdb.base/included.exp and host board local-remote-host.exp with
tentative fix for PR29697 I run into:
...
included.c:18:10: fatal error: included.h: No such file or directory
#include "included.h"
^~~~~~~~~~~~
compilation terminated.
...
Fix this by adding the missing gdb_remote_download calls.
Likewise in a few other test-cases.
Tested on x86_64-linux.
Tom de Vries [Tue, 18 Oct 2022 13:32:46 +0000 (15:32 +0200)]
[gdb/testsuite] Fix gdb.server/no-thread-db.exp with local-remote-host.exp
With test-case gdb.server/no-thread-db.exp and host board local-remote-host.exp
with a tentative fix for PR29697 I run into:
...
(gdb) print foo^M
Cannot find thread-local storage for Thread 29613.29613, executable file \
$HOME/no-thread-db:^M
Remote target failed to process qGetTLSAddr request^M
(gdb) FAIL: gdb.server/no-thread-db.exp: print foo
...
The regexp in the test-case expects the full $binfile pathname, but we have
instead $HOME/no-thread-db.
Fix this by making the regexp less strict.
Tested on x86_64-linux.
Tom de Vries [Tue, 18 Oct 2022 13:32:46 +0000 (15:32 +0200)]
[gdb/testsuite] Fix gdb.base/return-nodebug.exp with local-remote-host.exp
With host board local-remote-host.exp and test-case
gdb.base/return-nodebug.exp, I run into:
...
Executing on host: gcc -fno-stack-protector -fdiagnostics-color=never \
-DTYPE=signed\ char -c -g -o return-nodebug-signed-char0.o \
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/return-nodebug.c \
(timeout = 300)
builtin_spawn [open ...]^M
gcc: error: char: No such file or directory
...
Avoid the quoting problem by not using spaces in the define.
Tested on x86_64-linux.