]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
6 weeks agogdb: remove 'num' field from 'struct address_space'
Tankut Baris Aktemur [Wed, 25 Feb 2026 09:35:47 +0000 (10:35 +0100)] 
gdb: remove 'num' field from 'struct address_space'

The getter method `num ()` in `struct address_space` is never used.
Remove it.  This leads to two more simplifications: (1) the
address_space constructor can be defaulted in the header, (2)
`highest_address_space_num` global counter is no longer needed and can
be removed.

Tested by re-building.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agogas/testsuite: add runtest_file_p filtering to run_list_test and run_elf_list_test
Fangrui Song [Wed, 25 Feb 2026 05:07:15 +0000 (21:07 -0800)] 
gas/testsuite: add runtest_file_p filtering to run_list_test and run_elf_list_test

so that run_list_test and run_elf_list_test honor
RUNTESTFLAGS="elf.exp=PATTERN" like run_dump_test.

6 weeks agoRe: gas: macros nested too deep error
Alan Modra [Tue, 24 Feb 2026 21:22:15 +0000 (07:52 +1030)] 
Re: gas: macros nested too deep error

In commit fc2fcd4f5be3 I changed as as_fatal to as_bad, thinking that
was sufficient.  Revert that change because
  .macro r;r;r;.endm;r
with two recursive invocations in the body results in 2 to the power
max_macro_nest lines of gas output complaining about macro nesting.

* input-scrub.c (input_scrub_include_sb): Revert last change.

6 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 25 Feb 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 weeks agoSort and uniquify Ada standard exceptions
Tom Tromey [Mon, 9 Feb 2026 14:13:33 +0000 (07:13 -0700)] 
Sort and uniquify Ada standard exceptions

With libgnat debuginfo installed, I noticed some test failures.

This patch fixes gdb.ada/info_exc.exp and gdb.ada/mi_exc_info.exp,
both of which had failures caused by not unique-ifying the list of
standard exceptions.

6 weeks agoFix Ada failure with gdb-index
Tom Tromey [Sun, 8 Feb 2026 21:39:50 +0000 (14:39 -0700)] 
Fix Ada failure with gdb-index

The gdb index reader rewrite (commit 486bc5ac) broke a couple of Ada
test cases.  I didn't notice these at the time because they require
libgnat debuginfo to be installed.

This patch fixes the problem.  The issue here is that the Ada code
sometimes requires types to have "linkage name" entries.  This is
required because these lookups are done using the verbatim ("<...>")
notation, which won't match the split names in the index.

Removing the need for this is on my wish-list, see PR ada/32142; but I
have not gotten around to figuring this one out yet.

In the meantime, having the gdb-index reader create synthetic linkage
name entries for types fixes the bug.

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

6 weeks agobfd: fix 2 more -Wdiscarded-qualifiers errors
Simon Marchi [Mon, 23 Feb 2026 13:26:36 +0000 (08:26 -0500)] 
bfd: fix 2 more -Wdiscarded-qualifiers errors

Change-Id: I047cd848506fc4d3dafdb901e300fe22430dddde

6 weeks agogdb/testsuite: fix test build-id-no-debug-warning.exp with -readnow
Jan Vrany [Tue, 24 Feb 2026 15:24:31 +0000 (15:24 +0000)] 
gdb/testsuite: fix test build-id-no-debug-warning.exp with -readnow

Test build-id-no-debug-warning.exp fails when using -readnow. This is
because in that case GDB outputs "Expanding full symbols from..." after
"Reading symbols from ...".

Fix this by updating the test.

Approved-By: Tom Tromey <tom@tromey.com>
6 weeks agogdb/testsuite: fix test crc_mismatch.exp with -readnow
Jan Vrany [Tue, 24 Feb 2026 15:24:31 +0000 (15:24 +0000)] 
gdb/testsuite: fix test crc_mismatch.exp with -readnow

Test crc_mismatch.exp fails when using -readnow. This is because in that
case GDB outputs "Expanding full symbols..." after "Reading symbols from
...".

Fix this by updating the test.

Approved-By: Tom Tromey <tom@tromey.com>
6 weeks ago[gdb/record] Fix return value for svc in aarch64_record_branch_except_sys
Tom de Vries [Tue, 24 Feb 2026 13:35:40 +0000 (14:35 +0100)] 
[gdb/record] Fix return value for svc in aarch64_record_branch_except_sys

The Linaro CI reported the following regression in test-case
gdb.reverse/sigall-reverse.exp on aarch64-linux:
...
(gdb) continue^M
Continuing.^M
The next instruction is syscall exit_group.  It will make the program exit. \
  Do you want to stop the program?([y] or n) yes^M
