]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
3 months agogdb: make create_function_type static
Simon Marchi [Wed, 17 Dec 2025 15:54:55 +0000 (10:54 -0500)] 
gdb: make create_function_type static

It is only used within gdbtypes.c.

Change-Id: I3976ca1ec3253c0ade6e7ac71d967d09108d2454
Approved-By: Tom Tromey <tom@tromey.com>
3 months agoFix check-whitespace complaint
Tom Tromey [Tue, 6 Jan 2026 18:18:12 +0000 (11:18 -0700)] 
Fix check-whitespace complaint

check-whitespace complaint about a trailing empty line in
gdb/dwarf2/cu.c.  This fixes it.

3 months agoReindent gdb.ada tests
Tom Tromey [Tue, 16 Dec 2025 21:04:11 +0000 (14:04 -0700)] 
Reindent gdb.ada tests

Various gdb.ada tests had incorrect indentation.  This patch reformats
these.  It was written by script.

3 months agoSmall cleanup to interpreter initialization
Tom Tromey [Mon, 8 Dec 2025 14:50:48 +0000 (07:50 -0700)] 
Small cleanup to interpreter initialization

interp::inited is currently public, because interp_set does the task
of making sure the interpreter is only initialized a single time.
However, the interpreter can do this job itself, and this member can
be private.

3 months agoRemove two "unsupported" tests from gdb.dwarf2/imported-unit.exp
Tom Tromey [Sun, 30 Nov 2025 22:04:04 +0000 (15:04 -0700)] 
Remove two "unsupported" tests from gdb.dwarf2/imported-unit.exp

gdb.dwarf2/imported-unit.exp yields two "unsupported" results but then
carries on.

These tests look for psymtabs, which haven't been used by the DWARF
reader since the introduction of the cooked index.

This patch removes these tests and also the supporting function
psymtabs_p, which is no longer used.

3 months agogdb: remove context_stack::static_link
Simon Marchi [Mon, 5 Jan 2026 20:38:18 +0000 (15:38 -0500)] 
gdb: remove context_stack::static_link

I don't think it's needed to record this information in the
context_stack structure.  The only user is the DWARF reader, where it
can very well be a local variable.

Change-Id: I6e33affbf03f11c0d0ab60067f169137fde1c994
Approved-By: Tom Tromey <tom@tromey.com>
3 months agoSimplify linespec.c:collect_info
Tom Tromey [Fri, 2 Jan 2026 18:34:36 +0000 (11:34 -0700)] 
Simplify linespec.c:collect_info

I noticed that linespec has a subclass of collect_info that would be
easily replaced by a boolean.  This patch cleans up this area by
removing the subclass, adding a constructor to collect_info, and
removing an unnecessary structure type used by it.

Regression tested on x86-64 Fedora 40.

Approved-By: Andrew Burgess <aburgess@redhat.com>
3 months ago[gdb/testsuite] Fix gdb.base/watchpoint-adjacent.exp with m32
Tom de Vries [Tue, 6 Jan 2026 14:42:55 +0000 (15:42 +0100)] 
[gdb/testsuite] Fix gdb.base/watchpoint-adjacent.exp with m32

