Commit Graph

118651 Commits

Author SHA1 Message Date
Victor Do Nascimento
7d0383ad39 aarch64: fp8 convert and scale - add feature flags and related structures 2024-05-16 13:22:30 +01:00
Pedro Alves
3e09762b7d Stop 'configure --enable-threading' if std::thread doesn't work
Currently, if you configure gdb with explicit --enable-threading, but
then configure detects std::thread does not work, configure silently
disables threading support and continues configuring.

This patch makes that scenario cause a configuration error, like so:

 $ /home/pedro/gdb/src/configure --enable-threading && make
 ...
 configure: error: std::thread does not work; disable threading
 make[1]: *** [Makefile:11225: configure-gdbsupport] Error 1
 make[1]: Leaving directory '/home/pedro/gdb/build-windows-threads'
 make: *** [Makefile:1041: all] Error 2
 $

Additionally, if you don't explicitly pass --enable-threading, and
std::thread does not work, we will now get a warning (and the build
continues):

 $ /home/pedro/gdb/src/configure && make
 ...
 configure: WARNING: std::thread does not work; disabling threading
 ...

This is similar to how we handle --enable-tui and missing curses.  The
code and error/warning messages were borrowed from there.

Change-Id: I73a8b580d1e2a796b23136920c0e181408ae1b22
Approved-By: Tom Tromey <tom@tromey.com>
2024-05-16 13:03:58 +01:00
Matthieu Longo
f01ae0392e aarch64: add SPMU feature and its associated registers 2024-05-16 12:36:14 +01:00
Nick Clifton
e9ee1927d1 Move assembler "IRP \+" test into a separate file. Add XFAILs for targets that do not support it. 2024-05-16 11:43:29 +01:00
Richard Earnshaw
7e544ad81a arm: remove incorrect handling of FP bignums in move_or_literal_pool
This hunk of code in move_or_literal_pool just looks wrong, but I
can't find a testcase that will tickle it to prove it.  It looks a bit
like it was intended to catch cases where a bignum contained a
floating-point value, but there were a number of problems with it.

- It tested X_add_number == -1, but an FP bignum is indicated by any
  value <= 0.
- It converted the floating-point value to extended precision, but
  that's not used on Arm beyond the legacy FPA code.  No attempt was
  made to match the FP value to the intended memory/mov operation.

Since I can't construct a viable testcase, I've just removed the existing
code and made the function error out in this case: this seems more sensible
than generating wrong code or trying to write something more complex that
can't be tested anyway.
2024-05-16 11:10:15 +01:00
Tom de Vries
9c54f520db [gdb/testsuite] Generate DW_MACRO_define_strp in dwarf assembly
Add support for DW_MACRO_define_strp in dwarf assembly, and use it in
test-case gdb.dwarf2/macro-source-path.exp.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
2024-05-16 09:38:15 +02:00
Alan Modra
3e61a22ce7 Fix FAIL: macros altmacro
spu-elf and z80-coff fail this test due to "def" being a pseudo-op.
tic30-unknown-coff fails it due to '#' not starting comments.

	* testsuite/gas/macros/altmacro.s: Use /* */ comments.  Rename
	DEF to EDF.
2024-05-16 09:48:47 +09:30
GDB Administrator
52cad89678 Automatic date update in version.in 2024-05-16 00:00:19 +00:00
Fangrui Song
b1d2835049 gas: Fix \+ expansion for .irp and .irpc
.irp and .irpc receive a null macro_entry.  \+ causes a crash after the
recent \+ support.  Restore the previous behavior.

Signed-off-by: Fangrui Song <maskray@gcc.gnu.org>
2024-05-15 15:05:30 -07:00
Andrew Carlotti
53071aac47 aarch64: Add sysreg features to +d128 dependencies
We should revisit sysreg feature enablement and dependencies in future, but
this change should help until then.

OK for master?
2024-05-15 12:29:22 +01:00
Andrew Carlotti
16b4196349 aarch64: Add simd dependency to +sha2
This matches the existing behaviour in GCC and LLVM, and also the current
documentation.