Process record does not support instruction 0xd4000001 at address $hex.^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
__GI__exit (status=status@entry=0) at ../sysdeps/unix/sysv/linux/_exit.c:30^M
30            INLINE_SYSCALL (exit_group, 1, status);^M
(gdb) FAIL: gdb.reverse/sigall-reverse.exp: continue to signal exit
...
due to commit 0cb5fde010a ("[gdb/testsuite] Fix some incorrect uses of
decimal").

[ Note that 0xd4000001 is "svc #0", the syscall instruction. ]

The test fails because it expects "Process record: inferior program stopped":
...
    gdb_test "continue" "Process record: inferior program stopped.*" \
       "continue to signal exit" \
        "The next instruction is syscall exit_group.* program...y. or n. " \
        "yes"
...
instead of "Process record: failed to record execution log".

The problem is caused by the fact that there are two result value domains:
- one for generic record (res < 0, res == 0, and res > 0) and
- one for aarch64 record (AARCH64_RECORD_SUCCESS = 0, AARCH64_RECORD_UNSUPPORTED = 1
  and AARCH64_RECORD_UNKNOWN = 2, and an unnamed -1).

When returning here from aarch64_record_branch_except_sys:
...
             return tdep->aarch64_syscall_record (aarch64_insn_r->regcache,
                                                  svc_number);
...
we transfer from the generic record domain to the aarch64 record domain, converting:
- a value 1, meaning "Process record: inferior program stopped", into
- a value AARCH64_RECORD_UNSUPPORTED, meaning
  "Process record does not support instruction $hex at address $hex.
   Process record: failed to record execution log.".

[ Then again, the transfer of domains might be in aarch64_linux_syscall_record.
It's kind of hard to say, given that typing is not used to distinguish between
the two domains. ]

Fix this by:
- introducing a conversion function to_aarch64_record_result, and
- using it in aarch64_record_branch_except_sys.

Likewise, add a from_aarch64_record_result and use it in
aarch64_process_record.

Also add some documentation to enum aarch64_record_result, and add the missing
-1 value.

AFAICT, the loongarch port needs the same fix, but I can't test that so I
think it's better to only deal with aarch64 in this patch.

Tested on aarch64-linux.

Approved-By: Luis Machado <luis.machado.foss@gmail.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33913

6 weeks agoreadelf: endless loop on attrv2
Alan Modra [Tue, 24 Feb 2026 11:18:14 +0000 (21:48 +1030)] 
readelf: endless loop on attrv2

Given a short attributes section, elf_parse_attrs_subsection_v2 prints
an error message but does not return an error status or consume any
input.  That results in endless printing of "Object attributes section
ends prematurely".  The length checks also ignored a single excess
byte at the end of the section.

* readelf.c (elf_parse_attrs_subsection_v2): Move various
constants out of function.  Don't check for min length here..
(process_attributes_v2): ..do so here instead.

6 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 24 Feb 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 weeks agogdb/python: remove some unreachable Py_RETURN_NONE
Simon Marchi [Sat, 21 Feb 2026 02:40:54 +0000 (21:40 -0500)] 
gdb/python: remove some unreachable Py_RETURN_NONE

They are unreachable because there is a return statement in all possible code
paths before.

Change-Id: I9db2f41f8017380c0c79f97af9bbf8734038ba9a
Approved-By: Tom Tromey <tom@tromey.com>
6 weeks agoReturn gdbpy_ref<> from gdbpy_registry::lookup
Tom Tromey [Fri, 20 Feb 2026 20:34:45 +0000 (13:34 -0700)] 
Return gdbpy_ref<> from gdbpy_registry::lookup

This changes gdbpy_registry::lookup to return a gdbpy_ref<>, using the
type system to convey that a new reference is always returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from gdbarch_to_arch_object
Tom Tromey [Fri, 20 Feb 2026 20:20:56 +0000 (13:20 -0700)] 
Return gdbpy_ref<> from gdbarch_to_arch_object

This changes gdbarch_to_arch_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from symtab_to_linetable_object
Tom Tromey [Fri, 20 Feb 2026 20:18:57 +0000 (13:18 -0700)] 
Return gdbpy_ref<> from symtab_to_linetable_object

This changes symtab_to_linetable_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from frame_info_to_frame_object
Tom Tromey [Fri, 20 Feb 2026 20:06:56 +0000 (13:06 -0700)] 
Return gdbpy_ref<> from frame_info_to_frame_object

This changes frame_info_to_frame_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from type_to_type_object
Tom Tromey [Fri, 20 Feb 2026 20:05:24 +0000 (13:05 -0700)] 
Return gdbpy_ref<> from type_to_type_object

This changes type_to_type_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from value_to_value_object
Tom Tromey [Fri, 20 Feb 2026 20:02:00 +0000 (13:02 -0700)] 
Return gdbpy_ref<> from value_to_value_object

This changes value_to_value_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from block_to_block_object
Tom Tromey [Fri, 20 Feb 2026 19:50:48 +0000 (12:50 -0700)] 
Return gdbpy_ref<> from block_to_block_object

This changes block_to_block_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from symtab_to_symtab_object
Tom Tromey [Fri, 20 Feb 2026 19:47:51 +0000 (12:47 -0700)] 
Return gdbpy_ref<> from symtab_to_symtab_object

This changes symtab_to_symtab_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from symbol_to_symbol_object
Tom Tromey [Fri, 20 Feb 2026 19:46:46 +0000 (12:46 -0700)] 
Return gdbpy_ref<> from symbol_to_symbol_object

This changes symbol_to_symbol_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoReturn gdbpy_ref<> from symtab_and_line_to_sal_object
Tom Tromey [Fri, 20 Feb 2026 19:38:31 +0000 (12:38 -0700)] 
Return gdbpy_ref<> from symtab_and_line_to_sal_object

This changes symtab_and_line_to_sal_object to return a gdbpy_ref<>,
using the type system to convey that a new reference is always
returned.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
6 weeks agoDon't run pr24576 tests on windows host
Alan Modra [Mon, 23 Feb 2026 10:39:34 +0000 (21:09 +1030)] 
Don't run pr24576 tests on windows host

6 weeks agogdb, testsuite: remove unused parameter from connect_target_extended_remote
Tankut Baris Aktemur [Mon, 23 Feb 2026 10:49:14 +0000 (11:49 +0100)] 
gdb, testsuite: remove unused parameter from connect_target_extended_remote

The `binfile` parameter of `connect_target_extended_remote` is unused.
Remove it.

6 weeks agobinutils: fix a typo in doc
RocketDev [Sun, 22 Feb 2026 20:15:43 +0000 (04:15 +0800)] 
binutils: fix a typo in doc

Add a missing dash to indicate j is a flag

Signed-off-by: RocketDev <marocketbd@gmail.com>
6 weeks agobinutils.texi: break overlong synopsis options lines
Alan Modra [Mon, 23 Feb 2026 01:11:49 +0000 (11:41 +1030)] 
binutils.texi: break overlong synopsis options lines

Also fix typos in objdump options (-wD/-wE should be -WD/-WE),
and move ar man synopsis where it belongs.

6 weeks agoreadelf .debug_aranges header display
Alan Modra [Sun, 22 Feb 2026 04:52:43 +0000 (15:22 +1030)] 
readelf .debug_aranges header display

Print "Address size" rather than "Pointer Size" and "Segment size"
rather than "Segment Size", using the same names and capitalisation
as is used when printing other headers with these fields.

binutils/
* dwarf.c
* testsuite/binutils-all/i386/compressed-1a.d
* testsuite/binutils-all/x86-64/compressed-1a.d
gas/
* testsuite/gas/aarch64/dwarf.d: Update expected output.
* testsuite/gas/i386/dw2-compress-3a.d: Likewise.
* testsuite/gas/i386/dw2-compress-3b.d: Likewise.
* testsuite/gas/i386/dw2-compressed-3a.d: Likewise.
* testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
* testsuite/gas/elf/dwarf-5-irp.d: Likewise.
* testsuite/gas/elf/dwarf2-20.d: Likewise, and match mn10200
output, removing xfail.

6 weeks agobinutils: rename ar_pointer_size
Alan Modra [Mon, 23 Feb 2026 00:57:15 +0000 (11:27 +1030)] 
binutils: rename ar_pointer_size

The field is named "address size" in all versions of the DWARF spec
that have and name the field.  Reflect that by renaming
ar_pointer_size to ar_address_size.

6 weeks agoPR 33914 abort parsing fuzzed .debug_line
Alan Modra [Mon, 23 Feb 2026 00:48:17 +0000 (11:18 +1030)] 
PR 33914 abort parsing fuzzed .debug_line

The abort is due to an unexpected DW_FORM_addrx3 entry in the
testcase, which requires pointer_size to be known.

* dwarf.c (address_size_ok): New function.
(read_debug_line_header): Use address_size_ok.
(display_formatted_table): Pass li_address_size as
pointer_size to read_and_display_attr_value.
(display_debug_lines_decoded): Likewise.
(display_debug_macro, display_debug_names): Similarly pass
offset_size.
(display_loclists_unit_header): Use address_size_ok.
(display_debug_loc, display_debug_addr): Likewise.
(display_debug_aranges): Likewise.  Remove power of two check
on address_size.  Calculate and pad to tuple_size.

6 weeks agoAutomatic date update in version.in
GDB Administrator [Mon, 23 Feb 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 weeks agogdb/testsuite: fix startup-hints.exp when running with -readnow
Jan Vrany [Sun, 22 Feb 2026 08:56:51 +0000 (08:56 +0000)] 
gdb/testsuite: fix startup-hints.exp when running with -readnow

When running startup-hints.exp with readnow board, I get number of
failures like:

    FAIL: gdb.base/startup-hints.exp: with_style=false: load_exec=true: test_for_hint_with_width: check for hint with width 0

The problem is that with -readnow, GDB prints "Expanding full symbols
from ..." after "Reading symbols from ...".

Fix by updating the test.

Approved-By: Tom Tromey <tom@tromey.com>
6 weeks ago[gdb/testsuite] Simplify gdb.ada/mi_ex_cond.exp
Tom de Vries [Sun, 22 Feb 2026 08:36:06 +0000 (09:36 +0100)] 
[gdb/testsuite] Simplify gdb.ada/mi_ex_cond.exp

Simplify gdb.ada/mi_ex_cond.exp using the usual tools: subst_vars, quotemeta,
{}.

Also simplify variable syntax: "${::foo}" -> $foo.

The one case where I used subst_vars was where quotemeta forced me to write
out the @DECIMAL expression inside @/.../.  I've filed a PR about this [2].

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=33900

6 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 22 Feb 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 weeks ago[gdb/testsuite] Fix gdb.base/infcall-nested-structs.c regression
Tom de Vries [Sat, 21 Feb 2026 21:38:30 +0000 (22:38 +0100)] 
[gdb/testsuite] Fix gdb.base/infcall-nested-structs.c regression

Since commit 120072c7cdc ("gdb/testsuite: update C++ tests for volatile
changes in C++20") I see regressions in two test-cases:
...
$ ./sum.sh
   4300 gdb.base/infcall-nested-structs-c++.exp:
   2500 gdb.base/infcall-nested-structs-c.exp:
...

In more detail, in test-case gdb.base/infcall-nested-structs-c++.exp:
...
(gdb) tbreak 421^M
No compiled code for line 421 in the current file.^M
Make breakpoint pending on future shared library load? (y or [n]) n^M
(gdb) FAIL: $exp: types-tc: gdb_breakpoint: set breakpoint at 421
...

Fix this by reverting the change done by the commit, and applying the same fix
as the commit applied elsewhere:
...
-  v++;
+  v = v + 1;
...

Tested on x86_64-linux, with target boards unix and unix/-std=c++20.

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

6 weeks agogcore: Query auxv for AT_PAGESZ in gcore_copy_callback
Kevin Buettner [Wed, 18 Feb 2026 01:09:08 +0000 (18:09 -0700)] 
gcore: Query auxv for AT_PAGESZ in gcore_copy_callback

This is a followup patch to commit c1da013915e, titled "gcore:  Handle
unreadable pages within readable memory regions".

In his review of that earlier patch, Tom de Vries recommended using
target_auxv_search with AT_PAGESZ to find the page size if it's
available; this patch implements that suggestion.  As before, a 4k
fallback size is used should the search for an AT_PAGESZ value not
succeed.

Approved-By: Tom de Vries <tdevries@suse.de>
6 weeks agoDocument that index-cache requires build ID
Lluís Batlle i Rossell [Sun, 6 Apr 2025 11:11:06 +0000 (13:11 +0200)] 
Document that index-cache requires build ID

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
7 weeks agoPR 33917 Internal error in S_SET_SEGMENT
Alan Modra [Sat, 21 Feb 2026 00:26:57 +0000 (10:56 +1030)] 
PR 33917 Internal error in S_SET_SEGMENT

Commit d4d05d13eba6 attempted to fix a similar error to that uncovered
by the testcase in pr33917, but did so in a way that was wrong.
Modifying an undefined_section symbol that is an equate breaks prior
use of that symbol, as shown in the rewrite of the
section-symbol-redef test.

Another oddity found when poking at pr33917 is that gas allows
 x=0
 .sect x
 x=u
while
 .sect x
 x=u
fails with "Error: symbol `x' is already defined".

Fix all of this by rewriting section_symbol to properly check for the
only case where we want to redefine an existing symbol, a truly
undefined symbol, and always use section_symbol in obj-elf rather than
trying to handle undefined symbols there too.

PR 33917
* config/obj-elf.c (change_section): Always call section_symbol
to set up sym.
* subsegs.c (section_symbol): Rewrite.
* testsuite/gas/elf/section-symbol-redef.d
* testsuite/gas/elf/section-symbol-redef.s: Rewrite.
* testsuite/gas/elf/section-symbol-redef-2.d,
* testsuite/gas/elf/section-symbol-redef-2.s: New test.
* testsuite/gas/elf/elf.exp: Run new test.

7 weeks agoMake Solaris global ABI syms STT_OBJECT and STV_PROTECTED
Alan Modra [Sat, 21 Feb 2026 00:26:49 +0000 (10:56 +1030)] 
Make Solaris global ABI syms STT_OBJECT and STV_PROTECTED

PR 33177
* emultempl/solaris2.em (elf_solaris_before_allocation): Make
globals defined here STV_PROTECTED and STT_OBJECT.  Use
elf_backend_hide_symbol rather that just setting forced_local
for local ABI syms.

7 weeks agoPR 12320 ld --as-needed links libgcc_s.so.1 unnecessarily on Solaris
Alan Modra [Sat, 21 Feb 2026 00:26:43 +0000 (10:56 +1030)] 
PR 12320 ld --as-needed links libgcc_s.so.1 unnecessarily on Solaris

The Solaris 2 ABI requires some global symbols to be present as
dynamic symbols.  These unfortunately interact with ld --as-needed.
See the comment above elf-solaris.c:elf_solaris2_add_symbol_hook,
a new function added by this patch to ignore those symbol in shared
libraries.

PR 12320
PR 33177
bfd/
* elf-solaris2.c: New file.
* elf-solaris2.h: New file.
* elf32-i386.c (elf_backend_add_symbol_hook): Define for Solaris.
* elf32-sparc.c (elf_backend_add_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_solaris2_add_symbol_hook): New.
(elf_backend_add_symbol_hook): Define for Solaris.
* elf64-x86-64.c (elf_x86_64_solaris2_add_symbol_hook): New.
(elf_backend_add_symbol_hook): Define for Solaris.
* Makefile.am (BFD32_BACKENDS): Add elf-solaris2.lo.
(BFD32_BACKENDS_CFILES): Add elf-solaris2.c.
* configure.ac (elfxx_x86): Add elf-solaris2.lo.
(elfxx_sparc): Define and use in all sparc_elf*_vec.
* po/SRC-POTFILES.in: Regenerate.
* Makefile.in: Regenerate.
* configure: Regenerate.
ld/
* emultempl/solaris2.em (elf_solaris2_after_open): New function.
(LDEMUL_AFTER_OPEN): Define.
(elf_solaris_before_allocation): Delete global_syms, instead
use elf_solaris2_global_syms.  Ignore globals that are still
bfd_link_hash_new, ie. have not been defined by a script.

7 weeks agoSolaris emulation check
Alan Modra [Sat, 21 Feb 2026 00:26:33 +0000 (10:56 +1030)] 
Solaris emulation check

elf_solaris2_before_allocation can be called when ld output is non-ELF,
but also when ld output is ELF but not Solaris.  Split out from the
pr12320 fix due to the indentation change.

PR 12320
PR 33177
* emultempl/solaris2.em (elf_solaris_before_allocation): Wrap
everything done here in a more rigorous output hash table check.

7 weeks agoAutomatic date update in version.in
GDB Administrator [Sat, 21 Feb 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 weeks agogdb/testsuite: fix race condition in gdb.replay/missing-thread.c
Simon Marchi [Fri, 6 Feb 2026 17:57:56 +0000 (12:57 -0500)] 
gdb/testsuite: fix race condition in gdb.replay/missing-thread.c

I get frequent failures in gdb.replay/missing-thread.exp, starting with:

    FAIL: gdb.replay/missing-thread.exp: non_stop=on: record_initial_logfile: continue (timeout)

I tracked this down to a race condition in the test program, causing it
not to generate the expected SIGTRAP.  This can be reproduced by adding
a sleep(1) just after the pthread_create.

The expected behavior is:

 - The main thread starts a second thread
 - The main thread blocks on pthread_cond_wait, waiting to be notified
   by the second thread (to make sure the second thread had time to
   start)
 - The second thread notifies the main thread using pthread_cond_signal
 - The main thread sends a SIGTRAP to the second thread

However, this can happen:

 - The main thread starts a second thread
 - The second thread calls pthread_cond_signal, while no one is waiting
   to the condvar
 - The main thread blocks on pthread_cond_wait forever

Fix it by introducing a separate boolean predicate protected by the
shared mutex, and looping until it is true.  This is the way
pthread_cond_wait is meant to be used. From pthread_cond_wait(3):

    When using condition variables there is always a boolean predicate
    involving shared variables associated with each condition wait that
    is true if the thread should proceed. Spurious wakeups from the
    pthread_cond_wait() or pthread_cond_timedwait() functions may occur.
    Since the return from pthread_cond_wait() or
    pthread_cond_timedwait() does not imply anything about the value of
    this predicate, the predicate should be re-evaluated upon such
    return.

Finally, make things static, just out of principle, and fix minor
formatting issues.

Change-Id: I62ba2085a2d506dc3d91e32cd5de48c43a3ff55e
Approved-By: Tom Tromey <tom@tromey.com>
7 weeks agogdb/dwarf: remove stale comment on dwarf2_per_bfd::allocate_* methods
Simon Marchi [Fri, 20 Feb 2026 15:40:16 +0000 (10:40 -0500)] 
gdb/dwarf: remove stale comment on dwarf2_per_bfd::allocate_* methods

Those objects are no longer allocated on an obstack.

Change-Id: Ib83b5bb25cf13ec1bc071e7c5e8b099687d6bba2

7 weeks agogdb/dwarf: remove stale comment about abbrev table
Simon Marchi [Fri, 20 Feb 2026 18:01:51 +0000 (13:01 -0500)] 
gdb/dwarf: remove stale comment about abbrev table

This parameter no longer exist.

Change-Id: I6d296d130bd65b4636c450b1943cbe24959be090

7 weeks agogdb/testsuite: fix gdb.base/maint.exp odd test name
Simon Marchi [Fri, 20 Feb 2026 14:52:14 +0000 (09:52 -0500)] 
gdb/testsuite: fix gdb.base/maint.exp odd test name

I noticed this odd test name:

    PASS: gdb.base/maint.exp: maint currently expandedinfo currently expandedline-table currently expandedwith currently expandedfilename currently expandedof currently expandedsymtab currently expandedthat currently expandedis currently expandednot

This is because the join TCL proc is misused.  It ends up joining all of
the words in

    "maint info line-table with filename of symtab that is not"

with the string

    " currently expanded"

when the intention was to concatenate.

Change it back to just a plain string.  We can have a debate over this,
but in my opinion it's more readable to have the plain string (even if
the line is a bit long) instead of building the test name by
concatenating parts.  It's also more grep-able.

Change-Id: I491eb6843deed1c1b6edf0ebf9161644f0894b5a
Approved-By: Tom de Vries <tdevries@suse.de>
7 weeks agogdb/solib-frv: remove manual memory management
Simon Marchi [Tue, 17 Feb 2026 21:16:44 +0000 (16:16 -0500)] 
gdb/solib-frv: remove manual memory management

 - Make fetch_loadmap return a unique pointer, adjust callers
 - Make fetch_loadmap use a unique pointer for ext_ldmbuf
 - Replace some fields of lm_info_frv to be unique pointers
 - Make main_executable_lm_info a unique pointer

I can only build-test this.

Change-Id: I5782ea31b5e30fef2c7468f0bc24d10ffae92669
Approved-by: Kevin Buettner <kevinb@redhat.com>
7 weeks agoPR ld/24600: LD: Add support for file collections as artificial archives
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:51 +0000 (17:29 +0000)] 
PR ld/24600: LD: Add support for file collections as artificial archives

Implement linker support for `--start-lib' and `--end-lib' command-line
options and an analogous LIB linker script statement for treating a list
of object files as members of an artificial archive.  This is built upon
BFD's fake archive feature, to support the same command-line options of
the GOLD linker being phased out.

Usual archive semantics is preserved for such artificial archives, such
as symbol resolution rules, archive grouping, and the `--whole-archive'
feature, except for the `--no-link-mapless' setting which is ignored as
meaningless for such loose file collections which cannot have a symbol
map.

There is no support for nested archives or other members that are not
object files, e.g. if a file supplied as a member archive is a linker
script, it will be silently ignored, just as with actual archives.  It
is unlike with input files passed that are not members of an artificial
archive.

Update documentation and expand test coverage accordingly.

7 weeks agoPR ld/24600: BFD: Add general linker support for fake archives
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:51 +0000 (17:29 +0000)] 
PR ld/24600: BFD: Add general linker support for fake archives

Add support to BFD for file collections pretending to be archives, with
the usual linker symbol resolution semantics as with actual archives.
This is an underlying feature to implement `--start-lib'/`--end-lib'
group support of the GOLD linker being phased out.

It comes in the form of `bfd_openr_fake_archive' function which arranges
for a list of input files supplied to be treated as an archive, with
`bfd_openr_next_archived_file' then referring to successive elements of
the list previously supplied.

Use the BFD pointer member of the first file and proxy handle members of
`struct bfd' and `struct artdata' respectively to hold references to the
members of such an artificial archive once arranged.  Such an archive
has to be a mapless one necessarily and any use will require a symbol
index to be produced on the fly.

Add assertions throughout backend code that is supposed not to be ever
reached in the handling of such archives and which continues to use the
first file and proxy handle members of `struct bfd' and `struct artdata'
solely to keep offsets into the owning archive file.

7 weeks agoBFD: Add BFD pointer member to archive member references
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:51 +0000 (17:29 +0000)] 
BFD: Add BFD pointer member to archive member references