PR testsuite/33727 reports the following failure with test-case
gdb.base/watchpoint-adjacent.exp and i686-linux (or, x86_64-linux and target
board unix/-m32):
...
(gdb) continue^M
Continuing.^M
watchpoint-adjacent-type_ll: watchpoint-adjacent.c:63: main: \
  Assertion `(((uintptr_t) &obj.a) & 0x7) == 0' failed.^M
^M
Program received signal SIGABRT, Aborted.^M
0xb7fc5579 in __kernel_vsyscall ()^M
(gdb) FAIL: $exp: var_type=type_ll: test= a {a b} : rwatch_first=true: \
  continue to breakpoint: prepare for read test
...

The problem is that the test-case expects 8-byte aligned data as an effect of
using long long, but long long has an alignment of 4 bytes [1].

Fix this by using __attribute__((aligned(8))).

After fixing this, we find one remaining failure.  This has been filed as
PR breakpoints/33762.

Tested on x86_64-linux with target boards unix/-m64 and unix/-m32.

Approved-By: Andrew Burgess <aburgess@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33727

[1] https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-malign-double

3 months agogdb/dwarf: rename dwarf2_start_subfile to dwarf2_cu::start_subfile
Andrew Burgess [Thu, 25 Dec 2025 11:15:09 +0000 (11:15 +0000)] 
gdb/dwarf: rename dwarf2_start_subfile to dwarf2_cu::start_subfile

Rename dwarf2_start_subfile to dwarf2_cu::start_subfile.  This
refactor continues the work started in the previous commit.

There should be no user visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: move subfile and symtab creation into dwarf2_cu method
Andrew Burgess [Thu, 27 Nov 2025 17:42:19 +0000 (17:42 +0000)] 
gdb/dwarf: move subfile and symtab creation into dwarf2_cu method

There are two places in the dwarf2/ code where we create subfiles and
symtabs for the entries in a dwarf2_cu's line_header.  The code in
each location is basically the same.

Move this code into a new dwarf2_cu member function.

In dwarf2/read.c the existing code had an additional task; this is
left in dwarf2/read.c in its own loop immediately after the call to
the new member function.

There should be no user visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove the line_header argument from dwarf2_start_subfile
Andrew Burgess [Wed, 24 Dec 2025 20:36:54 +0000 (20:36 +0000)] 
gdb/dwarf: remove the line_header argument from dwarf2_start_subfile

As with the previous two commits, this commit removes the line_header
argument from dwarf2_start_subfile.  This function already takes a
dwarf2_cu argument, and the line_header passed in is always the line
header pointed to by the dwarf2_cu argument, so lets just access the
line header through the dwarf2_cu.

As dwarf2_start_subfile relies on the dwarf2_cu always being non-NULL,
I've converted the dwarf2_cu argument from a pointer to a reference.
The alternative was adding an assert within dwarf2_start_subfile that
the pointer was not NULL.

There should be no user visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove m_line_header from lnp_state_machine class
Andrew Burgess [Wed, 24 Dec 2025 20:24:53 +0000 (20:24 +0000)] 
gdb/dwarf: remove m_line_header from lnp_state_machine class

Following on from the previous commit, this commit remove
m_line_header from the lnp_state_machine class.  The lnp_state_machine
class already holds m_cu, a dwarf2_cu, and the m_line_header was
always just m_cu->line_header, so instead of holding both of these
separately, lets just hold m_cu, and access the line header through
that.

There should be no user visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/dwarf: remove line_header parameter from dwarf2_decode_lines
Andrew Burgess [Thu, 27 Nov 2025 17:08:56 +0000 (17:08 +0000)] 
gdb/dwarf: remove line_header parameter from dwarf2_decode_lines

The function declaration for dwarf2_decode_lines is:

  void dwarf_decode_lines (struct line_header *lh, struct dwarf2_cu *cu,
                           unrelocated_addr lowpc, bool decode_mapping)

However, it is always the case that:

  lh == cu->line_header

I propose that we simplify the dwarf_decode_lines signature by
removing the line_header parameter.  The same is true for
dwarf_decode_lines_1, which is only called from dwarf_decode_lines.

I'm proposing this change because I was looking through the DWARF
code, trying to understand how symtabs are created, and this extra
complexity just makes things harder to understand: what is the
relationship between the line_header (LH) and dwarf2_cu (CU)
parameters?  When would we ever want to process a line_header other
than the one attached to CU? (answer: never, and we don't).  This
simplification makes things easier to understand (IMHO).
There should be no user visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
3 months agoAutomatic date update in version.in
GDB Administrator [Tue, 6 Jan 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months agogas: dw2gencfi: reset reloc to TC_PARSE_CONS_RETURN_NONE for [su]leb128
Indu Bhagat [Sat, 20 Dec 2025 04:29:34 +0000 (20:29 -0800)] 
gas: dw2gencfi: reset reloc to TC_PARSE_CONS_RETURN_NONE for [su]leb128

Some consumers, like SFrame generation logic in GAS, may want to check
reloc value (without qualifying by e->type) as a part of their
admissibility criteria.  Setting reloc to TC_PARSE_CONS_RETURN_NONE for
these CFI escape expr nodes for [su]leb128 keeps the admissibility
checks simple and generic.

Previous discussion here:
https://sourceware.org/pipermail/binutils/2025-December/146807.html

gas/
* gas/dw2gencfi.c (dot_cfi_escape): Set reloc to
TC_PARSE_CONS_RETURN_NONE.

3 months ago[gdb/testsuite] Fix gdb.python/py-corefile.py with m32
Tom de Vries [Mon, 5 Jan 2026 20:56:55 +0000 (21:56 +0100)] 
[gdb/testsuite] Fix gdb.python/py-corefile.py with m32

With target board unix/-m32 and test-case gdb.python/py-corefile.exp I run
into:
...
FAIL: $exp: test mapped files data: diff input and output one
...
due to differences like 0x0000000008048000 vs 0x08048000.

Fix this in gdb.python/py-corefile.py by detecting and handling the
ptr_size == 4 case.

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
PR testsuite/33728
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33728

3 months agogdb: remove mdebugread & al
Simon Marchi [Mon, 5 Jan 2026 19:58:09 +0000 (14:58 -0500)] 
gdb: remove mdebugread & al

After working on the "gdb: replace msym_bunch with deque" patch, I dug
into the history of the mdebug format, and have come to the conclusion
that it is time to remove that code.

ECOFF and mdebug were apparently relevant up to the mid 90s, after which
they were replaced with ELF and DWARF.

It was apparently possible to have mdebug-in-ELF, which is why elfread.c
calls into mdebugread.c, as well as stabs-in-mdebug(-in-ELF), which is
why mdebugread.c used to call into stabsread.c (following the stabs
removal, mdebugread.c now just errors out when encountering stabs).

Here are some pointers to understand the history of this:

 - David Anderson's note about mdebug, which says "SGI moved on to
   DWARF2 as its debugging format (as have nearly all modern compilers)"
   [1] (modern likely meaning anything in the 2000s).

 - Peter Rowell's (from Third Eye Software) post that explains the
   history of what became mdebug [2][3].

 - The ECOFF spec [4].

 - A post on gcc-patches indicating that mdebug for Alpha was obsolete
   in 2001 [5].

This patch deletes:

 - mdebugread.c
 - mdebugread.h
 - mipsread.c
 - alpha-mdebug-tdep.c

Remove mdebug support stuff from configure.ac.

Adjust elfread.c to not call into mdebugread.c anymore.  Leave a warning
just like we have for stabs.

Adjust the Alpha tdep code to not call alpha_mdebug_init_abi anymore.

[1] https://www.prevanders.net/#mdebug
[2] http://www.datahedron.com/mips.html
[3] https://www.prevanders.net/mdebug.html
[4] https://web.archive.org/web/20160305114748/http://h41361.www4.hp.com/docs/base_doc/DOCUMENTATION/V50A_ACRO_SUP/OBJSPEC.PDF
[5] https://gcc.gnu.org/legacy-ml/gcc/2001-02/msg00389.html

Change-Id: I784b19ed802a3af536d208b9f039b927543f0e02
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/buildsym: replace struct pending with std::vector
Simon Marchi [Fri, 19 Dec 2025 18:43:44 +0000 (13:43 -0500)] 
gdb/buildsym: replace struct pending with std::vector

Replace `struct pending`, a home-made linked list of chunks of symbols,
with `std::vector<symbol *>`.  This removes manual memory management and
simplifies the code.

The change starts by switching m_local_symbols, m_file_symbols and
m_global_symbols in buildsym_compunit to be vectors, and propagates from
there.

~buildsym_compunit no longer needs to manually free the lists (it did
not free m_local_symbols, was it on purpose?).

add_symbol_to_list just appends the symbol to the vector.  Obviously,
this sometimes causes a vector reallocation, but it is amortized O(1)
and I did not find that it causes a performance degradation (more
details later).  We could try to reserve some space in the vectors up
front if we had an estimate of how many entries we'll have, but I am not
sure we really can have a good idea up front.

collate_pending_symbols_by_language iterates the vector backwards to
keep the existing behavior.  I am not sure if this is actually needed.

buildsym_compunit::push_context std::moves m_local_symbols, to avoid
copying the contents of the vector.  I don't think
buildsym_compunit::pop_context needs to change, everything should be
efficient thanks to NRVO.  Users of buildsym_compunit::pop_context use
std::move to move context_stack::locals back to m_local_symbols.

There is a non-trivial change in coff_read_enum_type, which I can't
test easily.

I did the following test to see if this change would have a performance
impact:

 - I added a scoped_time_it in maintenance_expand_symtabs, to measure
   just that step
 - I use a build of blender compiled with "-O2 -g"
 - I run:

     $ ./gdb -q -nx --data-directory=data-directory  -iex 'maint set dwarf sync on' -iex "maint set per-command time on" -ex  "file /data1/smarchi/blender/build-RelWithDebInfo-gcc/bin/blender" -ex "maint expand windowmanager" -batch

 - I record the time taken by maintenance_expand_symtabs

Before looks like:

    Time for "maintenance_expand_symtabs": wall 34.311, user 32.335, sys 1.829, user+sys 34.164, 99.6 % CPU
    Time for "maintenance_expand_symtabs": wall 34.208, user 32.265, sys 1.800, user+sys 34.065, 99.6 % CPU
    Time for "maintenance_expand_symtabs": wall 34.420, user 32.378, sys 1.894, user+sys 34.272, 99.6 % CPU

After looks like:

    Time for "maintenance_expand_symtabs": wall 34.316, user 32.342, sys 1.838, user+sys 34.180, 99.6 % CPU
    Time for "maintenance_expand_symtabs": wall 34.318, user 32.347, sys 1.831, user+sys 34.178, 99.6 % CPU
    Time for "maintenance_expand_symtabs": wall 34.357, user 32.272, sys 1.943, user+sys 34.215, 99.6 % CPU

I also measured the execution of the whole command (with "maint set
per-command time off" this time).  Before looks like:

    116.12user 12.61system 1:30.68elapsed 141%CPU (0avgtext+0avgdata 10707780maxresident)k
    116.69user 12.33system 1:31.42elapsed 141%CPU (0avgtext+0avgdata 10709132maxresident)k
    116.51user 12.57system 1:30.83elapsed 142%CPU (0avgtext+0avgdata 10729880maxresident)k

After looks like:

    115.75user 12.03system 1:29.35elapsed 143%CPU (0avgtext+0avgdata 10712348maxresident)k
    116.41user 12.58system 1:30.94elapsed 141%CPU (0avgtext+0avgdata 10727488maxresident)k
    115.91user 11.90system 1:29.36elapsed 143%CPU (0avgtext+0avgdata 10770412maxresident)k

Change-Id: I984fdaf47b9bddd840c033a6c6052b007bdcd13d
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/buildsym: add constructor to context_stack
Simon Marchi [Fri, 19 Dec 2025 18:43:43 +0000 (13:43 -0500)] 
gdb/buildsym: add constructor to context_stack

This makes it clearer what is set up front vs what is set later by
callers.

Change-Id: I2ee8d053c068f2b9ca37d48834aa688aeb6c0560
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/buildsym: make buildsym_compunit return a reference
Simon Marchi [Fri, 19 Dec 2025 18:43:42 +0000 (13:43 -0500)] 
gdb/buildsym: make buildsym_compunit return a reference

This is more C++-y.  Remove the struct keywords from pop_context just to
match.

Rename "newobj" to "ctx" in the users of context_stack, because I think
the "newobj" name is meaningless.

For a later task: I think we should find a better name for
context_stack, because it is not a stack (it is an entry in the context
stack).

Change-Id: Ibc66b910ab0f31b367b99812e0469311a99641c9
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/buildsym: fix indentation of struct context_stack
Simon Marchi [Fri, 19 Dec 2025 18:43:41 +0000 (13:43 -0500)] 
gdb/buildsym: fix indentation of struct context_stack

While at it, fixup some comments, remove unnecessary empty lines,
remove unnecessary struct keywords.

Change-Id: I67a4c8302dfca46417d5f46f5dc0378a066f80c4
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/buildsym: remove context_stack::end_addr
Simon Marchi [Fri, 19 Dec 2025 18:43:40 +0000 (13:43 -0500)] 
gdb/buildsym: remove context_stack::end_addr

It is unused.

Change-Id: Ie86448552500a049d47118d0306231da0ef9a5e1
Approved-By: Tom Tromey <tom@tromey.com>
3 months agogdb/buildsym: remove find_symbol_in_list
Simon Marchi [Fri, 19 Dec 2025 18:43:39 +0000 (13:43 -0500)] 
gdb/buildsym: remove find_symbol_in_list

It is unused.

Change-Id: Iecc488afeaa123d6ad6e7a2952bb46539ef020a2
Approved-By: Tom Tromey <tom@tromey.com>
3 months agoUpdate copyright dates to include 2026
Tom Tromey [Mon, 5 Jan 2026 15:13:29 +0000 (08:13 -0700)] 
Update copyright dates to include 2026

This updates the copyright headers to include 2026.  I did this by
running gdb/copyright.py and then manually modifying a few files as
noted by the script.

3 months agolibsframe: add README and mention expectations
Indu Bhagat [Mon, 5 Jan 2026 19:53:13 +0000 (11:53 -0800)] 
libsframe: add README and mention expectations

libsframe is not meant for consumption by tools external to GNU
Binutils.

libsframe/
* Makefile.in: Regenerate.
* libsframe/README: New file.

3 months agoFix Ada 'Modulus attribute
Tom Tromey [Thu, 11 Dec 2025 19:31:40 +0000 (12:31 -0700)] 
Fix Ada 'Modulus attribute

The internal AdaCore test suite pointed out that my earlier patch to
displaying modular types broke the 'Modulus attribute -- it was
off-by-one.

While fixing this, though, I realized that the earlier 'ptype' problem
also affected this attribute.  So, this patch implements a similar fix
in the parser.

This adds some operator+ overloads to gdb_mpz for convenience.  That
class still doesn't have the full complement of operators -- they are
added as needed.

3 months agoAdd variable styling to "finish" output
Tom Tromey [Thu, 11 Dec 2025 15:10:51 +0000 (08:10 -0700)] 
Add variable styling to "finish" output

"finish" will print a line like:

    Value returned is $1 = 0

Here, the "$1" is not styled, but in other places, history variables
are styled using the "variable" style.  This patch corrects the
oversight.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33714

3 months agoaarch64: Add support for POE2 PLBI instruction
Srinath Parvathaneni [Mon, 5 Jan 2026 17:50:55 +0000 (17:50 +0000)] 
aarch64: Add support for POE2 PLBI instruction

This patch adds support for PLB invalidate operation (PLBI) instruction
and the corresponding system registers as operand (<plbi_op>).

Syntax: PLBI <plbi_op>{, <Xt>}

This instruction is an alias to "SYS #<op1>, C10, <Cm>, #<op2>{, <Xt>}"
and PLBI being the preferred disassembly.

The following list of system registers are supported in this patch for the
PLBI instructions enabled by "+poe2" flag and also the "nxs" variants of
these system registers are enabled by "+poe2+xs" flag.

   * alle1
   * alle1is
   * alle1os
   * alle2
   * alle2is
   * alle2os
   * alle3
   * alle3is
   * alle3os
   * aside1
   * aside1is
   * aside1os
   * permae1
   * permae1is
   * permae1os
   * perme1
   * perme1is
   * perme1os
   * perme2
   * perme2is
   * perme2os
   * perme3
   * perme3is
   * perme3os
   * vmalle1
   * vmalle1is
   * vmalle1os

3 months agoaarch64: Add support for TEV instructions
Srinath Parvathaneni [Mon, 5 Jan 2026 17:50:43 +0000 (17:50 +0000)] 
aarch64: Add support for TEV instructions

This patch adds support for FEAT_TEV feature enabled by "+tev"
flag along with support for following instructions.

* TENTER
* TEXIT

TENTER instruction uses the existing AARCH64_OPND_NOT_BALANCED_17 operand
to handle the not_balanced (NB) argument , where as a new operand
AARCH64_OPND_NOT_BALANCED_10 is added to support the NB (not_balanced)
argument in TEXIT instruction.

3 months agoaarch64: Add support for POE2 system registers
Srinath Parvathaneni [Mon, 5 Jan 2026 17:50:32 +0000 (17:50 +0000)] 
aarch64: Add support for POE2 system registers

This patch adds support for POE2 system registers which are available
by default, however if guarding restrictions are enabled
using -menable-sysreg-checking than "+poe2" option need to specified
to the -march.

Co-authored-by: Matthew Malcomson <matthew.malcomson@arm.com>
3 months agoaarch64: Add support for POE2 instructions
Srinath Parvathaneni [Mon, 5 Jan 2026 17:50:24 +0000 (17:50 +0000)] 
aarch64: Add support for POE2 instructions

This patch adds support for FEAT_S1POE2 feature enabled by "+poe2"
flag along with support for following instructions.

* TCHANGEB (immediate)
* TCHANGEB (register)
* TCHANGEF (immediate)
* TCHANGEF (register)

A new operand AARCH64_OPND_NOT_BALANCED_17 is added to the code in this
patch to support the new optional argument "NB" (not_balanced) which
is a 1-bit field in the encoding for all the above mentioned
instructions.

Co-authored-by: Matthew Malcomson <matthew.malcomson@arm.com>
3 months ago[pre-commit] Move tclint.toml settings to pyproject.toml
Tom de Vries [Mon, 5 Jan 2026 17:30:49 +0000 (18:30 +0100)] 
[pre-commit] Move tclint.toml settings to pyproject.toml

Starting release v0.7.0, tclint has config discovery support, allowing us to
move the tclint settings from tclint.toml to pyproject.toml.

Approved-By: Tom Tromey <tom@tromey.com>
3 months ago[pre-commit] Require pyyaml for pre-commit-setup hook
Tom de Vries [Mon, 5 Jan 2026 17:30:49 +0000 (18:30 +0100)] 
[pre-commit] Require pyyaml for pre-commit-setup hook

I ran pre-commit in a fresh virtual environment, and ran into pre-commit-setup
missing package pyyaml.

Fix this by:
- changing the language to python, and
- adding pyyaml in the additional_dependencies.

Approved-By: Tom Tromey <tom@tromey.com>
3 months agoAdd Ada unhandled exception filter to DAP
Tom Tromey [Tue, 16 Dec 2025 13:54:28 +0000 (06:54 -0700)] 
Add Ada unhandled exception filter to DAP

This adds a way for DAP clients to catch unhandled Ada exceptions,
similar to the "catch exception unhandled" CLI command.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
3 months agoChange handling of over-long DAP variables requests
Tom Tromey [Fri, 19 Dec 2025 12:51:39 +0000 (05:51 -0700)] 
Change handling of over-long DAP variables requests

In PR dap/33228, we changed gdb to gracefully report an error if a DAP
'variables' request asked for more variables than had been reported.

This behavior was clarified in the spec, see

    https://github.com/microsoft/debug-adapter-protocol/issues/571

This patch changes gdb to conform to the specified approach, namely
truncating the list rather than erroring.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33228
Approved-By: Andrew Burgess <aburgess@redhat.com>
3 months agoFix DAP 'disconnect' implementation
Tom Tromey [Tue, 16 Dec 2025 15:43:43 +0000 (08:43 -0700)] 
Fix DAP 'disconnect' implementation

gdb's implementation of the DAP 'disconnect' request was incorrect in
a few ways.

First, the 'terminateDebuggee' field is optional, and has a special
meaning when not supplied: it should do whatever the default is.

Second, if the inferior was attached, it should detach rather than
terminate by default.

Finally, if the inferior was not started at all, it seems reasonable
for this request to simply succeed silently -- currently it returns
"success: false" with the reason being that the inferior isn't
running.

Approved-By: Andrew Burgess <aburgess@redhat.com>
3 months agoAutomatic date update in version.in
GDB Administrator [Mon, 5 Jan 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months agoSet ELF_OSABI for x86 and sparc
Alan Modra [Sat, 3 Jan 2026 03:26:01 +0000 (13:56 +1030)] 
Set ELF_OSABI for x86 and sparc

The idea of this patch is to match the solaris target over other
targets if e_ident contains ELFOSABI_SOLARIS.  The solaris target will
continue to recognise ELFOSABI_NONE objects.

This has the side effect of disabling gnu features that require
ELFOSABI_GNU, such as ifuncs.  I think that is correct, so I've made
the required testsuite changes to fix the resulting regressions:
FAIL: nm --ifunc-chars (assembly)
FAIL: mbind sections without SHF_ALLOC

The patch also sets ELF_OSABI for the gnu x86 and sparc targets,
for the same reason as the solaris targets.  This doesn't mean object
files will automatically be marked ELFOSABI_GNU/LINUX.  As before that
will only happen when certain GNU extensions are present.

bfd/
* elf32-i386.c: Define ELF_OSABI for solaris and gnu targets.
* elf32-sparc.c: Likewise.
* elf64-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.
* format.c (bfd_check_format_matches): Bump match_priority
for matching e_ident EI_OSABI.
binutils/
* testsuite/binutils-all/nm.exp: Use !supports_gnu_osabi to
disable ifunc test.
gas/
* testsuite/gas/elf/section13.d: Only run on supports_gnu_osabi
targets.  Remove xfails.

3 months agoELF OSABI matching
Alan Modra [Sat, 3 Jan 2026 03:21:21 +0000 (13:51 +1030)] 
ELF OSABI matching

Currently a binutils ELF target with ELF_OSABI defined to something
other than the default ELFOSABI_NONE will only accept object files
with e_ident[EI_OSABI] having the value ELF_OSABI.  An ELF target with
ELF_OSABI as ELFOSABI_NONE will match any e_ident[EI_OSABI] value, and
typically that target's object files will have ELFOSABI_NONE or one
other value in e_ident[EI_OSABI].  Given an object file with that
"other value" we'd like to be able to choose the correct target but
currently have no way to do so.  This patch is a step towards
implementing better target matching.

It does so by adding an ELF_OSABI_EXACT to the target description,
setting that true for all targets that currently define ELF_OSABI, and
testing the new flag for exact matching.  This will allow a future
patch to define ELF_OSABI without forcing exact matching but giving a
hint as to the best target match.

Some other tweaks are done as shown by the changelog below but no
user functional changes should be seen with this patch.

* elf-bfd.h (struct elf_backend_data): Add osabi_exact.
* elf.c (_bfd_elf_final_write_processing): Only set e_ident
from elf_osabi when osabi_exact.
* elfcode.h (elf_object_p): Test osabi_exact to reject
mismatching e_ident.  Remove unnecessary EM_NONE test.
* elfcore.h (elf_core_file_p): Likewise.
* elfxx-target.h (ELF_OSABI_EXACT): Provide default of 0,
and init elfNN_bed.
(elf_match_priority): Handle ELF_OSABI_EXACT.
* elf32-arm.c (ELF_OSABI_EXACT): Define and undef along with
ELF_OSABI.
* elf32-hppa.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-mips.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-tic6x.c: Likewise.
* elf32-visium.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-mips.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.
* elfn32-mips.c: Likewise.
* elfnn-ia64.c: Likewise.
* elf32-msp430.c: Likewise.  Don't define ELF_OSABI to
ELFOSABI_NONE.

3 months agoelf_backend_data typedef
Alan Modra [Sat, 3 Jan 2026 03:20:45 +0000 (13:50 +1030)] 
elf_backend_data typedef

"const struct elf_backend_data" appears many places in the source,
and in some cases makes a line too long without wrapping.  This patch
introduces a "typedef const struct elf_backend_data elf_backend_data;"
and uses it throughout binutils sources, with a few exceptions for c++
use of header files.

3 months agoCompact elf_backend_data
Alan Modra [Sat, 3 Jan 2026 03:13:50 +0000 (13:43 +1030)] 
Compact elf_backend_data

* elf-bfd.h (struct elf_backend_data): Make arch, elf_osabi,
elf_machine_code and target_os bitfields, and reorder.  Make
maxpagesize, minpagesize, commonpagesize and p_align unsigned
int.
* elfxx-target.h (elfNN_bed): Reorder to suit.  Delete useless
comments.

3 months agoelf_backend_can_make_multiple_eh_frame
Alan Modra [Sat, 3 Jan 2026 03:13:25 +0000 (13:43 +1030)] 
elf_backend_can_make_multiple_eh_frame

This flag is never set for any target.  Delete it.  Also, I think it
is safe to unconditionally enable what it was supposed to control.

* elf-bfd.h (struct elf_backend_data): Delete
elf_backend_can_make_multiple_eh_frame.
* elfxx-target.h (elf_backend_can_make_multiple_eh_frame): Don't
define or use.
* elflink.c (_bfd_elf_default_action_discarded): Move
SHT_GNU_SFRAME check earlier.  Return 0 for ".eh_frame"
and ".eh_frame.*".

3 months agowasm ELF_TARGET_ID
Alan Modra [Sat, 3 Jan 2026 03:13:16 +0000 (13:43 +1030)] 
wasm ELF_TARGET_ID

ELF_TARGET_ID is supposed to be an enum elf_target_id.

* elf-bfd.h (enum elf_target_id): Add WEBASSEMBLY_ELF_DATA
and re-order VAX_ELF_DATA.
* elf32-wasm32.c (ELF_TARGET_ID): Use WEBASSEMBLY_ELF_DATA.

3 months agogas style and readability nit
Alan Modra [Sat, 3 Jan 2026 03:12:58 +0000 (13:42 +1030)] 
gas style and readability nit

* config/obj-elf.c (obj_elf_section): Introduce a variable
rather than unreadable line wrapping.

3 months agold/deffilep.y tidies
Alan Modra [Sat, 3 Jan 2026 03:12:30 +0000 (13:42 +1030)] 
ld/deffilep.y tidies

Formatting.  Replace "sizeof (type)" with "sizeof (*varp)" where that
makes sense.  Use xcalloc in place of xmalloc+memset.  Don't special
case xrealloc of NULL pointer, xrealloc handles that fine.

3 months agoAutomatic date update in version.in
GDB Administrator [Sun, 4 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months ago[pre-commit] Change check-gnu-style language to python
Tom de Vries [Sat, 3 Jan 2026 15:15:22 +0000 (16:15 +0100)] 
[pre-commit] Change check-gnu-style language to python

Currently, the language of pre-commit hook check-gnu-style is script.

Change it to python, allowing us to specify termcolor and unidiff as
additional_dependencies.

3 months ago[gdb/testsuite] Fix gdb.base/local-env.exp on remote host
Tom de Vries [Sat, 3 Jan 2026 15:10:41 +0000 (16:10 +0100)] 
[gdb/testsuite] Fix gdb.base/local-env.exp on remote host

With host/target board local-remote-host-native.exp and other remote host
configurations, and test-case gdb.base/local-env.exp I get:
...
(gdb) show environment^M
  ...
(gdb) FAIL: $exp: show environment displayed variable
...

The test attempt to detect variable GDB_TEST_ENV_VAR in the environment, which
has been set with setenv.

This doesn't work with remote host, so declare the test unsupported.  Likewise
in gdb.base/environ.exp.

Tested on x86_64-linux with make-check-all.sh.

3 months ago[gdb/testsuite] Fix gdb.base/gdb11531.exp with m32 PIE
Tom de Vries [Sat, 3 Jan 2026 15:06:29 +0000 (16:06 +0100)] 
[gdb/testsuite] Fix gdb.base/gdb11531.exp with m32 PIE

With test-case gdb.base/gdb11531.exp and target board unix/-m32/-fPIE/-pie I get:
...
(gdb) next^M
34        myrec.x = 5;^M
(gdb) FAIL: gdb.base/gdb11531.exp: watchpoint variable triggers at next
...

For contrast, with target board unix/-m32 I get instead:
...
(gdb) next^M
^M
Hardware watchpoint 2: myrec.x^M
^M
Old value = 0^M
New value = 5^M
main () at /data/vries/gdb/src/gdb/testsuite/gdb.base/gdb11531.c:35^M
35        myrec.y = 3.4;^M
(gdb) PASS: gdb.base/gdb11531.exp: watchpoint variable triggers at next
...

The problem is that the runto_main doesn't set a breakpoint on the same line
in both cases.

Fix this by using runto "$srcfile:34".

[ The underlying problem here is the failure of prologue analysis to deal with
get_pc_thunk.  But since there's a PR [1] open about this, and the problem is
unrelated to the test-case, we work around it. ]

Tested on x86_64-linux.

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=29043

3 months ago[pre-commit] Move codespell-log back to commit-msg stage
Tom de Vries [Sat, 3 Jan 2026 15:04:41 +0000 (16:04 +0100)] 
[pre-commit] Move codespell-log back to commit-msg stage

Commit 7acd390ffd9 ("[pre-commit] Move codespell-log to post-commit") moved
the codespell-log hook from the commit-msg to the post-commit stage.

This was deemed to make git rebase too slow [1], so move it back to the
commit-msg stage.  Don't do this using a full revert, to keep unrelated
improvements from that commit.

Since we use codespell-log to produce warnings rather than errors, running the
hook at the commit-msg stage requires us to ignore codespell exit status, and
set verbose=true.

[1] https://sourceware.org/pipermail/gdb-patches/2025-December/223533.html

3 months ago[gdb/testsuite] Fix another timeout in gdb.mi/mi-multi-commands.exp
Tom de Vries [Sat, 3 Jan 2026 15:01:25 +0000 (16:01 +0100)] 
[gdb/testsuite] Fix another timeout in gdb.mi/mi-multi-commands.exp

On aarch64-linux, with a gdb version 16.3 based package, I ran into (edited
for readability):
...
(gdb)
<LOTS-OF-SPACES>-data-evaluate-expression $a
^done,value="\"FIRST COMMAND\""
(gdb) -data-evaluate-expression $b

^done,value="\"TEST COMPLETE\""
(gdb)
PASS: $exp: look for first command output, command length $n
FAIL: $exp: look for second command output, command length $n (timeout)
...

For contrast, a passing example looks like:
...
(gdb)
<LOTS-OF-SPACES>-data-evaluate-expression $a
-data-evaluate-expression $b
^done,value="\"FIRST COMMAND\""
(gdb)
PASS: $exp: look for first command output, command length $n
^done,value="\"TEST COMPLETE\""
(gdb)
PASS: $exp: look for second command output, command length $n
...

The setup is that the test-case issues these two commands at once:
...
-data-evaluate-expression $a
-data-evaluate-expression $b
...
where the length of the first command is artificially increased by prefixing
it with spaces, shown as <LOTS-OF-SPACES> above.

What happens is that gdb, after parsing the first command, executes it, which
generates output and a prompt.  Then that prompt intermixes with the echoing
of the second command, and consequently the matching of the prompt fails.

This is very similar to what was fixed in commit 59c9bc5fb6c ("[gdb/testsuite]
Fix timeout in gdb.mi/mi-multi-commands.exp").

Fix this by making the matching of the first prompt optional.

While we're at it, make the test-case more readable using {}, string_to_regexp
and multi_line_input.

PR testsuite/33671
Bug https://sourceware.org/bugzilla/show_bug.cgi?id=33671

3 months agoAutomatic date update in version.in
GDB Administrator [Sat, 3 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months agoAutomatic date update in version.in
GDB Administrator [Fri, 2 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months agoSolaris .strtab and .shstrtab flags
Alan Modra [Thu, 1 Jan 2026 21:52:02 +0000 (08:22 +1030)] 
Solaris .strtab and .shstrtab flags

These sections have SHF_STRINGS in sh_flags on Solaris.  Commit
84865015459b in part implemented this variation by an elf_backend_data
field used to set the flags, but that only works of course if one of
the solaris targets is used.  Which in some ways is fair enough.  If
you want solaris support then it is reasonable to require the solaris
targets to be compiled in.  However if they are not the default, other
ELF targets may be used even when the solaris targets are compiled in,
because many ELF targets allow any ELFOSABI object to match.  (Which
is arguably a bug.)

So instead of the current scheme this patch implements the solaris
specific sh_flags in _bfd_elf_final_write_processing.  That way either
a solaris target being used, or ELFOSABI_SOLARIS in the object will
get the correct sh_flags.

PR 19938
* elf-bfd.h (struct elf_backend_data): Delete elf_strtab_flags.
* elf.c (_bfd_elf_final_write_processing): Handle solaris
peculiarities here.
(_bfd_elf_compute_section_file_positions): Leave shstrtab sh_flags
zero, and don't re-zero other fields.
(swap_out_syms): Similarly for sym strtab.
* elflink.c (_bfd_elf_final_link): Likewise.
* elf32-i386.c (elf_backend_strtab_flags): Don't define.
* elf32-sparc.c: Likewise.
* elf64-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.
* elfxx-target.h: Likewise.

3 months agogas .xstabs missing string results in a segfault
Alan Modra [Thu, 1 Jan 2026 21:51:31 +0000 (08:21 +1030)] 
gas .xstabs missing string results in a segfault

Found by oss-fuzz.

* stabs.c (s_xstab): Check result of demand_copy_C_string.
(s_stab_generic): Remove duplicate warning and ignore_r_o_l
after demand_copy_C_string error.

3 months agold config targ_extra_emuls and targ_extra_libpath
Alan Modra [Thu, 1 Jan 2026 21:51:16 +0000 (08:21 +1030)] 
ld config targ_extra_emuls and targ_extra_libpath

There is no need to duplicate targets in these variables, one or the
other is sufficient.  This patch removes such duplication but
otherwise makes no user visible changes.  Quite likely some targets
ought to be in targ_extra_emuls rather than targ_extra_libpath.

* configure.tgt: Don't duplicate targ_extra_libpath targets
in targ_extra_emuls, and similarly for targ64 variants.

3 months agoUpdate year range in copyright notice of binutils files
Alan Modra [Thu, 1 Jan 2026 12:25:19 +0000 (22:55 +1030)] 
Update year range in copyright notice of binutils files

Avoid warnings about invalid escapes in etc/update-copyright.py by
using raw strings, add BinutilsFilter to skip psql.rc and add
"Kalray SA." as another copyright holder.

3 months agoAutomatic date update in version.in
GDB Administrator [Thu, 1 Jan 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

3 months agoarm, as: Support case incensitive VLDR/VSTR SYSREG
Andre Vieira [Wed, 31 Dec 2025 16:14:29 +0000 (16:14 +0000)] 
arm, as: Support case incensitive VLDR/VSTR SYSREG

To be consistent with VMRS/VMSR this changes VLDR/VSTR SYSREG to support case
insensitive system register operands.

4 months agoAutomatic date update in version.in
GDB Administrator [Wed, 31 Dec 2025 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 months agoAutomatic date update in version.in
GDB Administrator [Tue, 30 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 months agoaarch64: Remove sme2_movaz instruction class
Alice Carlotti [Sat, 27 Dec 2025 21:14:25 +0000 (21:14 +0000)] 
aarch64: Remove sme2_movaz instruction class

The behaviour of sme2_movaz was identical to sme_misc, so use that
instead.

4 months agoaarch64: Remove a space from movaz za operand
Alice Carlotti [Sat, 27 Dec 2025 18:26:26 +0000 (18:26 +0000)] 
aarch64: Remove a space from movaz za operand

The za operands of most movaz instructions were originally printed with
an extra space compared to other za operands.  Remove this space, and
reduce code duplication in the process.

4 months agoaarch64: Accept .b/.h/.s in movaz (array to vector)
Alice Carlotti [Sat, 27 Dec 2025 20:46:25 +0000 (20:46 +0000)] 
aarch64: Accept .b/.h/.s in movaz (array to vector)

While the .d form is preferred for disassembly, assemblers should accept
any element size that is used consistently.  The sme2_mov class handles
this already for mov instructions, so use that here as well.

4 months agoaarch64: Fix luti2/luti4 decode mask
Alice Carlotti [Sat, 27 Dec 2025 14:43:40 +0000 (14:43 +0000)] 
aarch64: Fix luti2/luti4 decode mask

Neither the opcode mask nor the size determination were checking bit 13,
so some undefined opcodes were being incorrectly disassembled as valid
luti2/luti4 instructions.

4 months agobfd: Re-enable 64-bit support for 32-bit Solaris targets
Rainer Orth [Mon, 29 Dec 2025 10:16:04 +0000 (11:16 +0100)] 
bfd: Re-enable 64-bit support for 32-bit Solaris targets

One of the recent Solaris patches removed want64=true from the 32-bit
Solaris targets.  This breaks GCC bootstrap: unlike Linux, GCC on
Solaris is always biarch, both in 32-bit-default and 64-bit-default
configurations, so the 64-bit multilib fails to build.

This patch undoes this incompatible change.

Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11.

2025-12-24  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

bfd:
* config.bfd <i[3-7]86-*-solaris2*> (want64): Add.
<sparc-*-solaris2*>: Likewise.

4 months agoAutomatic date update in version.in
GDB Administrator [Mon, 29 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 months agoAutomatic date update in version.in
GDB Administrator [Sun, 28 Dec 2025 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 months agoAArch64 v9.7 extensions: FEAT_SVE_B16MM
Sivan Shani [Wed, 17 Dec 2025 18:10:35 +0000 (18:10 +0000)] 
AArch64 v9.7 extensions: FEAT_SVE_B16MM

This patch includes:
  - Feature flag for FEAT_SVE_B16MM
  - Instruction:
      - BFMMLA (non-widening) BFloat16 matrix multiply-accumulate.

4 months agoAArch64 v9.7 extensions: FEAT_F16MM
Sivan Shani [Wed, 17 Dec 2025 17:22:55 +0000 (17:22 +0000)] 
AArch64 v9.7 extensions: FEAT_F16MM

This patch includes:
  - Feature flag for FEAT_F16MM
  - Instructions:
- FMMLA (non-widening) Half-precision matrix multiply-accumulate
- FMMLA (non-widening) Floating-point matrix multiply-accumulate

4 months agoAArch64: Add FEAT_F16F32MM
Sivan Shani [Wed, 17 Dec 2025 16:58:52 +0000 (16:58 +0000)] 
AArch64: Add FEAT_F16F32MM

This patch includes:
    - The feature flag for the FEAT_F16F32MM feature.
    - Instruction FMMLA Half-precision matrix multiply-accumulate to single-precision.

4 months agoAArch64: Add FEAT_F16F32DOT instructions
Sivan Shani [Wed, 17 Dec 2025 16:36:54 +0000 (16:36 +0000)] 
AArch64: Add FEAT_F16F32DOT instructions

This includes the instructions for the F16F32DOT feature:
    - FDOT half-precision to single-precision, by element
    - FDOT half-precision to single-precision, vector

4 months agoAArch64: Add FEAT_SVE2p3 and FEAT_SME2p3 instructions.
Sivan Shani [Wed, 17 Dec 2025 12:31:04 +0000 (12:31 +0000)] 
AArch64: Add FEAT_SVE2p3 and FEAT_SME2p3 instructions.

This patch includes:

    - Flags for the FEAT_SVE2p3 and FEAT_SME2p3 features.
    - Instructions:
      - ADDQP
      - ADDSUBP
      - FCVTZSN
      - FCVTZUN
      - LUTI6 16-bit
      - LUTI6 8-bit
      - SABAL
      - SCVTF
      - SCVTFLT
      - SDOT vectors
      - SDOT indexed
      - SQRSHRN
      - SQRSHRUN
      - SQSHRN
      - SQSHRUN
      - SUBP
      - UABAL
      - UCVTF
      - UCVTFLT
      - UDOT vectors
      - UDOT indexed
      - UQRSHRN
      - UQSHRN
      - LUTI6 vector
      - LUTI6 table, four registers
      - LUTI6 table, single, 8-bit

    In addition, new operands:
      - OPND_SME_Zmx2_INDEX_22: an operand represents a list of vector registers with an index.
      - OPND_SME_Zn7xN_UNTYPED: an operand represents an untyped list of vector registers.

4 months agoaarch64: Add tests for FEAT_MOPS_GO instructions
Yury Khrustalev [Thu, 18 Dec 2025 13:43:52 +0000 (13:43 +0000)] 
aarch64: Add tests for FEAT_MOPS_GO instructions

4 months agoaarch64: Add FEAT_MOPS_GO instructions
Yury Khrustalev [Thu, 18 Dec 2025 13:43:51 +0000 (13:43 +0000)] 
aarch64: Add FEAT_MOPS_GO instructions

Also add +mops-go feature flag and make the mops-go feature
depend on the memtag and mops features.

4 months agoAutomatic date update in version.in
GDB Administrator [Sat, 27 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 months agoRe: bfd ASSOCIATED_VECS
Alan Modra [Fri, 26 Dec 2025 00:26:15 +0000 (10:56 +1030)] 
Re: bfd ASSOCIATED_VECS

What I committed in f4e835a40c wasn't wrong but it wasn't elegant.
Unlike looking for a word separated by spaces, it isn't necessary
to prepend and append the separators in the match string.

* configure.ac (assocvecs): Tidy uniquify code.
* configure: Regenerate.

4 months agoPR 33726, symbols in excluded sections
Alan Modra [Thu, 25 Dec 2025 11:47:10 +0000 (22:17 +1030)] 
PR 33726, symbols in excluded sections

This improves "nearby" section choice when memory regions are active,
preferring a section in the same region as the excluded section over
other sections.

PR 33726
include/
* bfdlink.h (struct bfd_link_callbacks): Add nearby_section.
(_bfd_nearby_section): Delete.
(bfd_fix_excluded_sec_syms): Rename and remove bfd param from
_bfd_fix_excluded_sec_syms.
bfd/
* linker.c (_bfd_nearby_section): Delete.
(fix_syms): Use linker callback.
* elflink.c (elf_link_input_bfd): Likewise.
(_bfd_elf_final_link): Update.
ld/
* ldemul.c (finish_default): Update.
* ldlang.c (lang_output_section_get): Delete.
(ldlang_nearby_section): New function.
* ldlang.h (ldlang_nearby_section): Declare.
(lang_output_section_get): New static inline.
* ldmain.c (link_callbacks): Add ldlang_nearby_section.

4 months agoAutomatic date update in version.in
GDB Administrator [Fri, 26 Dec 2025 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 months agoRevert "gdb: change blockvector::contains() to handle blockvectors with "holes""
Jan Vrany [Thu, 25 Dec 2025 18:12:06 +0000 (18:12 +0000)] 
Revert "gdb: change blockvector::contains() to handle blockvectors with "holes""

This reverts commit cc1fc6af4150b19f9c4c70d0463ff498703fb637, since it
causes a number of regressions that seem not to be easily fixable.

The problem lies in existence of "freestanding" code, a code that is
part of a CU but does not have any block associated with it. Consider
following program:

    __asm__(
      ".type foo,@function   \n"
      "foo:                  \n"
      "  mov %rdi, %rax      \n"
      "  ret                 \n"
    );

    static int foo(int i);

    int main(int argc, char **argv) {
      return foo(argc);
    }

When compiled, the foo function has no block of itself:

    Blockvector:

    no map

    block #000, object at 0x55978957b510, 1 symbols in 0x1129..0x1148
     int main(int, char **); block object 0x55978957b380, 0x112d..0x1148 section .text
      block #001, object at 0x55978957b470 under 0x55978957b510, 2 symbols in 0x1129..0x1148
       typedef int int;
       typedef char char;
        block #002, object at 0x55978957b380 under 0x55978957b470, 2 symbols in 0x112d..0x1148, function main
         int argc; computed at runtime
         char **argv; computed at runtime

In this case lookup(0x1129) returns static block and, because of the
change in cc1fc6af4, contains(0x1129) which is wrong.

Such "freestanding" code is perhaps not common but it does exist,
especially in system code. In fact the regressions were at least in part
caused by such "freestanding" code in glibc (libc_sigaction.c).

The whole idea of commit cc1fc6af4 was to handle "holes" in CUs, a case
where one CU spans over multiple disjoint regions, possibly interleaved
with other CUs. Consider somewhat extreme case with two CUs:

    /* hole-1.c */
    int give_me_zero ();

    int
    main ()
    {
      return give_me_zero ();
    }

    /* hole-2.c */
        int __attribute__ ((section (".text_give_me_one"))) __attribute__((noinline))
    baz () { return 42; }

    __asm__(
      ".section  .text_give_me_one,\"ax\",@progbits\n"
      ".type foo,@function         \n"
      "foo:                        \n"
            "  mov %rdi, %rax      \n"
            "  ret                 \n"
            "  nop                 \n"
            "  nop                 \n"
            "  nop                 \n"
    );
    int __attribute__ ((section (".text_give_me_one"))) __attribute__((noinline))
    give_me_one ()
    {
      return 1;
    }

    __asm__(
      ".section  .text_give_me_zero,\"ax\",@progbits\n"
      "bar:                        \n"
            "  jmp give_me_one     \n"
            "  nop                 \n"
            "  nop                 \n"
            "  nop                 \n"
    );
    int __attribute__ ((section (".text_give_me_zero")))
    give_me_zero ()
    {
      extern int bar();
      return give_me_one() - 1;
    }

This when compiled with a carefully crafted linker script to force code
at certain positions, creates following layout:

   0x080000..0x080007   # "freestanding" bar from hole-2.c
   0x080008..0x080016   # give_me_zero() from hole-2.c
   0x080109..0x080114   # main from hole-1.c
   0xf00000..0xf0000b   # baz() from hole-2.c
   0xf0000b..0xf00011   # "freestanding" foo from hole-2.
   0xf0000b..0xf0001c   # gice_me_one() from hole-2.

The block vector for hole-1.c looks:

    Blockvector:

    no map

    block #000, object at 0x555a5d85fb90, 1 symbols in 0x80109..0x80114
     int main(void); block object 0x555a5d85faa0, 0x80109..0x80114 section .text
      block #001, object at 0x555a5d85faf0 under 0x555a5d85fb90, 1 symbols in 0x80109..0x80114
       typedef int int;
        block #002, object at 0x555a5d85faa0 under 0x555a5d85faf0, 0 symbols in 0x80109..0x80114, function main

And for hole-2.c:

    Blockvector:

    map
      0x0 -> 0x0
      0x80008 -> 0x555a5d85ff50
      0x80016 -> 0x0
      0xf00000 -> 0x555a5d860280
      0xf0000b -> 0x0
      0xf00012 -> 0x555a5d860110
      0xf0001d -> 0x0

    block #000, object at 0x555a5d8603b0, 3 symbols in 0x80008..0xf0001d
     int give_me_zero(void); block object 0x555a5d85ff50, 0x80008..0x80016 section .text
     int give_me_one(void); block object 0x555a5d860110, 0xf00012..0xf0001d section .text
     int baz(void); block object 0x555a5d860280, 0xf00000..0xf0000b section .text
      block #001, object at 0x555a5d8602d0 under 0x555a5d8603b0, 1 symbols in 0x80008..0xf0001d
       typedef int int;
        block #002, object at 0x555a5d85ff50 under 0x555a5d8602d0, 0 symbols in 0x80008..0x80016, function give_me_zero
        block #003, object at 0x555a5d860280 under 0x555a5d8602d0, 0 symbols in 0xf00000..0xf0000b, function baz
        block #004, object at 0x555a5d860110 under 0x555a5d8602d0, 0 symbols in 0xf00012..0xf0001d, function give_me_one

Note that despite the fact "freestanding" bar belongs to hole-2.c, the
corresponding CU's global and static blocks start at 0x80008! Looking
at DWARF for the second program, it looks like that the compiler (GCC 15)
did not record the presence of "freestanding" code:

    <0><71>: Abbrev Number: 1 (DW_TAG_compile_unit)
        <72>   DW_AT_producer    : (indirect string, offset: 0): GNU C23 15.2.0 -mtune=generic -march=x86-64 -g -fasynchronous-unwind-tables
        <76>   DW_AT_language    : 29   (C11)
        <77>   Unknown AT value: 90: 3
        <78>   Unknown AT value: 91: 0x31647
        <7c>   DW_AT_name        : (indirect line string, offset: 0x2d): hole-2.c
        <80>   DW_AT_comp_dir    : (indirect line string, offset: 0): test_programs
        <84>   DW_AT_ranges      : 0xc
        <88>   DW_AT_low_pc      : 0
        <90>   DW_AT_stmt_list   : 0x51

and corresponding part of .debug_aranges:

      Length:                   76
      Version:                  2
      Offset into .debug_info:  0x65
      Pointer Size:             8
      Segment Size:             0

        Address            Length
        0000000000f00000 000000000000000b
        0000000000f00012 000000000000000b
        0000000000080008 000000000000000e
        0000000000000000 0000000000000000

Thiago suggested to use minsymbols to tell whether or a CU contains
given address. I do not think this would work reliably as minsymbols do
no know to which CU they belong. In slightly more complicated case of
interleaved CUs it does not seem to be possible to tell for sure to which
one a given minsymbol belongs.

Moreover, Tom suggested that the comment in find_compunit_symtab_for_pc_sect
(which led to cc1fc6af4) may be outdated [2].

Given all that, I'm just reverting the change.

[1]: https://sourceware.org/bugzilla/show_bug.cgi?id=33679#c13
[2]: https://inbox.sourceware.org/gdb-patches/87cy6xzd3j.fsf@tromey.com/

Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33679

4 months agoAutomatic date update in version.in
GDB Administrator [Thu, 25 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 months agogas: sframe: reset fp_reg to SFRAME_FRE_REG_INVALID
Indu Bhagat [Wed, 24 Dec 2025 09:06:28 +0000 (01:06 -0800)] 
gas: sframe: reset fp_reg to SFRAME_FRE_REG_INVALID

It makes sense to keep all internal state related to registers
(cfa_base_reg, fp_reg) reset to SFRAME_FRE_REG_INVALID.

While at it, also make sure fp_reg state is copied over when intializing
an SFrame FRE.

gas/
* gen-sframe.c (sframe_row_entry_new): Reset to
SFRAME_FRE_REG_INVALID.
(sframe_row_entry_initialize): Copy over fp_reg too.
(sframe_xlate_do_offset): Adjust accordingly.

4 months agogas: sframe: rename "bp" to "fp"
Indu Bhagat [Wed, 24 Dec 2025 09:05:45 +0000 (01:05 -0800)] 
gas: sframe: rename "bp" to "fp"

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
4 months agolibsframe: refactor out sframe_fre_grow_tbl
Indu Bhagat [Wed, 24 Dec 2025 08:59:07 +0000 (00:59 -0800)] 
libsframe: refactor out sframe_fre_grow_tbl

Usage of a global int number_of_entries is likely unnecessary.  The same
global is used for growing the FDE tbl too, when adding FDEs.  At the
moment, however, carve out a new function to grow the FRE table, and
use a macro instead of 'number_of_entries'.

This refactoring helps provide basis for a later patch where we add
SFrame FREs in bulk instead of one at a time to the SFrame encoder
object.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
libsframe/
* sframe.c (SFRAME_FRE_ALLOC_LEN): New definition.
(sframe_grow_fre_tbl): New definition.
(sframe_encoder_add_fre): Use the new function.

4 months agolibsframe: use tmp variable for realloc pattern
Indu Bhagat [Wed, 24 Dec 2025 08:57:55 +0000 (00:57 -0800)] 
libsframe: use tmp variable for realloc pattern

If realloc fails, the original buffer isnt free'd otherwise.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
libsframe/
* sframe.c (sframe_encoder_add_fre): Use tmp variable.
(sframe_encoder_add_funcdesc_internal): Likewise.

4 months agolibsframe: refactor sframe_decoder_add_funcdesc for internal use
Indu Bhagat [Wed, 24 Dec 2025 08:51:43 +0000 (00:51 -0800)] 
libsframe: refactor sframe_decoder_add_funcdesc for internal use

sframe_encoder_add_funcdesc () was added for SFRAME_VERSION_1.  This has
since been obsoleted by introduction of SFRAME_VERSION_2 and its
corresponding sframe_decoder_add_funcdesc_v2 API.

Refactor the functionality into an internal-only API:
sframe_encoder_add_funcdesc_internal (). Ensure it returns the error
code for the caller to take necessary action or pass to user.

Keep only two args for sframe_encoder_add_funcdesc: function size and
function start addr.  This simple barebone API will be used in a
subsequent commit to adjust the link-time behaviour of SFrame sections.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
include/
* sframe-api.h (sframe_encoder_add_funcdesc): Remove args to
create the barebone API.
libsframe/
* sframe.c (sframe_encoder_add_funcdesc): Refactor out into
sframe_encoder_add_funcdesc_internal.  Change args.
(sframe_encoder_add_funcdesc_v2): Use the new internal API.
* libsframe.ver: Move sframe_encoder_add_funcdesc to 2.1 node.

4 months agogas: sframe: refactor out the offsets emission code
Indu Bhagat [Wed, 24 Dec 2025 08:44:37 +0000 (00:44 -0800)] 
gas: sframe: refactor out the offsets emission code

Minor refactoring.  Carve out the SFrame FRE offsets emission code into
a new output_sframe_row_entry_offsets ().  This change helps prepare for
later supporting a new FDE type in SFrame V3.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
gas/
* gen-sframe.c (output_sframe_row_entry_offsets): New
definition.
(output_sframe_row_entry): Use the new definition.

4 months agogas: sframe: pass SFrame FDE as argument to output_sframe_row_entry
Indu Bhagat [Wed, 24 Dec 2025 08:43:30 +0000 (00:43 -0800)] 
gas: sframe: pass SFrame FDE as argument to output_sframe_row_entry

Minor refactoring.  Will be needed later for supporting flexible topmost
frames in SFrame V3.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
gas/
* gen-sframe.c (output_sframe_row_entry): Use new argument.
(output_sframe_internal): Likewise.

4 months agogas: sframe: add new sframe_xlate_ctx_get_cur_cfa_reg
Indu Bhagat [Wed, 24 Dec 2025 08:43:04 +0000 (00:43 -0800)] 
gas: sframe: add new sframe_xlate_ctx_get_cur_cfa_reg

Purely cosmetic change.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
gas/
* gen-sframe.c (sframe_xlate_ctx_get_cur_cfa_reg): New
definition.
(sframe_xlate_do_def_cfa_offset): Use it.
(sframe_xlate_do_escape_expr): Likewise.
(sframe_xlate_do_escape_gnu_args_size): Likewise.

4 months agogas: libsframe: use SFRAME_V2_* macro where available
Indu Bhagat [Wed, 24 Dec 2025 08:42:14 +0000 (00:42 -0800)] 
gas: libsframe: use SFRAME_V2_* macro where available

No functional change.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
gas/
* sframe-opt.c (sframe_convert_frag): Use SFRAME_V2_
prefixed macro instead.
libsframe/
* sframe-dump.c (dump_sframe_func_with_fres): Likewise.
* sframe.c (sframe_get_fre_type): Likewise.
(sframe_get_fde_type): Likewise.
(sframe_fre_check_range_p): Likewise.
(sframe_fde_create_func_info): Likewise.

4 months agoinclude: sframe: add SFRAME_V2_ prefixed macro names for FDE
Indu Bhagat [Wed, 24 Dec 2025 08:41:18 +0000 (00:41 -0800)] 
include: sframe: add SFRAME_V2_ prefixed macro names for FDE

Such a change for readability only.  SFrame V1 is now obsolete, and with
newer versions like V3 or later, its likely better to have macro names
reflect the applicable version.

Add new macro names for FDE information related macros.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
include/
* sframe.h (SFRAME_V2_FUNC_INFO): New definition.
(SFRAME_V2_FUNC_FRE_TYPE): Likewise.
(SFRAME_V2_FUNC_PC_TYPE): Likewise.
(SFRAME_V2_FUNC_PAUTH_KEY): Likewise.
(SFRAME_V2_FUNC_INFO_UPDATE_PAUTH_KEY): Likewise.

4 months agolibsframe: implement an internal-only SFrame FDE representation
Indu Bhagat [Wed, 24 Dec 2025 08:41:02 +0000 (00:41 -0800)] 
libsframe: implement an internal-only SFrame FDE representation

Up until now, libsframe has used the same SFrame FDE representation as
the on-disk representation (sframe_func_desc_entry).  The choice made by
the author of the library, back when it was first contributed, perhaps
sufficed the needs then.  But looking forward, we need to be able to
allow reading and dumping out of not just sections with version
SFRAME_VERSION_2 but also future supported versions.

Note that libsframe did not (and still does not) expose the SFrame FDE
representation in any public APIs;  doing so is not recommended.

For the path forward, create an internal-only SFrame FDE representation
(sframe_func_desc_entry_int).  libsframe now keeps all in-memory FDEs of
type sframe_func_desc_entry_int.  Doing so means instead of memcpy, we
need to resort to member-by-member mapping.  This can be seen in
sframe_fde_tbl_init (read time) and the new function
sframe_encoder_write_fde (write time).

Other than that, replace out the previous direct interaction with
on-disk format when:
  - flipping SFrame contents before decoding them in sframe_decode.
  - flipping SFrame contents before writing them out in sframe_encode.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
4 months agoAutomatic date update in version.in
GDB Administrator [Wed, 24 Dec 2025 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 months agoinclude: gas: bfd: sframe: clean the abstraction
Indu Bhagat [Tue, 23 Dec 2025 22:59:59 +0000 (14:59 -0800)] 
include: gas: bfd: sframe: clean the abstraction

... between specification and implmentation.

Move to definition in the implementation (gas/ld/libsframe) and not the
specification (include/sframe.h).  At this time the implementation in
gas and ld generate the sections in the latest SFrame version only.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
bfd/
* elf-sframe.c: Add definition here.
gas/
* gen-sframe.c: Likewise.
libsframe/
* sframe.c: Likewise.
include/
* sframe.h: Remove the definition.

4 months agogas: sframe: ignore .cfi_offset for RA selectively
Indu Bhagat [Tue, 23 Dec 2025 22:59:09 +0000 (14:59 -0800)] 
gas: sframe: ignore .cfi_offset for RA selectively

For ABIs not tracking RA (e.g., AMD64), the return address is expected
to be in a specific location (usually a fixed offset from CFA on stack).
Explicit manourvering to a different offset may be non-representable in
SFrame, and should not be simply ignored.

Although such patterns are not usually seen in the wild, it is more
correct to catch them if at all they manifest.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
gas/
* gen-sframe.c (sframe_xlate_do_offset): Do not ignore
.cfi_offset for RA all the time.

4 months agoRevert "gas: Don't skip SFrame FDE if .cfi_register specifies RA w/o tracking"
Indu Bhagat [Tue, 23 Dec 2025 22:57:58 +0000 (14:57 -0800)] 
Revert "gas: Don't skip SFrame FDE if .cfi_register specifies RA w/o tracking"

This reverts commit df174a6b760.

    commit df174a6b760ac5c66ee62ecb872c760ae21fd4cd
    Date:   Thu Jul 4 10:34:12 2024 +0200

    gas: Don't skip SFrame FDE if .cfi_register specifies RA w/o tracking

    Do not skip SFrame FDE if .cfi_register specifies RA register without
    RA tracking being actually used. Without RA tracking the register
    contents can always be restored from the stack using the fixed
    RA offset from CFA.

Even for ABI/arch without RA tracking, there may be instances where user
may specify '.cfi_register RA, reg'.  This needs to be caught, skipping
this from SFrame generation may not be correct.  This may be done in
certain hand-written asm sequences where the user needs to manipulate
the return to a certain function.

No testcase is being added ATM because in SFrame V3, a new FDE type can
be used to represent such cases (A new test case will be added then).

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
4 months agogas: add as_info() for informational diagnostics
Matthieu Longo [Mon, 22 Dec 2025 15:50:02 +0000 (15:50 +0000)] 
gas: add as_info() for informational diagnostics

This patch adds as_info(), a shortened version of as_info_where(),
for emitting informational diagnostics from Gas.
This new helper provides the same formatting and source location
handling as as_info_where(), while offering a simpler interface
for the common case. It respects the --no-info flag, and supports
indentation in the same way as its sibling.

4 months agogdb: allow 'set args' and run commands to contain newlines
Andrew Burgess [Wed, 15 Nov 2023 16:36:09 +0000 (16:36 +0000)] 
gdb: allow 'set args' and run commands to contain newlines

When starting GDB it is possible to set an inferior argument that
contains a newline, for example:

  shell> gdb --args my.app "abc
  > def"
  ...
  (gdb) show args
  Argument list to give program being debugged when it is started is "abc'
  'def".

However, once GDB is started, the only way to install an argument
containing a newline is to use the Python API.

This commit changes that.

After this commit 'set args' as well as 'run', 'start', and 'starti',
will now accept multi-line inferior arguments, e.g.:

  (gdb) set args "abc
  > def"
  (gdb) show args
  Argument list to give program being debugged when it is started is ""abc
  def"".

And also:

  (gdb) run "abc
  > def"
  ... etc ...

Once GDB has presented the secondary prompt to gather the remaining
inferior arguments then it is possible for the user to quit argument
entry by sending SIGINT (usually, Ctrl-c), or sending EOF (usually,
Ctrl-d).  For the 'set args' case this will abort the argument change,
leaving the arguments as they were previously.  For the run style
commands, this aborts the run command completely, the inferior is not
changed, and the partially collected arguments are not installed.

On Unix hosts, arguments can be wrapped with either single or double
quotes, while on MS-Windows hosts, arguments can only be wrapped with
double quotes.  This gives the expected behaviour when native
debugging, but isn't entirely accurate.  If a user is cross debugging
between Unix and MS-Windows then the host machine will determine which
set of quotes is valid, which will then be incorrect for the actual
target machine.  This should probably be fixed in the future, but
isn't something I plan to fix immediately.  If this patch is accepted,
then I can create a bug to track this issue.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Tested-By: Guinevere Larsen <guinevere@redhat.com>
4 months agoloongarch: add back support for object attributes v1
Matthieu Longo [Mon, 22 Dec 2025 14:25:35 +0000 (14:25 +0000)] 
loongarch: add back support for object attributes v1

A previous commit [1] mistakenly removed support for Object Attributes
for LoongArch targets.

This patch adds back the OA feature into Gas for the LoongArch targets
following the new approach which consists in:
- defining TC_OBJ_ATTR to 1 in tc-loongarch.h
- enabling the compilation of obj-elf-attr.c in gas/configure.ac

[1]: 28a51085ae59fdb530fbdce1e2a7d160667e3007

4 months agoAutomatic date update in version.in
GDB Administrator [Tue, 23 Dec 2025 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in