OK for master?
2024-05-15 12:27:09 +01:00
Matthieu Longo
4f90313d02 aarch64: testsuite: share test utils macros and use them
This patch rewrites assembly tests to use utils macros declared in
sysreg-test-utils.inc. Some tests were adapted to use the new macro
rw_sys_reg.
2024-05-15 10:36:24 +01:00
Matthieu Longo
eb847ee117 aarch64: testsuite: reorder write and read to match macro order
This patch aims at grouping write and read for a same system register
one after another so that the diff for the macro replacement does not
generate too much noise.
2024-05-15 10:36:24 +01:00
Matthieu Longo
f2f6a6c157 aarch64: testsuite: use same regs for read and write tests
This patch aims at making easier to replacement of read and write
instructions to system registers by a macro that will use the same
registers for read and write.
2024-05-15 10:36:24 +01:00
Matthieu Longo
d5a095100b aarch64: testsuite: replace instruction addresses by regex
This patch removes the instruction addresses from the objdump's expected
output (.d files). The intended benefit from this clean-up is to allow to
swap lines around more easilly, and removes the noise of patches that add,
remove or reorder instructions.
2024-05-15 10:36:23 +01:00
Tom de Vries
e548840a03 [binutils/readelf] Fix handling of DW_MACRO_define_strx in dwo file
When printing a DW_MACRO_define_strx entry in a .debug_macro.dwo section, we
run into:
...
 DW_MACRO_define_strx lineno : 0 macro : <no .debug_str_offsets section>
...

Fix this in display_debug_macro by passing the correct dwo argument to a
fetch_indexed_string call.

That works fine for readelf -w, with with readelf -wm we have:
...
 DW_MACRO_define_strx lineno : 0 macro : <no .debug_str_offsets.dwo section>
...

Fix this in display_debug_macro by doing load_debug_section_with_follow for
str_dwo / str_index_dwo sections instead of str / str_index sections when
handling .debug_macro.dwo.

PR 31735
2024-05-15 09:45:55 +02:00
Tom de Vries
7e4f1f4bc7 [binutils/readelf] Fix printing of dwarf4 .debug_str_offsets.dwo
When compiling a hello world with dwarf4 split dwarf:
...
$ gcc -gdwarf-4 -gsplit-dwarf hello.c -save-temps -dA
...
we have in a-hello.s these three initial entries in .debug_str_offsets:
...
	.section        .debug_str_offsets.dwo,"e",@progbits
	.4byte  0       // indexed string 0x0: short int
	.4byte  0xa     // indexed string 0x1: /home/vries/binutils
	.4byte  0x1f    // indexed string 0x2: main
...
but "readelf -ws a.out" starts at the third entry:
...
Contents of the .debug_str_offsets.dwo section (loaded from a-hello.dwo):

    Length: 0x30
       Index   Offset [String]
           0 00000000  main
...