In preparation for the next change replace a file offset with a union
of one and a BFD pointer in `struct bfd' and `struct artdata' members
used to refer to archive members and rename the members accordingly.
No functional change at this point.

7 weeks agoLD: Factor out new input file node insertion
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:51 +0000 (17:29 +0000)] 
LD: Factor out new input file node insertion

Move code for new input file node insertion in the middle of the
statement list to a separate function.  No functional change.

7 weeks agoLD: Guard `new_afile' result with assertions
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:50 +0000 (17:29 +0000)] 
LD: Guard `new_afile' result with assertions

Calls to `new_afile' can in principle return a NULL pointer.  However
in `lookup_name' we dereference the pointer returned without validating
it first.  Since it's not supposed to be NULL there except where we have
hit an internal consistency issue just add an assertion for meaningful
output rather than just a segfault.

For consistency update `cmdline_load_object_only_section' replacing a
call to `abort' with the same assertion.

7 weeks agoPR ld/24600: LD: Add options to control mapless archive acceptance
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:50 +0000 (17:29 +0000)] 
PR ld/24600: LD: Add options to control mapless archive acceptance

Add `--link-mapless' and `--no-link-mapless' LD command-line options, to
respectively enable and disable the acceptance of mapless archives on a
per-file basis, also with XCOFF targets, enabled by default.  Update
documentation and add test cases accordingly.

7 weeks agoPR ld/24600: BFD: Add general linker support for mapless archives
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:50 +0000 (17:29 +0000)] 
PR ld/24600: BFD: Add general linker support for mapless archives

Expand linker mapless archive support from XCOFF targets only across the
remaining ones, except for VMS targets whose archive format always has a
symbol map.  For this tranform BFD code used by AR to produce symbol
maps to archive files such as to have a handler supplied to either write
a map to a file or convert symbol data to an archive symbol definition
table attached to an archive BFD as if read from a symbol map, but using
pointers to member BFDs rather than file offsets.  Retain XCOFF handling
code as it is.

Where the archive group feature is used a given archive may be opened
multiple times in a single link.  If this happens then a reference to a
symbol the definition of which is provided by said archive will change
from undefined on the first access to the archive to defined on later
accesses.  The symbol table is pulled from an archive only for undefined
references, so if a symbol table has been pulled on first access and
then dropped by on-the-fly symbol map generation on a subsequent access,
then the symbol table is never re-read.  Later on when the linker wants
to access it to actually resolve symbol references it won't have been
reloaded and a crash would happen on a null pointer dereference.

To prevent this from happening add code to `_bfd_compute_and_push_armap'
to let the caller request the symbol table to be retained and ask for it
when building a symbol map on the fly in the linker.  The symbol table
will likely be used further down the link anyway.

Additionally always check the format of the first member of an archive,
even if no symbol map is present, and respect the format determined, so
that the correct format is used even if it is not the default one the LD
has been configured for, preventing segmentation faults from triggering
in `cris-aout' LD with the default (`crisaout') emulation or with the
`criself' emulation explicitly requested where archive members are in
the ELF format and consequntly removing failures with new tests:

cris-aout  -FAIL: CRIS regular archive w/o index link (explicit emulation)
cris-aout  -FAIL: CRIS regular archive w/o index link (implicit emulation)
cris-aout  -FAIL: CRIS thin archive w/o index link (explicit emulation)
cris-aout  -FAIL: CRIS thin archive w/o index link (implicit emulation)

Update documentation and adjust test cases accordingly now that mapless
archives are accepted for link by all targets except for VMS ones, which
never produce them in the first place.

7 weeks agoBFD: Add BFD pointer member to `struct carsym'
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:50 +0000 (17:29 +0000)] 
BFD: Add BFD pointer member to `struct carsym'

Replace the file offset with a union of one and a BFD pointer in `struct
carsym', as a preparation to handle symbol maps built on the fly rather
than fetched from a file.  No functional change.

NB there's a note on `struct carsym' being a type pun on `struct symdef'
as in include/aout/ranlib.h (or `struct ranlib'; no idea where it comes
from).  It is possibly not true anymore, even more so with this code
update in place, depending on the underlying type of `file_ptr'.  This
is not a problem however, because we always process `struct carsym' data
by hand and only use it internally rather than reading/writing from/to a
file.  Therefore remove the note, as no longer applicable.

7 weeks agoBFD: Make file offset unsigned in archive symbols
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:50 +0000 (17:29 +0000)] 
BFD: Make file offset unsigned in archive symbols

We seem to be quite lax in flipping between signed and unsigned file
offsets in archive handling.  As member positions within an archive
cannot be negative it makes little to no sense to keep such values in
structures, as their existence is supposed to be transient only where a
function call returns one to indicate a failure.  Such failures need to
be handled appropriately of course, but there's no point in storing the
error indicator as a symbol location reference.

Switch the data type for the file offset embedded in the archive symbol
structure from signed to unsigned then, in preparation to unify archive
location references with a later change.  Update code where necessary
accordingly.  No functional change.

7 weeks agoBFD: Correct archive format determination for non-default link emulations
Alan Modra [Fri, 20 Feb 2026 17:29:50 +0000 (17:29 +0000)] 
BFD: Correct archive format determination for non-default link emulations

Fix an issue with archive format determination coming from commit
b228303dd14e ("PR binutils/13278: --plugin doesn't work on archive"),
<https://inbox.sourceware.org/binutils/20111011064345.GM25970@bubble.grove.modra.org/>,
causing the default link emulation to be used despite archive members
being in another object format and consequently triggering segmentation
faults in `cris-aout' LD with the default (`crisaout') emulation where
archive members are in the ELF format.