This is a regression since commit 407115429b ("Modified changes for
split-dwarf and dwarf-5."), which introduced a variable
debug_str_offsets_hdr_len in display_debug_str_offsets.

Fix this by setting display_debug_str_offsets to 0 for the dwarf4 case.

PR 31734
2024-05-15 09:45:55 +02:00
GDB Administrator
27f4c4bd19 Automatic date update in version.in 2024-05-15 00:00:19 +00:00
Joseph Faulls
7a7ec56c81 RISC-V: Search for mapping symbols from the last one found
With previous behaviour, multiple mapping symbols within the same
function would result in all the mapping symbols being searched.
This could slow down disassembly dramatically.

Multiple mapping symbols within a function can be a result of encoding
instructions as data, like sometimes seen in random instruction
generators.

opcodes/ChangeLog:

	* riscv-dis.c (riscv_search_mapping_symbol): Use last mapping
	symbol if it exists.
2024-05-15 07:01:54 +08:00
Tom Tromey
da3ce5c46e Add spaceship operator to cp-name-parser.y
While debugging gdb, I saw this:

During symbol reading: unexpected demangled name 'operator<=><std::chrono::_V2::system_clock, std::chrono::duration<long int>, std::chrono::duration<long int> >'

This happens because cp-name-parser.y does not handle the spaceship
operator.  This patch implements this.

Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:40 -06:00
Tom Tromey
3b099df59c Allow function types as template parameters in name canonicalizer
This adds function types as template parameters in the C++ name
canonicalizer.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=11907
Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:40 -06:00
Tom Tromey
a4b7c5f5cd Implement C++14 numeric separators
C++14 allows the use of the apostrophe as a numeric separator; that
is, "23000" and "23'000" represent the same number.  This patch
implements this for gdb's C++ parser and the C++ name canonicalizer.

I did this unconditionally for all C variants because I think it's
unambiguous.

For the name canonicalizer, there's at least one compiler that can
emit constants with this form, see bug 30845.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23457
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30845
Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:40 -06:00
Tom Tromey
383a3d99c3 Fix C++ canonicalization of hex literals
Currently names like "x::y::z<1>" and "x::y::z<0x01>" canonicalize to
different things.  I think it's nicer for them to be the same.
Differences between types can be done using suffixes like "ll" and "u"
-- it's not really possible to implement C++ rules in the
canoncalizer, because no gdbarch is available.  Possibly gdb should
even drop the type here and just represent all integers the same way
in names.

Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:40 -06:00
Tom Tromey
25113e2d04 Remove some unnecessary allocations from cpname_state::parse_number
cpname_state::parse_number allocates nodes for various types and then
only uses one of them.  This patch reduces the number of allocations
by not performing the unnecessary ones.

Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:39 -06:00
Tom Tromey
843d182000 Fix C++ name canonicalizations of character literals
The names "void C<(char)1>::m()" and "void C<'\001'>::m()" should
canonicalize to the same string, but currently they do not -- the
former remains unchanged and the latter is transformed to
"void C<(char)'\001'>::m()".

This patch fixes the bug and also adds some unit tests.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16843
Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:39 -06:00
Tom Tromey
6921816e5e Change storage of demangle_component
This changes demangle_component objects to be stored on the obstack
that is part of demangle_info.  It also arranges for a demangle_info
object to be kept alive by cp_merge_demangle_parse_infos.  This way,
other data on the obstack can be kept while an "outer" demangle_info
needs it.

Acked-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:39 -06:00
Tom Tromey
ed4eabdf63 Clean up demangle_parse_info
This changes demangle_parse_info to use inline initializers and to
remove some manual memory management.

Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:39 -06:00
Tom Tromey
d1587e198f Allow initialization functions in .y files
If you add an initialization function to a .y file, it will not show
up in init.c, because if the yacc output is in the build tree, it
won't be found.

This patch changes the Makefile to be more robust in this situation.
2024-05-14 13:28:39 -06:00
Tom Tromey
6bc4d69d3d Remove test code from cp-name-parser.y
This removes the current test 'main' from cp-name-parser.y.  There
aren't any tests using this, and nowadays it would be better as a unit
test.

Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-05-14 13:28:39 -06:00
Tom Tromey
be2a6a5803 Disallow trailing whitespace in docstrings
This patch changes the docstring self-test to verify that there is no
trailing whitespace at the end of lines.  A few existing docstrings
had to be updated.
2024-05-14 13:23:37 -06:00
Tom Tromey
0a6b9eefc2 Remove fflush call from tui_refresh_cmd_win
tui_refresh_cmd_win calls fflush, but there's a comment explaining
that the reason for the call is unknown.  This patch removes the call.
I don't think it can be useful, since gdb doesn't generally use stdout
in this way -- only through ui_file.
2024-05-14 13:02:03 -06:00
Andrew Burgess
ad666becfe gdb/doc: don't delete *.pod files too early
When doing 'make -C gdb/doc man' to build the man pages, I noticed
that the outputs were being rebuilt each time the make command was
rerun, even when the input files hadn't changed.

This was caused by this commit:

  commit 824083f34c
  Date:   Fri Apr 12 17:47:20 2024 +0100

      gdb/doc: use silent-rules.mk in the Makefile

Which split the generation of the .pod file from the actual creation
of the man page file.  Prior to this split it was OK to delete the
.pod file at the end of the recipe, the rule depending on the .texi
input file, and output was the .1 or .5 man page file.

Now however, with the split, the man page creation depends on the .pod
file, if we delete this after creating the .1 or .5 man page file then
the next time we run 'make' the .pod file is missing and is
regenerated, which in turn triggers the regeneration of the man page
file.

Fix this by leaving the .pod file around, and only cleaning up these
files in the 'mostlyclean' target.

Which leads to a second problem, the POD_FILE_TMPS is not created
correctly, so we don't actually clean up the .pod files!  This too is
fixed in this commit.

After this commit running 'make -C gdb/doc man' will build the manual
pages the first time, and each subsequent run will do nothing.

Running 'make -C gdb/doc mostlyclean' will now delete the .pod files.

Approved-By: Tom Tromey <tom@tromey.com>
2024-05-14 16:53:29 +01:00
Andrew Burgess
c2b915e2a5 gdb/testsuite: remove unnecessary -Wl,-soname,NAME build flags
While working on another patch I needed to pass -Wl,-soname,NAME as a
compiler flag.  I initially looked for other tests that did this, and
found a few examples, so I copied what they did.

But when I checked the gdb.log file I noticed that we were actually
getting -Wl,-soname passed twice.

I tracked the repeated option to 'proc gdb_compile_shlib_1' in
lib/gdb.exp.  It turns out that we always add -Wl,-soname when
compiling a shared library.

Here's an example of a build command from gdb.base/prelink.exp:

  builtin_spawn -ignore SIGHUP gcc -fno-stack-protector \
    /tmp/build/gdb/testsuite/outputs/gdb.base/prelink/prelink-lib.c.o \
    -fdiagnostics-color=never -shared -g \
    -Wl,-soname,prelink.so -Wl,-soname,prelink.so -lm \
    -o /tmp/build/gdb/testsuite/outputs/gdb.base/prelink/prelink.so

Notice that '-Wl,-soname,prelink.so' is repeated.

I believe that all of the places where tests add '-Wl,-soname,NAME' as
a build option, are unnecessary.

In this commit I propose we remove them all.

As part of this change I've switched from calling gdb_compile_shlib
directly, to instead call build_executable and adding the 'shlib'
flag.

I've tested with gcc and clang and see no changes in the test results
after this commit.  All the compile commands still have -Wl,-soname
added, but now it's only added once, from within lib/gdb.exp.

There should be no change in what is tested after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
2024-05-14 16:51:50 +01:00
Pali Roh?r
4ac16d6607 Improve objdump -p output of PE Import and Export Tables
PR 31738
2024-05-14 16:50:32 +01:00
Jason Merrill
f1fe1d35c8 Adjust C++ destructor type tests
In gcc-15-95-ga12cae97390 I dropped the unnecessary artificial "in-charge"
parameter from destructors of classes with no virtual bases; Linaro's CI
informed me that the gdb testsuite needs to be adjusted to match.

Teested against GCC 13.2 and GCC 15 trunk.

Approved-by: Kevin Buettner <kevinb@redhat.com>
2024-05-14 08:40:06 -06:00
Nick Clifton
b9a16391e8 Fix gas's 'macro count' test for various targets 2024-05-14 15:30:52 +01:00
Aditya Vidyadhar Kamath
414aa6987f Fix Segmentation Fault in AIX during multi process debugging.
Due to the recent commit in aix-thread.c, we see a segmentation fault
in AIX while debugging multiple process involving multiple threads.

One example is a thread that can fork. The GDB output in AIX for the same is

Reading symbols from //gdb_tests/multi-thread-fork...
(gdb) set detach-on-fork off
(gdb) r
Starting program: /gdb_tests/multi-thread-fork
[New Thread 258 (tid 67110997)]
[New Thread 515 (tid 127404289)]
[New inferior 2 (process 16580940)]
Hello from Parent!
[process 16580940 exited]
[New inferior 3 (process 14549318)]
Hello from Parent!
[process 14549318 exited]
Fatal signal: Segmentation fault
----- Backtrace -----

This is because in sync_threadlists () in aix-thread.c there when we
delete threads in unknown state we iterate through all the threads.

When we have one or more threads with the same user thread ID but of different
process then we delete a wrong thread. Since we just check only the pdtid
in in_queue_threads.count (priv->pdtid) == 0 this happened.

This patch is a fix for the same.

The output after we apply this patch is:
Reading symbols from //gdb_tests/multi-thread-fork...
(gdb) set detach-on-fork off
(gdb) r
Starting program: /gdb_tests/multi-thread-fork
[New Thread 258 (tid 75565441)]
[New Thread 515 (tid 63244397)]
[New inferior 2 (process 10813892)]
Hello from Parent!
[New inferior 3 (process 19005888)]
Hello from Parent!

Thread 1.1 received signal SIGINT, Interrupt.
0xd0611d70 in _p_nsleep () from /usr/lib/libpthread.a(_shr_xpg5.o)
(gdb) info threads
  Id   Target Id                             Frame
* 1.1  Thread 1 (tid 66062355) ([running])   0xd0611d70 in _p_nsleep () from /usr/lib/libpthread.a(_shr_xpg5.o)
  1.2  Thread 258 (tid 75565441) ([running]) thread_function (arg=0x0) at //gdb_tests/multi-thread-fork.c:50
  1.3  Thread 515 (tid 63244397) ([running]) thread_function (arg=0x0) at //gdb_tests/multi-thread-fork.c:50
2.1  Thread 515 (tid 32113089) ([running]) 0xd0610df0 in _sigsetmask () from /usr/lib/libpthread.a(_shr_xpg5.o)
  3.1  Thread 258 (tid 64489699) ([running]) 0xd0610df0 in _sigsetmask () from /usr/lib/libpthread.a(_shr_xpg5.o)
(gdb) q
A debugging session is active.
2024-05-14 12:02:31 +02:00
Richard Earnshaw
30d57f2e41 arm: update documentation for removal of the Maverick extension
Finally, update the documentation and add a NEWS item.
2024-05-14 10:56:58 +01:00
Richard Earnshaw
71afdf2e26 arm: remove Maverick support from BFD.
Remove the handling of Maverick from BFD.  Where appropriate we handle
legacy code by mapping ep9312 onto Armv4t.
2024-05-14 10:56:58 +01:00
Richard Earnshaw
ad5da6e6d8 arm: opcodes: remove Maverick disassembly.
Remove the patterns to match Maverick co-processor instructions from
the disassembly tables.

This required fixing a couple of tests in the assembler testsuite
where we, probably incorrectly, disassembled generic co-processor
instructions as a Maverick instruction (it particularly made no sense
to do this for Armv6t2 in Thumb state).
2024-05-14 10:56:58 +01:00
Richard Earnshaw
e06a561b73 arm: binutils: drop Maverick support.
Remove the decoding of the Maverick flag from readelf.
2024-05-14 10:56:58 +01:00
Richard Earnshaw
58bd8d56c7 arm: remove Maverick support from the assembler.
Delete all the Maverick instructions and register handling from the
assembler.  We continue to recognize -mcpu=ep9312, but treat it as an
alias for arm920t.  We no-longer recognize -mfpu=maverick.
2024-05-14 10:56:58 +01:00
Richard Earnshaw
b5ae4e7b45 arm: remove tests for Maverick FPU extensions
Before removing the code itself, remove the tests that will no-longer
apply.
2024-05-14 10:56:57 +01:00
GDB Administrator
a2db92ea31 Automatic date update in version.in 2024-05-14 00:00:14 +00:00
Nick Clifton
83b972fc27 Add new assembler macro pseudo-variable \+ which counts the number of times a macro has been invoked. 2024-05-13 09:56:09 +01:00
GDB Administrator
7143ed1205 Automatic date update in version.in 2024-05-13 00:00:15 +00:00
GDB Administrator
52b38954b2 Automatic date update in version.in 2024-05-12 00:00:10 +00:00
Tom de Vries
14b1358663 [gdb/testsuite] Fix Wreturn-mismatch in gdb.base/list-dot-nodebug.exp
When running test-case gdb.base/list-dot-nodebug.exp in a fedora rawhide
container, I run into:
...
temp/$pid/static-libc.c: In function 'main':
temp/$pid/static-libc.c:2:42: error: 'return' with a value, in function
 returning void [-Wreturn-mismatch]
    2 |                void main (void) { return 0; }
      |                                          ^
  ...
UNTESTED: gdb.base/list-dot-nodebug.exp: Can't statically link
...

Fix this by changing the return type to int.

Tested on x86_64-linux.
2024-05-11 09:56:45 +02:00
GDB Administrator
353f6a9bd1 Automatic date update in version.in 2024-05-11 00:00:07 +00:00
Tom Tromey
e14f6ec969 Change gdbarch_inner_than to return bool
A recent patch from Andrew pointed out that gdbarch_inner_than returns
'int', while it should really return 'bool'.

Approved-By: Pedro Alves <pedro@palves.net>
2024-05-10 13:22:25 -06:00