Address the issue by always checking the format of the first member of
an archive even if no default target has been specified, except when the
target being checked against is be the plugin target.  Verified by hand
and the `powerpc64le-linux-gnu' target to cause no issue with the recipe
in PR binutils/13278 and removing failures from segmentation faults with
the new tests:

cris-aout  -FAIL: CRIS regular archive link (implicit emulation)
cris-aout  -FAIL: CRIS thin archive link (implicit emulation)

Co-Authored-By: Maciej W. Rozycki <macro@redhat.com>
7 weeks agoBFD/aout: Sanitize back end flavour for external symbols retrieval
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:50 +0000 (17:29 +0000)] 
BFD/aout: Sanitize back end flavour for external symbols retrieval

Make `aout_get_external_symbols' return unsuccessfully right away if
called for a non-aout BFD, preventing a crash from an attempt to access
inexistent ->tdata.aout_data->a (`struct aoutdata') struct member.  Add
assertions at call sites to track potential invalid usage.

This converts a segmentation fault to an assertion failure followed by
graceful termination:

.../ld/ld-new: BFD (GNU Binutils) 2.45.50.20251209 assertion fail .../bfd/aoutx.h:3449
.../ld/ld-new: tmpdir/ab.a: error adding symbols: file in wrong format

with an upcoming test case:

FAIL: CRIS regular archive link (implicit emulation)

where a `cris-aout' target linker invocation:

$ .../ld/ld-new -o tmpdir/abci -e ff tmpdir/abc.o tmpdir/ab.a

lands in `_bfd_generic_link_add_archive_symbols' with an inconsistent
state between an archive's BFD and its member's BFD:

Breakpoint 1, _bfd_generic_link_add_archive_symbols (abfd=0x100264700,
    info=0x100253110 <link_info>,
    checkfn=0x10009ac80 <aout_link_check_archive_element>)
    at .../bfd/linker.c:1020
1020   if (! (*checkfn) (element, info, h, arsym->name, &needed))
(gdb) print *abfd
$1 = {filename = 0x1002b6200 "tmpdir/ab.a",
  xvec = 0x10028d650 <cris_aout_vec>, iostream = 0x1002a47d0,
[...]
(gdb) print *element
$2 = {filename = 0x1002ccfb0 "a.o", xvec = 0x10028ea30 <cris_elf32_us_vec>,
  iostream = 0x0, iovec = 0x10028ace8 <cache_iovec>, lru_prev = 0x0,
[...]
(gdb)

7 weeks agoBFD: Unset the format on releasing a BFD's objalloc memory
Maciej W. Rozycki [Fri, 20 Feb 2026 17:29:50 +0000 (17:29 +0000)] 
BFD: Unset the format on releasing a BFD's objalloc memory

Make a BFD reusable after a `_bfd_free_cached_info' call to release its
objalloc memory, by unsetting the format so that a subsequent call to
`bfd_check_format_matches' will re-retrieve data previously discarded.
Otherwise accesses to discarded data will be attempted where the BFD
continues being used.  Found with a crash in `bfd_set_gp_size' when
building archive symbol maps on the fly in a subsequent change.

7 weeks ago[gdb] Handle pagination prompt during posted event
Tom de Vries [Fri, 20 Feb 2026 11:21:05 +0000 (12:21 +0100)] 
[gdb] Handle pagination prompt during posted event

PR python/24796 reports the following problem.

We have a python file test.py:
...
import gdb
def Event():
  for x in range(0, 10):
    print("Line")
gdb.post_event(Event)
...

Without pagination, we simple have:
...
(gdb) source test.py
(gdb) Line
Line
  ...
Line
Line
print 1
$1 = 1
(gdb)
...

But with pagination (and height set to 8), we get instead:
...
(gdb) source test.py
(gdb) Line
Line
  ...
Line
--Type <RET> for more, q to quit, c to continue without paging--c
Line
Line
Line
print 1
readline: readline_callback_read_char() called with no handler!

Fatal signal: Aborted
----- Backtrace -----
0x651099 gdb_internal_backtrace_1
/data/vries/gdb/src/gdb/bt-utils.c:122
0x651137 _Z22gdb_internal_backtracev
/data/vries/gdb/src/gdb/bt-utils.c:175
0x9462aa handle_fatal_signal
/data/vries/gdb/src/gdb/event-top.c:1008
0x7f4efaf5f08f ???
/usr/src/debug/glibc-2.40/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7f4efafb245c __pthread_kill_implementation
/usr/src/debug/glibc-2.40/nptl/pthread_kill.c:44
0x7f4efaf5efc5 __GI_raise
../sysdeps/posix/raise.c:26
0x7f4efaf46916 __GI_abort
/usr/src/debug/glibc-2.40/stdlib/abort.c:79
0x117502b rl_callback_read_char
/data/vries/gdb/src/readline/readline/callback.c:139
0x944bc2 gdb_rl_callback_read_char_wrapper_sjlj
/data/vries/gdb/src/gdb/event-top.c:197
0x944cd3 gdb_rl_callback_read_char_wrapper_noexcept
/data/vries/gdb/src/gdb/event-top.c:240
0x944d51 gdb_rl_callback_read_char_wrapper
/data/vries/gdb/src/gdb/event-top.c:252
0x10623e3 stdin_event_handler
/data/vries/gdb/src/gdb/ui.c:154
0x1a06e9c handle_file_event
/data/vries/gdb/src/gdbsupport/event-loop.cc:551
0x1a074df gdb_wait_for_event
/data/vries/gdb/src/gdbsupport/event-loop.cc:672
0x1a063bc _Z16gdb_do_one_eventi
/data/vries/gdb/src/gdbsupport/event-loop.cc:263
0x6d547f _ZN6interp12do_one_eventEi
/data/vries/gdb/src/gdb/interps.h:93
0xb77fb6 start_event_loop
/data/vries/gdb/src/gdb/main.c:403
0xb781a4 captured_command_loop
/data/vries/gdb/src/gdb/main.c:468
0xb7a10d captured_main
/data/vries/gdb/src/gdb/main.c:1381
0xb7a209 _Z8gdb_mainP18captured_main_args
/data/vries/gdb/src/gdb/main.c:1400
0x419704 main
/data/vries/gdb/src/gdb/gdb.c:38
...

What leads to the crash, is that this code in gdb_readline_wrapper_line:
...
  /* Prevent parts of the prompt from being redisplayed if annotations
     are enabled, and readline's state getting out of sync.  We'll
     reinstall the callback handler, which puts the terminal in raw
     mode (or in readline lingo, in prepped state), when we're next
     ready to process user input, either in display_gdb_prompt, or if
     we're handling an asynchronous target event and running in the
     background, just before returning to the event loop to process
     further input (or more target events).  */
  if (current_ui->command_editing)
    gdb_rl_callback_handler_remove ();
...
when activated by the pagination prompt removes the callback handler (which
sets rl_linefunc to NULL).

The comment mentions re-installing the callback handler, but that doesn't
happen, so when calling rl_callback_read_char we run into:
...
  if (rl_linefunc == NULL)
    {
      _rl_errmsg ("readline_callback_read_char() called with no handler!");
      abort ();
    }
...

An example of re-installation is found here in infrun.c:
...
/* Cleanup that reinstalls the readline callback handler, if the
   target is running in the background.  If while handling the target
   event something triggered a secondary prompt, like e.g., a
   pagination prompt, we'll have removed the callback handler (see
   gdb_readline_wrapper_line).  Need to do this as we go back to the
   event loop, ready to process further input.  Note this has no
   effect if the handler hasn't actually been removed, because calling
   rl_callback_handler_install resets the line buffer, thus losing
   input.  */

static void
void
reinstall_readline_callback_handler_cleanup ()
...

Fix the crash by adding the same cleanup in run_events.

Tested on x86_64-linux.

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

7 weeks agogas: tighten get_single_number()
Jan Beulich [Fri, 20 Feb 2026 07:36:55 +0000 (08:36 +0100)] 
gas: tighten get_single_number()

Move what the function does closer to what its name says. Add some error
checking, also in its sole caller (implementing entirely undocumented and
- so far - entirely untested behavior).

I really want the -f passed to gas in the new testcase, yet that means the
odd-looking .if expression can't be commented upon
("NUMBERS_WITH_SUFFIX implies in particular no C-style octal numbers").

7 weeks agogas/z80: adjust .assume handling
Jan Beulich [Fri, 20 Feb 2026 07:35:41 +0000 (08:35 +0100)] 
gas/z80: adjust .assume handling

get_single_number() is (bogusly) more similar to get_absolute_expression()
than its name says. As (per documentation) an expression is wanted here,
use the respective function, which then also adds at least a little bit of
error checking.

While there also deal with possible stray other stuff on the line, as
appropriate.

7 weeks agoAutomatic date update in version.in
GDB Administrator [Fri, 20 Feb 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 weeks agogdb/testsuite: update C++ tests for volatile changes in C++20
Andrew Burgess [Thu, 12 Feb 2026 18:22:50 +0000 (18:22 +0000)] 
gdb/testsuite: update C++ tests for volatile changes in C++20

I ran the testsuite on a machine where the C++ compiler was C++20 by
default, and noticed a bunch of errors like this:

  gdb compile failed, /tmp/BUILD/gdb-17.1-build/gdb-17.1/gdb/testsuite/gdb.base/infcall-nested-structs.c: In function 'void breakpt()':
  /tmp/BUILD/gdb-17.1-build/gdb-17.1/gdb/testsuite/gdb.base/infcall-nested-structs.c:414:3: warning: '++' expression of 'volatile'-qualified type is deprecated [-Wvolatile]
    414 |   v++;
        |   ^
  UNRESOLVED: gdb.base/infcall-nested-structs-c++.exp: types-tl: failed to compile

My understanding is that, in C++20, some operations on volatile
variables are now deprecated.  So things like:

  volatile int var = 0;
  ++var;
  --var
  var += 1;
  var -= 1;

Are now, I believe, all deprecated.  However, this is still allowed:

  var = var + 1;

There are a few test cases where this impacts us, though in every case
the increment of the volatile only existed in order to create filler
work, as far as I can tell the volatile variable is never inspected
from GDB.

In gdb.base/infcall-nested-structs.c I just deleted the volatile
completely.

In the other tests I replaced the '++' with 'var = var + 1' type code.

I don't believe there should be any change in what is actually being
tested after this patch.

7 weeks agogas: don't use frag_more to repeat copies
Alan Modra [Thu, 19 Feb 2026 04:48:12 +0000 (15:18 +1030)] 
gas: don't use frag_more to repeat copies

It's more elegant to use the repeat capability of an rs_fill frag_var,
and dramatically reduces memory usage for large repeat counts.

For ideal minimal memory use, repeats of up to the 100 bytes or so of
frag overhead should be handled by frag_more, but I don't care to
optimise those cases.  It's enough that the most common case of a
single output value uses frag_more, while stress testing the assembler
with huge repeats doesn't run into OOM.

* read.c (float_cons): Repeat output using an rs_fill frag_var
rather than looping with frag_more.
(s_float_space): Likewise.

7 weeks agoAdd "save history" command
Tom Tromey [Tue, 24 Jan 2023 00:40:16 +0000 (17:40 -0700)] 
Add "save history" command

PR cli/23664 points out that it would sometimes be convenient to
immediately save the current history to a file.  This patch implements
this feature.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23664
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Keith Seitz <keiths@redhat.com>
7 weeks agoAdd "save skip" command
Tom Tromey [Tue, 24 Jan 2023 00:04:55 +0000 (17:04 -0700)] 
Add "save skip" command

PR cli/17997 points out that it would sometimes be convenient to save
the current "skip"s to a file.  This patch implements this feature.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17997
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Keith Seitz <keiths@redhat.com>
7 weeks agoAdd "save user" command
Tom Tromey [Mon, 23 Jan 2023 23:10:53 +0000 (16:10 -0700)] 
Add "save user" command

PR cli/19395 points out that it would sometimes be convenient to save
one's user-defined commands to a file.  This patch implements this
feature.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19395
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Keith Seitz <keiths@redhat.com>
7 weeks agoMove show_user_1 to cli-cmds.c
Tom Tromey [Mon, 23 Jan 2023 22:53:41 +0000 (15:53 -0700)] 
Move show_user_1 to cli-cmds.c

show_user_1 is only called from cli-cmds.c, so move it there and make
it static.

Reviewed-By: Keith Seitz <keiths@redhat.com>
7 weeks agoSave breakpoints so they are automatically pending
Tom Tromey [Mon, 23 Jan 2023 04:43:59 +0000 (21:43 -0700)] 
Save breakpoints so they are automatically pending

PR breakpoints/18183 points out that breakpoints saved with the "save
breakpoints" command can be slightly inconvenient, depending on "set
breakpoint pending".

This patch makes use of the new "with" command to save breakpoints
such that they will automatically be made pending, if necessary, when
being restored.

Unfortunately, reloading a breakpoint saved this way will also print:

    No symbol table is loaded.  Use the "file" command.

This seems strange to me, and also a bit useless, but changing
create_breakpoint not to call exception_print in the AUTO_BOOLEAN_TRUE
case caused other regressions, so I've left it as-is for the time
being.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18183
Reviewed-By: Keith Seitz <keiths@redhat.com>
7 weeks agoAutomatic date update in version.in
GDB Administrator [Thu, 19 Feb 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 weeks agoAMDGCN: Disable subdirectory configuration for unsupported GAS and LD
Maciej W. Rozycki [Wed, 18 Feb 2026 17:32:32 +0000 (17:32 +0000)] 
AMDGCN: Disable subdirectory configuration for unsupported GAS and LD

The `amdgcn' target is not supported by GAS or LD, so disable building
in the respective subdirectories, removing configuration errors such as:

This target is no longer supported in gas
make[1]: *** [Makefile:5473: configure-gas] Error 1

and:

*** ld does not support target amdgcn-unknown-none
*** see ld/configure.tgt for supported targets
make[1]: *** [Makefile:6968: configure-ld] Error 1

in builds where no explicit `--disable-gas' and `--disable-ld' options
have been used with the top-level `configure' script.  Users must not
have to disable features selected by default to get a working
configuration.

/
* configure.ac <amdgcn-*-*> (noconfigdirs): Add `ld' and `gas'.
* configure: Regenerate.

7 weeks agoMIPS/BFD: Avoid section ordering breaking DYNAMIC segment for IRIX 5
Maciej W. Rozycki [Wed, 18 Feb 2026 07:58:31 +0000 (07:58 +0000)] 
MIPS/BFD: Avoid section ordering breaking DYNAMIC segment for IRIX 5

With MIPS targets using the IRIX 5 linker emulation the DYNAMIC segment,
unusually, gets all of: `.dynamic', `.hash', `.dynsym', and `.dynstr'
sections mapped to, as well as any other sections placed in between.

No attention is paid as to which of these sections comes first though,
which would make such a DYNAMIC segment unusable at load time unless it
starts with the `.dynamic' section, if not for LD terminating the link
with:

The first section in the PT_DYNAMIC segment is not the .dynamic section

error message.

Our standard linker scripts ensure the correct section ordering, however
a user-supplied script may not, and it seems suboptimal to prevent users
from reordering sections to their liking.

Modify MIPS IRIX 5 linker emulation handling then so that only `.hash',
`.dynsym', and `.dynstr' sections that come after `.dynamic' in output,
and any other sections placed in between, get mapped to the DYNAMIC
segment.

This preserves exact IRIX 5 semantics for all the conforming scripts,
while letting people use a different order rather than getting a link
error.  The error result previously issued means there is no backwards
compatibility to consider as no output used to be produced.

This removes a number of test failures:

-FAIL: PROVIDE_HIDDEN test (auxiliary shared object)
-FAIL: PROVIDE_HIDDEN test 4
-FAIL: PROVIDE_HIDDEN test 6
-FAIL: PROVIDE_HIDDEN test 10
-FAIL: PROVIDE_HIDDEN test 12
-FAIL: readelf version information
-FAIL: PR ld/20828 forcibly exported symbol version without section GC
-FAIL: PR ld/21233 dynamic symbols with section GC (auxiliary shared library)

across MIPS targets using the IRIX 5 linker emulation, such as
`mips-sgi-irix5', `mips-elf', `mips-rtems', etc.

7 weeks agoELF/BFD: Factor in inter-section padding for DYNAMIC segment
Maciej W. Rozycki [Wed, 18 Feb 2026 07:58:31 +0000 (07:58 +0000)] 
ELF/BFD: Factor in inter-section padding for DYNAMIC segment

The vast majority of ELF targets only maps the `.dynamic' section in the
DYNAMIC segment, however MIPS targets using the IRIX 5 linker emulation
place all of: `.dynamic', `.hash', `.dynsym', and `.dynstr' sections
there, as well as any other sections placed in between.  While the four
named sections have a fixed 4-byte alignment, other sections may require
a larger alignment causing extra padding to be produced as the sections
are laid out in linker output and mapped to segments.  It is taken into
account in calculating the size for segments of the LOAD and TLS types,
but not for the DYNAMIC one.

Consequently the segment may get truncated, as illustrated with the
`dynamic-sections-2' test case included, which causes the following
mapping to be produced with the `mips-sgi-irix5' target, as well as
numerous bare metal ones such as `mips-elf' or `mips-rtems':

There are 12 section headers, starting at offset 0x139c:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .MIPS.abiflags    MIPS_ABIFLAGS   00000000 001000 000018 18   A  0   0  8
  [ 2] .dynamic          DYNAMIC         00000018 001018 0000c8 00   A  6   0  4
  [ 3] .hash             HASH            000000e0 0010e0 00002c 00   A  5   0  4
  [ 4] .data             PROGBITS        00000110 001110 000010 00  WA  0   0 16
  [ 5] .dynsym           DYNSYM          00000120 001120 000060 10   A  6   2  4
  [ 6] .dynstr           STRTAB          00000180 001180 000049 00   A  0   0  4
  [ 7] .rel.dyn          REL             000001cc 0011cc 000010 08   A  5   0  4
  [ 8] .got              PROGBITS        000001e0 0011e0 00000c 04 WAp  0   0 16
  [ 9] .symtab           SYMTAB          00000000 0011ec 0000f0 10     10   9  4
  [10] .strtab           STRTAB          00000000 0012dc 000063 00      0   0  1
  [11] .shstrtab         STRTAB          00000000 00133f 00005d 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  D (mbind), p (processor specific)

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 3 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  ABIFLAGS       0x001000 0x00000000 0x00000000 0x00018 0x00018 R   0x8
  LOAD           0x001000 0x00000000 0x00000000 0x001ec 0x001ec RW  0x1000
  DYNAMIC        0x001018 0x00000018 0x00000018 0x001b1 0x001ad RW  0x10

 Section to Segment mapping:
  Segment Sections...
   00     .MIPS.abiflags
   01     .MIPS.abiflags .dynamic .hash .data .dynsym .dynstr .rel.dyn .got
   02     .dynamic .hash .data .dynsym

-- notice `.dynstr' missing from the section to segment mapping shown
above, owing to the trailing part of the section extending beyond the
end of the segment, and the memory size of the DYNAMIC segment smaller
than its file size.

Apply the same memory size adjustment for padding to segments of the
DYNAMIC type as already made for segments of the LOAD and TLS types,
observing that semantically DYNAMIC segments are analogous except for
only having the lone `.dynamic' section mapped with the vast majority
of ELF targets.

7 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 18 Feb 2026 00:00:09 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 weeks ago[gdb/testsuite] Use valnum_re more often (part 5)
Tom de Vries [Tue, 17 Feb 2026 19:02:50 +0000 (20:02 +0100)] 
[gdb/testsuite] Use valnum_re more often (part 5)

Use valnum_re instead of "\\\$\\d+" and "\\$\\d+".  In one case though I used
quotemeta.

Tested on x86_64-linux.

7 weeks ago[gdb/testsuite] Fix some incorrect uses of decimal
Tom de Vries [Tue, 17 Feb 2026 18:20:50 +0000 (19:20 +0100)] 
[gdb/testsuite] Fix some incorrect uses of decimal

Dejagnu defines $decimal as:
...
set decimal "\[0-9\]+"
...

If we add an equivalent definition in lib/gdb.exp:
...
set decimal "(?:\[0-9\]+)"
...
we run into this type of ERRORs:
...
couldn't compile regular expression pattern: parentheses () not balanced
...

This is due to using "\[$decimal\]" instead of "\\\[$decimal\\]" or
"[subst_var {\[$decimal\]}]".

Add such definitions of decimal and hex, and apply the same technique to
positive and octal.

Fix the errors mostly using subst_var.

Tested on x86_64-linux.

7 weeks ago[gdb/testsuite] Add positive regexp
Tom de Vries [Tue, 17 Feb 2026 18:20:50 +0000 (19:20 +0100)] 
[gdb/testsuite] Add positive regexp

Add a regexp positive, similar to regexp decimal, and use it in the
testsuite.

Tested on x86_64-linux.

7 weeks ago[gdb/testsuite] Use hex more often
Tom de Vries [Tue, 17 Feb 2026 18:20:50 +0000 (19:20 +0100)] 
[gdb/testsuite] Use hex more often

Replace '0x\[0-9a-fA-F\]+' and '0x\[0-9a-fA-F]+' with ${::hex}:
...
$ find gdb/testsuite/ -type f -name *.exp* \
    | xargs sed -i 's/0x\\\[0-9a-fA-F\\\]+/${::hex}/g'
$ find gdb/testsuite/ -type f -name *.exp* \
    | xargs sed -i 's/0x\\\[0-9a-fA-F\]+/${::hex}/g'
...

Likewise for:
- '0x\[0-9A-Fa-f\]+'
- '0x\[0-9A-Fa-f]+'
- '0x\[0-9a-f\]+'
- '0x\[0-9a-f]+'

7 weeks ago[gdb/testsuite] Use decimal more often
Tom de Vries [Tue, 17 Feb 2026 18:20:50 +0000 (19:20 +0100)] 
[gdb/testsuite] Use decimal more often

Replace '\[0-9\]+' and '\[0-9]+' with ${::decimal}:
...
$ find gdb/testsuite/ -type f -name *.exp* \
  | xargs sed -i 's/\\\[0-9\\\]+/${::decimal}/g'
$ find gdb/testsuite/ -type f -name *.exp* \
  | xargs sed -i 's/\\\[0-9\]+/${::decimal}/g'
...

Tested on x86_64-linux.

7 weeks agogcore: Handle unreadable pages within readable memory regions
Kevin Buettner [Thu, 29 Jan 2026 22:09:24 +0000 (15:09 -0700)] 
gcore: Handle unreadable pages within readable memory regions

GLIBC 2.42 changed how thread stack guard pages are implemented [2].
In GLIBC 2.41 and earlier, guard pages were set up using mprotect() to
mark guard regions with no permissions.  Once configured, guard pages
were visible as separate entries in /proc/PID/maps with no permissions
(i.e. they're inaccessible).  In GLIBC 2.42, guard pages are
installed using the kernel's MADV_GUARD_INSTALL mechanism [1], which
marks them at the page table entry (PTE) level within the existing
mapping.

As a consequence, guard pages do not appear as separate entries in
/proc/PID/maps, but remain as part of the containing mapping.  Moreover,
thread stacks from multiple mmap() calls may be merged into a single
virtual memory area (VMA) with read and write permissions since there's
no guard page VMA to separate them.  These guard pages cannot be
distinguished by examining VMA listings but do return EIO when read
from /proc/PID/mem.

GDB's gcore code reads /proc/PID/smaps to discover memory regions and
creates one BFD section per mapping.  (On linux, this is performed in
linux_find_memory_regions_full in linux-tdep.c.) With the old layout,
memory areas with guard pages appeared separately with no permissions,
which were filtered out.  Each thread stack became its own section
containing only readable data.  With the new layout, using
MADV_GUARD_INSTALL instead of the older mechanism, it's often the case
that thread stacks created with multiple calls to mmap() are exposed
as a single mapping appearing in /proc/PID/smaps with read and write
permissions.  Should that happen, GDB's code creates a single section
covering all thread stacks and their guard pages.  (Even if each
thread stack appears in its own mapping, the fact remains that there
will be an inaccessible portion of the mapping.  When one or more
thread stacks are coalesced into a single mapping, there will be
several inaccessible "holes" representing the guard pages.)

When gcore_copy_callback copies section contents, it reads memory in
1MB (MAX_COPY_BYTES) chunks.  If any page in the chunk is a guard page,
the call to target_read_memory() fails.  The old code responded by
breaking out of the copy loop, abandoning the entire section.  This
prevents correct copying of thread stack data, resulting in core files
with zero-filled thread stacks, resulting in nearly empty backtraces.

Fix this by falling back to page-by-page reading when a 1MB chunk read
fails.  Individual pages that cannot be read are filled with zeros,
allowing the remaining readable memory to be captured.

I also considered a simpler change using the value of
FALLBACK_PAGE_SIZE (4096) as the read size instead of MAX_COPY_BYTES
(1MB).  This would avoid the fallback logic but would cause up to 256x
more syscalls.  The proposed approach also allows meaningful warnings:
we warn only if an entire region is unreadable (indicating a real
problem), whereas per-page reads would make it harder to distinguish
guard page failures from actual errors.  Since guard pages are at
offset 0 for downward-growing stacks, a large target_read_memory()
fails early at the first unreadable byte anyway.

With this fix, I see 16 failures resolved in the following test cases:

    gdb.ada/task_switch_in_core.exp
    gdb.arch/i386-tls-regs.exp
    gdb.threads/threadcrash.exp
    gdb.threads/tls-core.exp

Looking at just one of these, from gdb.log without the fix, I see:

  thread apply 5 backtrace

  Thread 5 (LWP 3414829):
  #0  0x00007ffff7d1d982 in __syscall_cancel_arch () from /lib64/libc.so.6
  #1  0x0000000000000000 in ?? ()
  (gdb) FAIL: gdb.threads/threadcrash.exp: test_gcore: thread apply 5 backtrace

And this is what it looks like with the fix in place (some paths have
been shortened):

  thread apply 5 backtrace

  Thread 5 (Thread 0x7fffeffff6c0 (LWP 1282651) "threadcrash"):
  #0  0x00007ffff7d1d982 in __syscall_cancel_arch () from /lib64/libc.so.6
  #1  0x00007ffff7d11c3c in __internal_syscall_cancel () from /lib64/libc.so.6
  #2  0x00007ffff7d61b62 in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6
  #3  0x00007ffff7d6db37 in nanosleep () from /lib64/libc.so.6
  #4  0x00007ffff7d8008e in sleep () from /lib64/libc.so.6
  #5  0x00000000004006a8 in do_syscall_task (location=NORMAL) at threadcrash.c:158
  #6  0x0000000000400885 in thread_function (arg=0x404340) at threadcrash.c:277
  #7  0x00007ffff7d15464 in start_thread () from /lib64/libc.so.6
  #8  0x00007ffff7d985ac in __clone3 () from /lib64/libc.so.6
  (gdb) PASS: gdb.threads/threadcrash.exp: test_live_inferior: thread apply 5 backtrace

Regression testing on Fedora 42 (glibc 2.41) shows no new failures.

The v1 patch used SPARSE_BLOCK_SIZE as the fallback size.  While it
was the correct size, it's used for an entirely different purpose
elsewhere in this file.  This v2 commit introduces the constant
FALLBACK_PAGE_SIZE instead.

References:

[1] Linux commit 662df3e5c376 ("mm: madvise: implement lightweight
    guard page mechanism")
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=662df3e5c37666d6ed75c88098699e070a4b35b5
[2] glibc commit a6fbe36b7f31 ("nptl: Add support for setup guard
    pages with MADV_GUARD_INSTALL")
    https://sourceware.org/git/?p=glibc.git;a=commit;h=a6fbe36b7f31292981422692236465ab56670ea9

Claude Opus 4.5 and GLM 4.7 assisted with the development of this commit.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33855
Approved-By: Tom de Vries <tdevries@suse.de>
7 weeks ago[gdb/doc] Improve info line command documentation
Tom de Vries [Tue, 17 Feb 2026 14:45:23 +0000 (15:45 +0100)] 
[gdb/doc] Improve info line command documentation

The "info line" command can be used with or without arguments.

About using it without arguments, the documentation [1] says the following:
...
info line

    With no locspec, information about the current source line is printed.

  ...

After info line, using info line again without specifying a location will
display information about the next source line.
...

That does not describe the fact that the command may also show the last line
listed:
...
(gdb) info line
No line number information available.
(gdb) list main
20 #include "interps.h"
21 #include "run-on-main-thread.h"
22
23 int
24 main (int argc, char **argv)
25 {
26   /* The first call to is_main_thread () should be from the main thread.
27      If this is the first call, then that requirement is fulfilled here.
28      If this is not the first call, then this verifies that the first call
29      fulfilled that requirement.  */
(gdb) info line
Line 29 of "gdb/gdb.c" is at address 0x419684 <main(int, char**)+30>
   but contains no code.
(gdb)
...

Update the documentation to list this additional functionality.

Approved-By: Eli Zaretskii <eliz@gnu.org>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33783

[1] https://www.sourceware.org/gdb/current/onlinedocs/gdb.html/Machine-Code.html#index-info-line

7 weeks ago[gdb/build] Require makeinfo 5.0
Tom de Vries [Tue, 17 Feb 2026 14:31:32 +0000 (15:31 +0100)] 
[gdb/build] Require makeinfo 5.0

Building GDB documentation in the info format requires makeinfo 5.0 [1].

Bail out when trying to use an older makeinfo version.

I tested this by requiring 7.0 in two setups that have respectively makeinfo
7.1 and 6.5.

In the 7.1 case I got (make output):
...
makeinfo-wrapper.sh 7 0 makeinfo ... -o gdb.info gdb/doc/gdb.texinfo
makeinfo-wrapper.sh 7 0 makeinfo ... -o annotate.info gdb/doc/annotate.texinfo
rluser.texi:2: warning: @setfilename after the first element
...
and in the 6.5 case I got instead:
...
makeinfo-wrapper.sh 7 0 makeinfo ... -o gdb.info gdb/doc/gdb.texinfo
makeinfo-wrapper.sh 7 0 makeinfo ... -o annotate.info gdb/doc/annotate.texinfo
makeinfo is too old, have 6.5, require 7.0.  Info documentation will not be build.
makeinfo is too old, have 6.5, require 7.0.  Info documentation will not be build.
...

Checked new file gdb/doc/makeinfo-wrapper.sh with shellcheck.

Changes in v2:
- handle version line 'texi2any (GNU texinfo) 7.2.90+nc'

Changes in v3:
- handle version line 'texi2any (GNU texinfo) 5.0+dev'

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

7 weeks agoLD/testsuite: Enable execution with remote targets
Maciej W. Rozycki [Tue, 17 Feb 2026 10:42:47 +0000 (10:42 +0000)] 
LD/testsuite: Enable execution with remote targets

Lift target execution limitation from `run_ld_link_exec_tests' procedure
and also handle remote targets, albeit in a restricted way, as follows.

Numerous test cases have been written such that they refer to a shared
library using a relative path, precluding the use of the runtime library
search path for the dependency to be found at run time.  Consequently a
test affected has to be run on the target such that the shared library
required is present at the same relative path rooted at the program's
current working directory.

Additionally any shared library dependencies are not handled across the
test suite in an organised way, so test invocations only have names of
direct dependencies buried within the linker options supplied.

Therefore assert that the linker test directory is located at the same
absolute path both on the test host and the test target, typically via
sharing the directory over NFS, and use the DejaGNU `remotedir' feature
to start execution on the target with that location as the test case's
current working directory.

7 weeks agoLD/testsuite: Implement target execution availability check
Maciej W. Rozycki [Tue, 17 Feb 2026 10:42:47 +0000 (10:42 +0000)] 
LD/testsuite: Implement target execution availability check

Complementing `check_compiler_available' procedure for a compilation
check implement `check_execution_available' that checks whether an
executable built the same way can actually successfully run on the
target.

7 weeks agoLD/testsuite: Factor out compilation of a dummy executable
Maciej W. Rozycki [Tue, 17 Feb 2026 10:42:47 +0000 (10:42 +0000)] 
LD/testsuite: Factor out compilation of a dummy executable

There is a dummy executable compiled for the purpose of determining
whether a target compiler is available that can produce a runnable
program.  This is now going to be also used to determine whether a
program produced this way can be executed on the target, so take the
relevant pieces from `check_compiler_available' procedure and factor
them out to `make_dummy_target_executable' procedure leaving the
executable produced in place and returning its name upon successful
compilation.  This executable needs to be discarded by the caller once
no longer needed.  No functional change overall.

7 weeks agogas: abort in new_logical_line_flags
Alan Modra [Mon, 16 Feb 2026 23:29:37 +0000 (09:59 +1030)] 
gas: abort in new_logical_line_flags

.linefile 0.

hits the "case 1 << 3" abort in new_logical_line_flags with line_number
of -1.

Similar to commit b60f6a628897, this fixes the abort by extending the
meaning of .linefile in user code to restore the physical line for
".linefile 0 .".

* input-scrub.c (new_logical_line_flags <case 1<<3>): Don't
abort on negative line number, instead restore physical line
for ".linefile 0".

7 weeks agogas: macros nested too deep error
Alan Modra [Mon, 16 Feb 2026 23:29:13 +0000 (09:59 +1030)] 
gas: macros nested too deep error

.macro r;r;.endm;r

Currently reports:
nest.s: Assembler messages:
nest.s:2: Fatal error: macros nested too deeply
nest.s:2:  Info: macro invoked from here
nest.s:2:   Info: macro invoked from here
...
nest.s:2:<much indenting> Info: macro invoked from here
nest.s:1:<much indenting>  Info: macro invoked from here

This patch corrects the line number reported, and downgrades the error
from as_fatal to as_bad.

* input-scrub.c (input_scrub_include_sb): Report "macros
nested too deeply" using as_bad.
* macro.c (buffer_and_nest): Only bump line number in .lineinfo
if we have a '\n'.

7 weeks agogas: further limit .rept count
Alan Modra [Mon, 16 Feb 2026 23:27:52 +0000 (09:57 +1030)] 
gas: further limit .rept count

gas currently limits a rept count at 0x7fffffff.  With a minimal rept
body this requires at least 2G * 16 due to the .linefile directive
added by buffer_and_nest.  I'm inclined to think 32G is excessive.

This patch limits the total memory used by rept to 4G (2G on 32-bit
systems).  That of course reduces allowed repeat counts by a factor of
at least 8, and note that the file name affects the max repeat.

The patch also changes the repeat count to 1 rather than 0 when
we hit the limit, so that the body of the rept is not entirely ignored.

Nested rept can still easily cause OOM of course.

* read.c (do_repeat): Limit allowed repeat count based on
total memory needed.

7 weeks agogas: .rept syntax check
Alan Modra [Mon, 16 Feb 2026 23:27:34 +0000 (09:57 +1030)] 
gas: .rept syntax check

Report an error for the following.
 .rept 10 haha
 .byte 0
 .endr

* read.c (do_repeat): Call demand_empty_rest_of_line.

7 weeks agold: lang_add_input_file and new_afile leaks
Alan Modra [Tue, 17 Feb 2026 00:45:38 +0000 (11:15 +1030)] 
ld: lang_add_input_file and new_afile leaks

These belong on stat_obstack, where the lang_input_statement is.

* ldlang.c (new_afile): Replace concat with stat_concat.
(lang_add_input_file): Likewise.

7 weeks agold: add_archive_element leak
Alan Modra [Tue, 17 Feb 2026 00:45:29 +0000 (11:15 +1030)] 
ld: add_archive_element leak

Commit 52fdc0531ea7 exposed other minor leaks.  Fix one of them.

* ldmain.c (add_archive_element): Use stat_alloc for
lang_input_statement.

7 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 17 Feb 2026 00:00:08 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 weeks agoCRIS/LD/testsuite: Clarify the purpose of archive.exp verification
Maciej W. Rozycki [Mon, 16 Feb 2026 06:30:48 +0000 (06:30 +0000)] 
CRIS/LD/testsuite: Clarify the purpose of archive.exp verification

Add an introductory comment describing the purpose of CRIS archive tests
as well as explanatory notes in the context of PR binutils/33485.

7 weeks agoAutomatic date update in version.in
GDB Administrator [Mon, 16 Feb 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 15 Feb 2026 00:00:07 +0000 (00:00 +0000)] 
Automatic date update in version.in

7 weeks agoStyle file names in DWARF warnings
Tom Tromey [Thu, 29 Jan 2026 03:56:47 +0000 (20:56 -0700)] 
Style file names in DWARF warnings

This patch adds filename styling, where appropriate, to warnings in
the DWARF reader.

I didn't think this was really worth writing tests for.

7 weeks agoDon't use .debug_names if .debug_aranges is missing
Tom Tromey [Tue, 27 Jan 2026 03:49:26 +0000 (20:49 -0700)] 
Don't use .debug_names if .debug_aranges is missing

gdb's .debug_names reader depends on .debug_aranges as well, because
if the ranges are missing, it won't be able to create a map from PC to
CU.

However, this requirement isn't enforced by gdb.  I no longer recall
know why, but I can see in commit b371f07c ("Rewrite .debug_names
reader") that I made this choice on purpose:

    In v1 of this patch, I made the new reader more strict about requiring
    .debug_aranges.  In v2, I've backed this out and kept the previous
    logic.  This solved a few test failures, though it's arguably not the
    right approach.

However, the current setup now seems clearly incorrect to me.  And, it
was causing problems for another patch I'm working on.

Fixing this required patching a few tests to add a .debug_aranges
section.  I've also updated the intro comment to
read_addrmap_from_aranges to reflect how it ought to be used.

Regression tested on x86-64 Fedora 41 with both the default and the
cc-with-debug-names target boards.

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

7 weeks agoChange have_*_symbols functions to methods of program_space
Tom Tromey [Fri, 13 Feb 2026 00:13:15 +0000 (17:13 -0700)] 
Change have_*_symbols functions to methods of program_space

This changes the have_*_symbols functions to be methods of
program_space.  This version also renames the methods to use "has_"
rather than "have_".

Approved-By: Simon Marchi <simon.marchi@efficios.com>
7 weeks agoUse std::optional in entry_point_address_query
Tom Tromey [Thu, 12 Feb 2026 23:57:40 +0000 (16:57 -0700)] 
Use std::optional in entry_point_address_query

This changes entry_point_address_query to return a std::optional.

Approved-By: Simon Marchi <simon.marchi@efficios.com>