]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
6 days agostrip: Don't check target_defaulted in input BFD
H.J. Lu [Wed, 30 Jul 2025 15:53:11 +0000 (08:53 -0700)] 
strip: Don't check target_defaulted in input BFD

The target_defaulted field in BFD is set to true if the target isn't
specified.  After

commit 717a38e9a02109fcbcb18bb2ec3aa251e2ad0a0d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun May 4 05:12:46 2025 +0800

    strip: Add GCC LTO IR support

the target is set to "plugin" if BFD supports plugin when the target
isn't specified nor default.  Update strip to check the input target,
instead of the target_defaulted field in input BFD.

PR binutils/33230
* objcopy.c (copy_object): Add a bool argument, target_defaulted,
to indicate if the input target isn't specified nor default.
Check it instead of ibfd->target_defaulted.
(copy_archive): Add a bool argument, target_defaulted, and pass
it to copy_object.
(copy_file): Set target_defaulted to true if the input target
isn't specified and pass it to copy_archive and copy_object.
* testsuite/binutils-all/x86-64/pr33230.obj.bz2: New file.
* testsuite/binutils-all/x86-64/x86-64.exp: Run PR binutils/33230
tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
6 days agoAutomatic date update in version.in
GDB Administrator [Thu, 31 Jul 2025 00:01:35 +0000 (00:01 +0000)] 
Automatic date update in version.in

7 days agoPR 33229 nds32 gas segfaults on gcc output
Alan Modra [Tue, 29 Jul 2025 22:48:19 +0000 (08:18 +0930)] 
PR 33229 nds32 gas segfaults on gcc output

Commit 1ac26e9f7ac2 replaced ISSPACE with is_whitespace, but the
former returns true on EOL while the latter does not.  Sprinkle
is_end_of_stmt tests to fix this bug.

The same segfault can be triggered by a ".relax_hint" with no
following instructions.  Fix that too.

* config/tc-nds32.c (nds32_lookup_pseudo_opcode): Use
is_end_of_stmt along with is_whitespace.
(nds32_relax_relocs, nds32_relax_hint, nds32_flag),
(ict_model: Likewise.
(nds32_elf_append_relax_relocs): Return on no opcode.
* testsuite/gas/nds32/nds32.exp: Find .d files automatically.
* testsuite/gas/nds32/pr33229.d,
* testsuite/gas/nds32/pr33229.s: New test.

7 days agoAutomatic date update in version.in
GDB Administrator [Wed, 30 Jul 2025 00:01:44 +0000 (00:01 +0000)] 
Automatic date update in version.in

7 days agoppc _bfd_clear_contents
Alan Modra [Tue, 29 Jul 2025 01:16:04 +0000 (10:46 +0930)] 
ppc _bfd_clear_contents

ppc32 isn't susceptible to the PR33223 segfault, but could hit a
_bfd_clear_contents segfault with a carefully crafted invalid object.

* elf32-ppc.c (ARRAY_SIZE): Define.
(ppc_elf_howto_init): Use ARRAY_SIZE.
(ppc_elf_reloc_name_lookup): Likewise.
(ppc_elf_info_to_howto): Likewise, and consolidate error
handling.
(ppc_elf_check_relocs): Guard against segfaults caused by a NULL
howto passed to _bfd_clear_contents.  Use ARRAY_SIZE.

7 days agoPR 33223 ppc64: segfault on unknown relocation
Alan Modra [Tue, 29 Jul 2025 01:09:51 +0000 (10:39 +0930)] 
PR 33223 ppc64: segfault on unknown relocation

Bounds check accesses to ppc64_elf_howto_table and don't dereference a
NULL howto.  I think this catches all cases where that might happen.

PR 33223
bfd/
* elf64-ppc.c (ppc64_elf_info_to_howto): Consolidate error handling.
(ppc64_elf_check_relocs): Tidy error messages.
(ppc64_elf_relocate_section): Don't segfault when attempting to
report an unsupported relocation.  Don't pass a NULL howto to
_bfd_clear_contents.
ld/
* testsuite/ld-powerpc/elfv2-2so.d: Adjust to suit error message
change.

8 days agold: testsuite: Enable ld-elfweak tests on Solaris/x86
Rainer Orth [Tue, 29 Jul 2025 07:45:45 +0000 (09:45 +0200)] 
ld: testsuite: Enable ld-elfweak tests on Solaris/x86

The ld-elfweak tests are currently only enabled on Solaris/SPARC for no
apparent reason.  Enabling them on Solaris in general lets them all PASS
on both amd64-pc-solaris2.11 and i386-pc-solaris2.11.

2025-07-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

ld:
* testsuite/ld-elfweak/elfweak.exp: Enable on *-*-solaris2* rather
than sparc*-*-solaris2* only.

8 days agoAutomatic date update in version.in
GDB Administrator [Tue, 29 Jul 2025 00:01:56 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 days agold: testsuite: Fix "PR ld/28138 (build only)" on Solaris
Rainer Orth [Mon, 28 Jul 2025 21:00:26 +0000 (23:00 +0200)] 
ld: testsuite: Fix "PR ld/28138 (build only)" on Solaris

The

FAIL: PR ld/28138 (build only)

test FAILs on Solaris:

ld/tmpdir/ld/collect-ld: plugin framework: out of file descriptors. Try using fewer objects/archives

ld/tmpdir/ld/collect-ld: cannot find -lgcc: Too many open files
[...]

I found that the test PASSes when using ulimit -n 21 instead of the
current 20.  Looking with strace/truss, on Linux/i686 the following
files are opened:

301543 openat(AT_FDCWD, "tmpdir/pr28138", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
301543 openat(AT_FDCWD, "/lib/../lib32/crt1.o", O_RDONLY|O_LARGEFILE) = 4
301543 openat(AT_FDCWD, "/lib/../lib32/crt1.o", O_RDONLY|O_LARGEFILE) = 5
301543 openat(AT_FDCWD, "/lib/../lib32/crti.o", O_RDONLY|O_LARGEFILE) = 5
301543 openat(AT_FDCWD, "/lib/../lib32/crti.o", O_RDONLY|O_LARGEFILE) = 6
301543 openat(AT_FDCWD, "lib/gcc/i686-pc-linux-gnu/12.1.0/crtbegin.o", O_RDONLY|O_LARGEFILE) = 6
301543 openat(AT_FDCWD, "lib/gcc/i686-pc-linux-gnu/12.1.0/crtbegin.o", O_RDONLY|O_LARGEFILE) = 7
301543 openat(AT_FDCWD, "tmpdir/pr28138.o", O_RDONLY|O_LARGEFILE) = 7
301543 openat(AT_FDCWD, "tmpdir/pr28138.o", O_RDONLY|O_LARGEFILE) = 8
301543 openat(AT_FDCWD, "tmpdir/pr28138.a", O_RDONLY|O_LARGEFILE) = 8
301543 openat(AT_FDCWD, "tmpdir/pr28138.a", O_RDONLY|O_LARGEFILE) = 9
301543 openat(AT_FDCWD, "tmpdir/pr28138-7.o", O_RDONLY|O_LARGEFILE) = 9
301543 openat(AT_FDCWD, "tmpdir/pr28138-7.o", O_RDONLY|O_LARGEFILE) = 10
301543 openat(AT_FDCWD, "tmpdir/pr28138-6.o", O_RDONLY|O_LARGEFILE) = 10
301543 openat(AT_FDCWD, "tmpdir/pr28138-6.o", O_RDONLY|O_LARGEFILE) = 11
301543 openat(AT_FDCWD, "tmpdir/pr28138-5.o", O_RDONLY|O_LARGEFILE) = 11
301543 openat(AT_FDCWD, "tmpdir/pr28138-5.o", O_RDONLY|O_LARGEFILE) = 12
301543 openat(AT_FDCWD, "tmpdir/pr28138-4.o", O_RDONLY|O_LARGEFILE) = 12
301543 openat(AT_FDCWD, "tmpdir/pr28138-4.o", O_RDONLY|O_LARGEFILE) = 13
301543 openat(AT_FDCWD, "tmpdir/pr28138-3.o", O_RDONLY|O_LARGEFILE) = 13
301543 openat(AT_FDCWD, "tmpdir/pr28138-3.o", O_RDONLY|O_LARGEFILE) = 3
301543 openat(AT_FDCWD, "tmpdir/pr28138-2.o", O_RDONLY|O_LARGEFILE) = 3
301543 openat(AT_FDCWD, "tmpdir/pr28138-2.o", O_RDONLY|O_LARGEFILE) = 4
301543 openat(AT_FDCWD, "tmpdir/pr28138-1.o", O_RDONLY|O_LARGEFILE) = 4
301543 openat(AT_FDCWD, "tmpdir/pr28138-1.o", O_RDONLY|O_LARGEFILE) = 5

while on Solaris/i386 there are a couple more:

27726: openat64(AT_FDCWD, "tmpdir/pr28138", O_RDWR|O_CREAT|O_TRUNC, 0666) = 4
27726: openat64(AT_FDCWD, "/usr/lib/crt1.o", O_RDONLY) = 5
27726: openat64(AT_FDCWD, "/usr/lib/crt1.o", O_RDONLY) = 6
27726: openat64(AT_FDCWD, "lib/gcc/i386-pc-solaris2.11/14.2.0/crtp.o", O_RDONLY) = 6
27726: openat64(AT_FDCWD, "lib/gcc/i386-pc-solaris2.11/14.2.0/crtp.o", O_RDONLY) = 7
27726: openat64(AT_FDCWD, "/usr/lib/crti.o", O_RDONLY) = 7
27726: openat64(AT_FDCWD, "/usr/lib/crti.o", O_RDONLY) = 8
27726: openat64(AT_FDCWD, "/usr/lib/values-Xa.o", O_RDONLY) = 8
27726: openat64(AT_FDCWD, "/usr/lib/values-Xa.o", O_RDONLY) = 9
27726: openat64(AT_FDCWD, "/usr/lib/values-xpg6.o", O_RDONLY) = 9
27726: openat64(AT_FDCWD, "/usr/lib/values-xpg6.o", O_RDONLY) = 10
27726: openat64(AT_FDCWD, "lib/gcc/i386-pc-solaris2.11/14.2.0/crtbegin.o", O_RDONLY) = 10
27726: openat64(AT_FDCWD, "lib/gcc/i386-pc-solaris2.11/14.2.0/crtbegin.o", O_RDONLY) = 11
27726: openat64(AT_FDCWD, "tmpdir/pr28138.o", O_RDONLY) = 11
27726: openat64(AT_FDCWD, "tmpdir/pr28138.o", O_RDONLY) = 12
27726: openat64(AT_FDCWD, "tmpdir/pr28138.a", O_RDONLY) = 12
27726: openat64(AT_FDCWD, "tmpdir/pr28138.a", O_RDONLY) = 13
27726: openat64(AT_FDCWD, "tmpdir/pr28138-7.o", O_RDONLY) = 13
27726: openat64(AT_FDCWD, "tmpdir/pr28138-7.o", O_RDONLY) = 14
27726: openat64(AT_FDCWD, "tmpdir/pr28138-6.o", O_RDONLY) = 14
27726: openat64(AT_FDCWD, "tmpdir/pr28138-6.o", O_RDONLY) = 15
27726: openat64(AT_FDCWD, "tmpdir/pr28138-5.o", O_RDONLY) = 15
27726: openat64(AT_FDCWD, "tmpdir/pr28138-5.o", O_RDONLY) = 16
27726: openat64(AT_FDCWD, "tmpdir/pr28138-4.o", O_RDONLY) = 16
27726: openat64(AT_FDCWD, "tmpdir/pr28138-4.o", O_RDONLY) = 17
27726: openat64(AT_FDCWD, "tmpdir/pr28138-3.o", O_RDONLY) = 17
27726: openat64(AT_FDCWD, "tmpdir/pr28138-3.o", O_RDONLY) = 18
27726: openat64(AT_FDCWD, "tmpdir/pr28138-2.o", O_RDONLY) = 18
27726: openat64(AT_FDCWD, "tmpdir/pr28138-2.o", O_RDONLY) = 19
27726: openat64(AT_FDCWD, "tmpdir/pr28138-1.o", O_RDONLY) = 19
27726: openat64(AT_FDCWD, "tmpdir/pr28138-1.o", O_RDONLY) Err#24 EMFILE

While it seems weird that the same files are opened twice for reading,
it's no wonder that 20 fds aren't enough on Solaris.

To avoid this, I've raised the limit to 25, hoping that this will be
enough on more targets.

Tested on i386-pc-solaris2.11 and i686-pc-linux-gnu.

2025-07-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

ld:
* testsuite/ld-plugin/lto.exp (PR ld/28138 test): Raise fd limit
to 25.

8 days agoAdd forgotten ChangeLog entry for commit 7c1c13e896c76879bcf3fb29332e0a59918bc9e0.
Rainer Orth [Mon, 28 Jul 2025 18:50:07 +0000 (20:50 +0200)] 
Add forgotten ChangeLog entry for commit 7c1c13e896c76879bcf3fb29332e0a59918bc9e0.

8 days agold: testsuite: Skip "Run with libpr19553c.so" test on Solaris
Rainer Orth [Mon, 28 Jul 2025 13:34:12 +0000 (15:34 +0200)] 
ld: testsuite: Skip "Run with libpr19553c.so" test on Solaris

The

FAIL: Run with libpr19553c.so

test FAILs on Solaris (32 and 64-bit, sparc and x86):

Running: tmpdir/pr19553c > tmpdir/pr19553c.out
diff tmpdir/pr19553c.out /vol/src/gnu/binutils/hg/master/local/ld/testsuite/ld-elf/pr19553c.out
1c1
< pr19553b
---
> pr19553c
child process exited abnormally

The test uses .symver, resulting in versioned symbols which the Solaris
ld.so.1 doesn't support and never will.  Running it with LD_DEBUG=all
shows

26493: 1: symbol=foo;  lookup in file=tmpdir/pr19553c  [ ELF ]
26493: 1: symbol=foo;  lookup in file=tmpdir/libpr19553c.so  [ ELF ]
26493: 1: symbol=foo;  skipping entry in file=tmpdir/libpr19553c.so, index[7], version=FOO, due to GNU version hidden bit
26493: 1: symbol=foo;  continuing lookup in file=tmpdir/libpr19553c.so  [ ELF ]
26493: 1: symbol=foo;  lookup in file=tmpdir/libpr19553b.so  [ ELF ]
26493: 1: binding file=tmpdir/pr19553c to file=tmpdir/libpr19553b.so: symbol 'foo'

so this patch skips the test.

2025-07-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

ld:
* testsuite/ld-elf/indirect.exp (Run with libpr19553c.so):
Skip on *-*-solaris2*.

8 days agoAvoid timeouts with gnat-llvm in gdb.ada/operator_call.exp
Tom Tromey [Mon, 28 Jul 2025 13:17:09 +0000 (07:17 -0600)] 
Avoid timeouts with gnat-llvm in gdb.ada/operator_call.exp

While working on gnat-llvm, gdb.ada/operator_call.exp has many
timeouts.  This happens because gnat-llvm's DWARF output is still
incomplete, and so gdb emits an unexpected error in this test.

This patch improves the test by having it recognize this output and
issue a failure rather than a timeout.  This greatly speeds up
testing.

8 days agolibctf: link: rejig lazy opening to not need weak symbols
Nick Alcock [Wed, 23 Jul 2025 13:20:26 +0000 (14:20 +0100)] 
libctf: link: rejig lazy opening to not need weak symbols

The ctf_link_add_ctf API function has a 'lazy opening' feature whereby,
if you pass in the file but not a CTF archive, the archive is opened
as late as possible during links.  This is valuable mostly in
cu-mapped links (a feature not accessible via GNU ld), where it
ensures that, rather than eventually needing memory for the original
link inputs, the smushed-together cu-mapped intermediate outputs,
*and* the final output, we only need enough memory for the smushed-
together outputs, the final output, and one input, since the inputs
can be closed immediately after they are smushed together.

(In GNU ld, the feature is useless because it loads all sections into
memory anyway.)

The lazy-opening feature uses libctf's ctf_open function, which uses
BFD: so it is not available in libctf-nobfd -- except that I thought I
had a cunning trick, and used a weak symbol so that if you linked
libctf-nobfd into your program and then also linked in bfd, the feature
stayed enabled.

This is silly -- if your program is licensed such that you can link in
BFD, you can just link in libctf.so and not bother with libctf-nobfd.so
in the first place.  Worse, the weak symbol usage broke MacOS builds,
since MacOS's system compiler uses a different means of introducing weak
symbols.  We could test for and use it, but this is the only place in
libctf to use weak symbols at all, and the feature of lazy-opening with
libctf-nobfd is so marginal we might as well drop it: it's almost
certain there are zero users, certainly fewer users than users of MacOS
with the system compiler.

While we're at it, simplify things by deleting the never-implemented
feature (not exposed in the API) to allow linking together raw buffers
of CTF data.  If we need it we can bring it back, but all it's doing
right now is complicating the code to no end at all.

libctf/
PR libctf/33194
* ctf-link.c (ctf_open): Delete weak pragma.
(ctf_link_add): Fuse with...
(ctf_link_add_ctf): ... this function.  Drop BUF, N args
and corresponding unimplemented feature warnings.  Only check
NOBFD to see whether lazy loading is available, not PIC as
well.
(ctf_link_lazy_open): Likewise.

8 days agogas: add missing header guard in tc-<arch>.h files
Matthieu Longo [Mon, 14 Jul 2025 14:18:02 +0000 (15:18 +0100)] 
gas: add missing header guard in tc-<arch>.h files

This patch adds missing header guards in some of the tc-<arch>.h,
and merely comments on the corresponding #endif for others. The
patch does not aim at being exhaustive, it only touched the files
relevant for [1].

[1]: https://inbox.sourceware.org/binutils/20250711112913.2453285-1-matthieu.longo@arm.com/

9 days agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Jul 2025 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

10 days agoUpdate release documentation following 2.45 release
Nick Clifton [Sun, 27 Jul 2025 09:55:33 +0000 (10:55 +0100)] 
Update release documentation following 2.45 release

10 days agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Jul 2025 00:02:09 +0000 (00:02 +0000)] 
Automatic date update in version.in

11 days agodoc: sframe: mention errata 1 of SFrame version 2
Indu Bhagat [Sat, 26 Jul 2025 06:38:40 +0000 (23:38 -0700)] 
doc: sframe: mention errata 1 of SFrame version 2

With the changes of an added flag SFRAME_F_FDE_FUNC_START_PCREL, s390x
support and new section type SHT_GNU_SFRAME, indicate that this document
specifies the errata 1 of SFrame version 2.  This will help distinguish
the document / specification better from previous releases.

libsframe/doc/
* sframe-spec.texi: Mention errata 1 of SFrame version 2.

11 days agoAutomatic date update in version.in
GDB Administrator [Sat, 26 Jul 2025 00:01:53 +0000 (00:01 +0000)] 
Automatic date update in version.in

11 days agoPR 33214 sparc LDM/STM/LDMA/STMA etc. FAIL on Solaris/SPARC
Alan Modra [Fri, 25 Jul 2025 22:15:54 +0000 (07:45 +0930)] 
PR 33214 sparc LDM/STM/LDMA/STMA etc. FAIL on Solaris/SPARC

Delete code in compare_opcodes preferencing 1+i over i+1 and 1,i over
i,1.  Instead simply make the sort stable, by keeping the original
table order.

11 days ago[gdb/tui] Fix shell command terminal settings
Tom de Vries [Fri, 25 Jul 2025 17:07:59 +0000 (19:07 +0200)] 
[gdb/tui] Fix shell command terminal settings

In bash I have the following terminal settings:
...
$ stty
speed 38400 baud; line = 0;
-brkint -imaxbel iutf8
...
and then in gdb using the shell command likewise:
...
(gdb) shell stty
speed 38400 baud; line = 0;
-brkint -imaxbel iutf8
(gdb)
...
and likewise using a shell session:
...
(gdb) shell
$ stty
speed 38400 baud; line = 0;
-brkint -imaxbel iutf8
$
...

But in TUI, we get different settings (removed runaway indentation for
readability):
...
(gdb) shell sttyspeed 38400 baud; line = 0;
min = 1; time = 0;
-brkint -icrnl -imaxbel iutf8
-onlcr
-icanon -echo

(gdb)
...
and consequently the shell is not really usable.  This is PR tui/18215.

The easiest way to fix this is to just temporarily leave TUI while in the shell,
leaving the output of the commands in CLI mode, but that's a bit confusing.

Fix this (as suggested in the PR) by restoring the initial terminal settings
while in the shell command, such that also in TUI we have:
...
(gdb) shell sttyspeed 38400 baud; line = 0;
-brkint -imaxbel iutf8

(gdb)
...

Tested on x86_64-linux.

Reported-By: Doug Evans <dje@google.com>
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=18215

11 days agogdb: Convert gdb/mingw-hdep.c to INIT_GDB_FILE
Pedro Alves [Fri, 25 Jul 2025 16:43:52 +0000 (17:43 +0100)] 
gdb: Convert gdb/mingw-hdep.c to INIT_GDB_FILE

I noticed that my MinGW GDB did not have the "maint set
console-translation-mode" command, even though the code to register it
is in gdb/mingw-hdep.c.

The problem is that gdb/mingw-hdep.c is not using INIT_GDB_FILE.  This
fixes it.

Change-Id: I3aa305c517e100d4733b391a110a1b20b89fdb7f

11 days agogdb: use the location_completer for the list command
Guinevere Larsen [Wed, 23 Jul 2025 12:06:22 +0000 (09:06 -0300)] 
gdb: use the location_completer for the list command

The "location_completer" function has been available for a long time,
but it was seemingly never used as the completer for the list function.
A quick check through git history shows that a similar completer was
available for the "edit" command but wasn't added to "list" with no
reasoning for it.

I think "list" should use the location_completer, as it is more aware of
the locspec grammar.

Approved-By: Tom Tromey <tom@tromey.com>
11 days agogdb: fix copyright year in svr4-tls-tdep.c
Simon Marchi [Fri, 25 Jul 2025 16:19:26 +0000 (12:19 -0400)] 
gdb: fix copyright year in svr4-tls-tdep.c

Change-Id: Ia03b286d9544a209197e58e59e752dc3d2715359

11 days agogdb: fix copyright year in solib-frv.h
Simon Marchi [Fri, 25 Jul 2025 16:16:55 +0000 (12:16 -0400)] 
gdb: fix copyright year in solib-frv.h

My mistake, I forgot to update this when merging my patch series.

Change-Id: I67691c962d91221bd9a684febd7296b4b9b5999f

11 days agogdb/dwarf: apply DW_AT_bit_offset when DW_AT_data_member_location is constant block
Simon Marchi [Tue, 8 Jul 2025 19:52:37 +0000 (15:52 -0400)] 
gdb/dwarf: apply DW_AT_bit_offset when DW_AT_data_member_location is constant block

Since commit 420d030e88 ("Handle field with dynamic bit offset"), I see:

    $ make check TESTS="gdb.trace/unavailable-dwarf-piece.exp" RUNTESTFLAGS="--target_board=native-extended-gdbserver"
    FAIL: gdb.trace/unavailable-dwarf-piece.exp: tracing bar: p/d x
    FAIL: gdb.trace/unavailable-dwarf-piece.exp: tracing bar: p/d y
    FAIL: gdb.trace/unavailable-dwarf-piece.exp: tracing bar: p/d z

The first FAIL is:

    p/d x
    $4 = {a = 0, b = <unavailable>, c = <unavailable>, d = <unavailable>, e = <unavailable>, f = <unavailable>, g = <unavailable>, h = <unavailable>, i = <unavailable>, j = 0}
    (gdb) FAIL: gdb.trace/unavailable-dwarf-piece.exp: tracing bar: p/d x

When we should see:

    p/d x
    $4 = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}
    (gdb) PASS: gdb.trace/unavailable-dwarf-piece.exp: tracing bar: p/d x

The structure we print is:

    0x0000004f:   DW_TAG_structure_type
                    DW_AT_name [DW_FORM_string]     ("t")
                    DW_AT_byte_size [DW_FORM_sdata] (3)
                    DW_AT_decl_file [DW_FORM_udata] (0)
                    DW_AT_decl_line [DW_FORM_udata] (1)

    0x00000055:     DW_TAG_member
                      DW_AT_name [DW_FORM_string]   ("a")
                      DW_AT_type [DW_FORM_ref4]     (0x00000019 "unsigned char")
                      DW_AT_data_member_location [DW_FORM_exprloc]  (DW_OP_plus_uconst 0x0)

    0x0000005f:     DW_TAG_member
                      DW_AT_name [DW_FORM_string]   ("b")
                      DW_AT_type [DW_FORM_ref4]     (0x00000019 "unsigned char")
                      DW_AT_byte_size [DW_FORM_sdata]       (1)
                      DW_AT_bit_size [DW_FORM_sdata]        (1)
                      DW_AT_bit_offset [DW_FORM_sdata]      (7)
                      DW_AT_data_member_location [DW_FORM_exprloc]  (DW_OP_plus_uconst 0x1)

    ...

The particularity of field "b" (and the following ones, not shown here)
is that they have:

 - a DW_AT_data_member_location of expression form, but that GDB reduces
   to a constant
 - a DW_AT_bit_offset

What I think happens is that the code path taken in this particular
scenario never ends up using the DW_AT_bit_offset value.  Fix it by
calling apply_bit_offset_to_field, like what is done when
data_member_location_attr is using a constant form.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33136
Change-Id: I18e838e6c56a548495d3af332aeff3051188eaa9
Approved-By: Tom Tromey <tom@tromey.com>
11 days agogdb/dwarf: rename some variables in handle_member_location
Simon Marchi [Tue, 8 Jul 2025 19:52:36 +0000 (15:52 -0400)] 
gdb/dwarf: rename some variables in handle_member_location

For legibility, use more specific names for attribute variables and
don't reuse them for different attributes.

Change-Id: I98d8bb32fc64b5f6357fbc88f6fe93f2ddc8ef7c
Approved-By: Tom Tromey <tom@tromey.com>
12 days agogas/NEWS: Add AArch64 updates
Alice Carlotti [Thu, 24 Jul 2025 17:49:36 +0000 (18:49 +0100)] 
gas/NEWS: Add AArch64 updates

12 days agogas/doc: Update AArch64 Architecture Extensions
Alice Carlotti [Thu, 24 Jul 2025 16:15:43 +0000 (17:15 +0100)] 
gas/doc: Update AArch64 Architecture Extensions

Add faminmax, move a couple of misplaced entries, and improve a few
other entries.

The documentation now lists every recognised extension name, with the
exception of a couple of aliases that are deliberately undocumented.

12 days agoaarch64: Fix sve2p2/sme2p2 dependencies
Alice Carlotti [Thu, 24 Jul 2025 15:04:04 +0000 (16:04 +0100)] 
aarch64: Fix sve2p2/sme2p2 dependencies

Change dependency on sve2/sme2 to sve2p1/sme2p1.

12 days agogas: sframe: command line option takes precedence
Indu Bhagat [Fri, 25 Jul 2025 08:47:20 +0000 (01:47 -0700)] 
gas: sframe: command line option takes precedence

over gas directive to emit .sframe section.

Fix PR gas/33175 sframe: --gsframe=no does not disable when
.cfi_sections directive with .sframe

--gsframe=no should also disable generation of SFrame section when
explicit CFI directive:
  .cfi_sections .sframe
is specified in the input.  This means we need to track whether SFrame
generation was explicitly disabled by the user.  Introduce a new enum to
facilitate disambiguation between GEN_SFRAME_DEFAULT_NONE and
GEN_SFRAME_DISABLED.

While fixing the bug by adding the enum, keep the upcoming requirement
in mind: we will also need to disambiguate between
--enable-default-sframe and user-specified --gsframe/--gsframe=yes.  The
intent is to not display SFrame related warnings or errors like:

  as_bad (_(".sframe not supported for target"));

for unsupported targets if --enable-default-sframe is in effect.

This implies we need to have a four state enum (
GEN_SFRAME_DEFAULT_NONE, GEN_SFRAME_CONFIG_ENABLED,
GEN_SFRAME_DISABLED, GEN_SFRAME_ENABLED)

gas/
PR gas/33175
* dw2gencfi.c (cfi_finish): Check state of flag_gen_sframe to
determine whether any SFrame section is generated.
* as.h (enum gen_sframe_option): New definition.
* as.c (parse_args): Keep track of whether the flag is
explicitly enabled or disabled

gas/testsuite/
PR gas/33175
* gas/cfi-sframe/cfi-sframe-common-1.d: Remove redundant
--gsframe.
* gas/cfi-sframe/cfi-sframe.exp:  Add new test.
* gas/cfi-sframe/cfi-sframe-common-1c.d: New test.  No SFrame
section if explicit --gsframe=no.
* gas/cfi-sframe/cfi-sframe-common-1c.s: New test.

12 days agoreadelf: objdump: sframe: fix dumping with section name
Indu Bhagat [Sat, 19 Jul 2025 08:41:27 +0000 (01:41 -0700)] 
readelf: objdump: sframe: fix dumping with section name

Fix PR binutils/33186 - No SFrame dump if section name is not .sframe

When the section name is not ".sframe", ensure that readelf and objdump
are able to dump a section of type SHT_GNU_SFRAME and not fail if the
user specifies the new section name.

For objdump, in dump_dwarf_section (), use the match string of ".sframe"
to find the corresponding debug_displays[] item for SFrame section.
Doing this ensures that any call to dump_dwarf_section () with the
section pointing to the SFrame section (with name possibly different
from ".sframe") will successfully dump the SFrame section.

If the SFrame section is named anything but ".sframe", and user does not
specify the name of the SFrame section either, the documented behaviour
is that the default section name is assumed to be ".sframe".  So the
following (albeit counter intuitive) is expected at this time:

$ readelf -S sort | grep sframe
  [NN] .sframe2          GNU_SFRAME       0000000000NNNNNN  0000NNNN

(Note section name .sframe2).

$ objdump --sframe sort

sort:     file format elf64-x86-64

No .sframe section present

(Similarly for readelf as well).

For objdump, set dump_sframe_section_name to ".sframe" if user specifies
no section name.  In the error checking done in dump_sframe_section, add
the case when user specifies a valid section name but one that does not
contain SFrame section data.  For sections generated with Binutils >=
2.45, this can be checked with section type of SHT_GNU_SFRAME.
Previously these sections were SHT_PROGBITS with name ".sframe".

Similar changes in readelf.

Add a test each for objdump and readelf to dump a renamed section.  Use
gas_sframe_check to limit the execution of these tests only when a gas
supporting SFrame format is present.

binutils/
PR binutils/33186
* objdump.c (dump_dwarf_section): Set match to ".sframe" which
corresponds to the name in the debug_displays[] entry for
SFrame section.
(dump_sframe_section): Check if the user specified section name
contains SFrame data.
(main): Set default section name to ".sframe".
* readelf.c (display_debug_section): Adjust checks to find the
debug_diplays[] item for the input arg SFrame section.
Use id instead of i, as it is more readable.

binutils/testsuite/
PR binutils/33186
* binutils-all/x86-64/objdump-sframe-01.d: New test.
* binutils-all/x86-64/readelf-sframe-01.d: New test.
* binutils-all/x86-64/sframe-func.s: New test.

12 days agold: Force SHELL=/bin/bash in ld for Solaris [PR32580]
Rainer Orth [Fri, 25 Jul 2025 07:49:13 +0000 (09:49 +0200)] 
ld: Force SHELL=/bin/bash in ld for Solaris [PR32580]

As described in PR ld/32580, when using SHELL=/bin/sh or /bin/ksh on
Solaris, the generated linker scripts get corrupted.  So far, the only
workaround is to enforce /bin/bash instead.

This is a major nuisance for developers and users alike, so this patch
automates this by overriding SHELL in ld/configure.ac.

Tested on amd64-pc-solaris2.11 in three configurations:

* CONFIG_SHELL unset

* CONFIG_SHELL=/bin/ksh

* CONFIG_SHELL='/bin/bash --norc'

In the first two cases, SHELL was set to /bin/bash as desired, while in
the third it was left unchanged.

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

ld:
PR ld/32580
* configure.ac <*-*-solaris2*>: Enforce SHELL=/bin/bash.
* configure: Regenerate.

12 days agoPR 33210 NULL pointer arithmetic in coffcode.h
Alan Modra [Thu, 24 Jul 2025 23:18:20 +0000 (08:48 +0930)] 
PR 33210 NULL pointer arithmetic in coffcode.h

Fix ubsan "runtime error: applying zero offset to null pointer".

12 days agoAutomatic date update in version.in
GDB Administrator [Fri, 25 Jul 2025 00:01:34 +0000 (00:01 +0000)] 
Automatic date update in version.in

12 days agostrip: Properly handle LLVM IR bitcode
H.J. Lu [Tue, 22 Jul 2025 21:09:48 +0000 (14:09 -0700)] 
strip: Properly handle LLVM IR bitcode

commit 717a38e9a02109fcbcb18bb2ec3aa251e2ad0a0d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun May 4 05:12:46 2025 +0800

    strip: Add GCC LTO IR support

added "-R .gnu.lto_.*" to strip to remove all GCC LTO sections.  When
"-R .gnu.lto_.*" is used, the plugin target is ignored so that all LTO
sections are stripped as the regular sections.  It works for the slim
GCC LTO IR since the GCC LTO IR is stored in the regular sections.  When
the plugin target is ignored, the GCC LTO IR can be recognized as the
normal object files.  But it doesn't work for the slim LLVM IR which
is stored in a standalone file.

1. Add bfd_check_format_matches_lto and bfd_check_format_lto to take an
argument, lto_sections_removed, to indicate if all LTO sections should
be removed.
2. Update strip to always enable the plugin target so that the plugin
target is enabled when checking for bfd_archive.
3. Update strip to ignore the plugin target for bfd_object when all LTO
sections should be removed.  If the object is unknown, copy it as an
unknown file without any messages.
4. Treat the "-R .llvm.lto" strip option as removing all LTO sections.

bfd/

PR binutils/33198
* format.c (bfd_check_format_lto): New function.
(bfd_check_format): Call bfd_check_format_matches_lto.
(bfd_check_format_matches): Renamed to ...
(bfd_check_format_matches_lto): This.  Add an argument,
lto_sections_removed, to indicate if all LTO sections should be
removed and don't match the plugin target if lto_sections_removed
is true.
(bfd_check_format_matches): Call bfd_check_format_matches_lto.
* bfd-in2.h: Regenerated.

binutils/

PR binutils/33198
* objcopy.c (copy_archive): Call bfd_check_format_lto, instead
of bfd_check_format, and pass lto_sections_removed.  Remove the
non-fatal message on unknown element since it will be copied as
an unknown file.
(copy_file): Don't check lto_sections_removed when enabling LTO
plugin in strip.
(copy_file): Ignore the plugin target first if all LTO sections
should be removed.  Try with the plugin target next if ignoring
the plugin target failed to match the format.
(strip_main): Also set lto_sections_removed for -R .llvm.lto.
* testsuite/binutils-all/x86-64/pr33198.c: New file.
* testsuite/binutils-all/x86-64/x86-64.exp (run_pr33198_test):
New.
Run binutils/33198 tests.
* testsuite/lib/binutils-common.exp (llvm_plug_opt): New.
(CLANG_FOR_TARGET): New.  Set to "clang" for native build if
"clang -v" reports "clang version".

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
13 days ago[gdb/testsuite] Add Term::get_string_with_attrs in tuiterm
Tom de Vries [Thu, 24 Jul 2025 10:06:40 +0000 (12:06 +0200)] 
[gdb/testsuite] Add Term::get_string_with_attrs in tuiterm

While reading a gdb.log for test-case gdb.tui/main-2.exp, I noticed that this
line was somewhat hard to read:
...
screen line 6: '<fg:cyan><intensity:bold>|<fg:default><intensity:normal>B+>    21 <reverse:1>  return 0;<reverse:0>                                                         <fg:cyan><intensity:bold>|<fg:default><intensity:normal>'
...
because of the border attributes.

Then I realized that the test-case is only interested in the text between the
borders, so I added a proc Term::get_string_with_attrs that allows me to drop
the borders, getting us instead:
...
screen line 6: 'B+>    21 <reverse:1>  return 0;<reverse:0>                                                         '
...

Tested on aarch64-linux.

13 days ago[gdb/testsuite] Use TERM=ansiw in tuiterm for bsd
Tom de Vries [Thu, 24 Jul 2025 09:48:29 +0000 (11:48 +0200)] 
[gdb/testsuite] Use TERM=ansiw in tuiterm for bsd

TERM=ansi is different on freebsd and linux.  Consequently, many TUI
test-cases (gdb.tui/*.exp and gdb.python/tui*.exp) fail on freebsd.

One of the problems is that send_gdb "<cmd>\r\n" is needed instead of
send_gdb "<cmd>\n".

This is because gdb_send "layout regs\n" translates to
"layout regs<KEY_DOWN>", which evidently missing the carriage return part.

While we can work around this, there are other problems.  There is no color
support, and the cursor keys fail to scroll the source window.

So I went looking for an alternative to TERM=ansi on freebsd, and came across
TERM=ansiw.  Using this didn't work out of the box, but with the fixes in
this series it now does.

I also briefly looked at TERM=ansis, which is interesting because it's
available on both linux and freebsd, but ansiw is a better choice for now.
I've filed PR33179 to document what I learned, with the aim to eventually
follow up and address two test-case failures with TERM=ansis on linux.

Tested on x86_64-freebsd.

13 days ago[gdb/testsuite] Log on return in Term::_log_cur
Tom de Vries [Thu, 24 Jul 2025 07:18:57 +0000 (09:18 +0200)] 
[gdb/testsuite] Log on return in Term::_log_cur

Proc Term::_log_cur logs the cursor update of code in its body argument:
...
    proc _ctl_0x08 {} {
        _log_cur "Backspace" {
            variable _cur_col

            if {$_cur_col > 0} {
                incr _cur_col -1
            }
        }
    }
...
giving us for instance:
...
+++ Backspace, cursor: (2, 0) -> (2, 0)
...

But if we rewrite the code to use a return:
...
    if { $_cur_col == 0 } {
return
    }
    incr _cur_col -1
...
and the return is triggered, the log message disappears.

Fix this by wrapping the "uplevel $body" in a catch:
...
- uplevel $body
+ set code [catch {uplevel $body} result]
...

Tested on aarch64-linux.

13 days agoAutomatic date update in version.in
GDB Administrator [Thu, 24 Jul 2025 00:03:51 +0000 (00:03 +0000)] 
Automatic date update in version.in

13 days agogold: configury: fix obsolete macros
Pietro Monteiro [Wed, 23 Jul 2025 23:49:50 +0000 (19:49 -0400)] 
gold: configury: fix obsolete macros

Running `autoreconf -vf -Wall' in the gold directory shows errors about the use
of obsolete macros.  This patch fix the issues with macros used directly by
configure.ac. However, it doesn't fix all warnings.  There are autoconf warnings
about macros from files in config and one automake warning about a target being
shadowed.  It cuts a lot of the noise down and makes an upgrade to autoconf
2.71+ easier.

https://www.gnu.org/software/automake/manual/1.12.2/html_node/Obsolete-Macros.html#index-AM_005fCONFIG_005fHEADER
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html#index-AC_005fOUTPUT-2133

gold/ChangeLog:

* aclocal.m4: Regenerate.
* configure: Regenerate.
* configure.ac: Replace AM_CONFIG_HEADER by AC_CONFIG_HEADERS. Replace
        AC_OUTPUT(file list) by AC_CONFIG_FILES([file list])\nAC_OUTPUT.

Approved-by: Alan Modra <amodra@gmail.com>
13 days ago[gdb/testsuite] Fix Term::_csi_m with no args
Tom de Vries [Wed, 23 Jul 2025 20:14:58 +0000 (22:14 +0200)] 
[gdb/testsuite] Fix Term::_csi_m with no args

When calling Term::_csi_m with no args, default behaviour needs to be applied,
which is equivalent to "Term::_csi_m 0" [1].

However, while "Term::_csi_m 0" works, as well as 'Term::_csi_m ""', calling
Term::_csi_m with no args has no effect.

Fix this by implementing the default behaviour in Term::_csi_m.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
[1] https://vt100.net/docs/vt510-rm/SGR.html

13 days ago[gdb/testsuite] Handle auto_left_margin in tuiterm
Tom de Vries [Wed, 23 Jul 2025 19:11:41 +0000 (21:11 +0200)] 
[gdb/testsuite] Handle auto_left_margin in tuiterm

The terminal capability bw (aka as auto_left_margin) controls whether a
backspace at the start of a line wraps to the last column of the previous
line.

For tuiterm, we use TERM=ansi, and on linux at least that capability is off.

Consequently the current implementation of Term::_ctl_0x08 doesn't wrap.

Add this capability in Term::_ctl_0x08, and add a unit test.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdbserver: use reference in range for loop
Simon Marchi [Wed, 23 Jul 2025 18:41:42 +0000 (14:41 -0400)] 
gdbserver: use reference in range for loop

The armhf buildbot fails to build GDB, with:

    ../../binutils-gdb/gdbserver/server.cc: In function ‘void handle_general_set(char*)’:
    ../../binutils-gdb/gdbserver/server.cc:1021:23: error: loop variable ‘<structured bindings>’ creates a copy from type ‘const std::pair<thread_info*, enum_flags<gdb_thread_option> >’ [-Werror=range-loop-construct]
     1021 |       for (const auto [thread, options] : set_options)
          |                       ^~~~~~~~~~~~~~~~~
    ../../binutils-gdb/gdbserver/server.cc:1021:23: note: use reference type to prevent copying
     1021 |       for (const auto [thread, options] : set_options)
          |                       ^~~~~~~~~~~~~~~~~
          |                       &

I did not use a reference on purpose, because the pair is very small.  I
don't see the problem when building on amd64, I presume it is because
the pair is considered too big to copy on a 32-bit architecture, but not
on a 64-bit architecture.

In any case, fix it by adding a reference.

Change-Id: I8e95235d6e53f032361950cf6e0c7d46b082f951

13 days ago[gdb/testsuite] Handle Horizontal Position Absolute in tuiterm
Tom de Vries [Wed, 23 Jul 2025 18:28:46 +0000 (20:28 +0200)] 
[gdb/testsuite] Handle Horizontal Position Absolute in tuiterm

I ran the tui testsuite on freebsd with TERM=ansiw, and investigated the first
failure, in test-case gdb.tui/tui-init-source.exp.

The problem turned out to be the lack of handling a Horizontal Position
Absolute [1] sequence "^[[80`" in tuiterm.

Add Term::_csi_`, forwarding to Term::_csi_G which handles Cursor Horizontal
Absolute [2].

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
[1] https://vt100.net/docs/vt510-rm/HPA.html
[2] https://vt100.net/docs/vt510-rm/CHA.html

13 days ago[gdb/testsuite] Fix Cursor Horizontal Absolute clipping
Tom de Vries [Wed, 23 Jul 2025 18:28:46 +0000 (20:28 +0200)] 
[gdb/testsuite] Fix Cursor Horizontal Absolute clipping

I looked at the tuiterm implementation of Cursor Horizontal Absolute:
...
    proc _csi_G {args} {
set arg [_default [lindex $args 0] 1]

_log_cur "Cursor Horizontal Absolute ($arg)" {
    variable _cur_col
    variable _cols

    set _cur_col [expr {min ($arg - 1, $_cols)}]
}
    }
...
and noticed a problem with the clipping behavior.

If we have say $_cols == 80, and we do _csi_G 81 we get $_cur_col == 80, while
$_cur_col is zero-based and should be in the 0..79 range.

Fix this by using:
...
    set _cur_col [expr {min ($arg, $_cols)} - 1]
...
which gets us $_cur_col == 79.

Add two boundary tests to gdb.tui/tuiterm.exp.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
13 days agogdb, gdbserver: use structured bindings in a few places
Simon Marchi [Wed, 9 Jul 2025 13:17:50 +0000 (09:17 -0400)] 
gdb, gdbserver: use structured bindings in a few places

I wanted to change one of these, so I searched for more similar
instances, while at it.  I think this looks a bit tidier, over unpacking
the pairs by hand.

Change-Id: Ife4b678f7a6aed01803434197c564d2ab93532a7
Approved-By: Tom Tromey <tom@tromey.com>
13 days agoPR 33197 [AVR] Incorrect syntax in generated ldscript
Alan Modra [Wed, 23 Jul 2025 12:22:31 +0000 (21:52 +0930)] 
PR 33197 [AVR] Incorrect syntax in generated ldscript

Rearrange scripttempl/avr.sc to avoid oddities of shells expanding
${RELOCATING+stuff} in here documents where "stuff" contains quoted
strings.  Also I think it is better to avoid multi-line "stuff" as it
can be tricky to spot the ending brace.

13 days agolibctf: don't run tests requiring deduplicating linker unless one is in use
Nick Alcock [Thu, 17 Jul 2025 16:45:02 +0000 (17:45 +0100)] 
libctf: don't run tests requiring deduplicating linker unless one is in use

Before now, we were relying on gcc -B to repoint GCC at our freshly-built
linker, and assuming we could use this to run tests that do linker dedup.

This is, alas, not reliable (building --with-ld=/an/absolute/path bypasses
-B searches for the linker), and we would like the libctf tests in
particular to not fail if the compiler uses a linker that cannot deduplicate
(simply skipping such tests).

Add a new testsuite function that tries to link one of the lookup tests'
testcases (which is known to produce conflicting types, i.e. a dict with
per-translation-unit children) and then does an objdump and greps it for
signs of the per-translation-unit children.  If there are none, the linker
probably just concatenated the sections: i.e., it is not a linker that
can deduplicate CTF.

libctf/
PR libctf/33162
* testsuite/config/default.exp (objdump): Introduce.
(OBJDUMPFLAGS): Likewise.
* testsuite/lib/ctf-lib.exp (check_ctf_linker_dedup): New.
* testsuite/libctf-lookup/lookup.exp: Use it.
* testsuite/libctf-regression/libctf-repeat-cu.exp: Likewise.
* testsuite/libctf-regression/regression.exp: Likewise.

13 days agolibctf: exclude always-emitted Solaris symbols from the symtypetab
Rainer Orth [Wed, 16 Jul 2025 15:55:51 +0000 (16:55 +0100)] 
libctf: exclude always-emitted Solaris symbols from the symtypetab

If we're skipping _BEGIN_ and _END_ we should certainly skip all the other
ABI-required always-emitted symbols given in ld/emultempl/solaris2*em as
well.  (This fixes a couple of diagnostics tests, but that's just because
the tests are quite sensitive to CTF section sizes, and introducing any
symtypetab entries for those tests perturbs those.)

Some of these are usually STT_NOTYPE, but not always: if programs already
emitted the symbol they might end up with any type, in particular
STT_OBJECT, and appear in the symtypetabs.

[nca: added commit log, added more symbols]

libctf/
PR libctf/33162
* ctf-serialize.c (ctf_symtab_skippable): Skip
more always-emitted Solaris symbols.

13 days agolibctf: get libctf-nobfd.ver from the right place with Solaris ld
Nick Alcock [Wed, 16 Jul 2025 13:43:25 +0000 (14:43 +0100)] 
libctf: get libctf-nobfd.ver from the right place with Solaris ld

We generate de-commented version scripts for Solaris ld (whose
-z gnu-version-script linker option does not support comments),
but after we switched to generating libctf-nobfd.ver itself, we
failed to adjust this code to pick it up from the new location.

libctf/
PR libctf/33161
* configure.ac: Fix libctf-nobfd.ver path on Solaris.
* configure: Regenerated.

13 days agolibctf: do not use mmap on Solaris 11
Rainer Orth [Wed, 16 Jul 2025 12:10:05 +0000 (13:10 +0100)] 
libctf: do not use mmap on Solaris 11

Writable mmaps and read are inconsistent with each other on Solaris 11.4,
which breaks archive writing.  Simply assert that Solaris 2.11 doesn't have
mmap, falling back to read(): the archive format is being bumped shortly, to
one with completely different writeout code, so this workaround need not
stay for long.

[nca: added commit log]

libctf/
PR libctf/29292
* configure.ac: Turn off mmap on Solaris 2.11.
* configure: Regenerated.

2 weeks agogas: sframe: fix PR gas/33170
Indu Bhagat [Thu, 17 Jul 2025 22:17:36 +0000 (15:17 -0700)] 
gas: sframe: fix PR gas/33170

SFrame generation code assumes that since DW_CFA_restore means
restoration of the state of the register to the one at the beginning of
the function, there must be a state to restore to (hence the gas_assert
(cie_fre)).

This assumption needs adjustment.  DW_CFA_restore may be present in the
very beginning of a (e.g., cold) function, with no initialized state for
SFrame functions to restore to.

gas/
PR gas/33170
* gas/gen-sframe.c (sframe_xlate_do_restore): Use current FRE if
CIE FRE is not yet setup.
gas/testsuite/
PR gas/33170
* gas/cfi-sframe/cfi-sframe.exp: New test.
* gas/cfi-sframe/cfi-sframe-x86_64-pr33170.d: New test.
* gas/cfi-sframe/cfi-sframe-x86_64-pr33170.s: New test.

2 weeks agoAutomatic date update in version.in
GDB Administrator [Wed, 23 Jul 2025 00:01:55 +0000 (00:01 +0000)] 
Automatic date update in version.in

2 weeks ago[gdb/testsuite] Modernize gdb.base/command-line-input.exp
Tom de Vries [Tue, 22 Jul 2025 20:26:05 +0000 (22:26 +0200)] 
[gdb/testsuite] Modernize gdb.base/command-line-input.exp

Modernize test-case gdb.base/command-line-input.exp using clean_restart,
multi_line and string_to_regexp.

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
2 weeks ago[gdb/cli] Clear line buffer on ^C
Tom de Vries [Tue, 22 Jul 2025 20:26:05 +0000 (22:26 +0200)] 
[gdb/cli] Clear line buffer on ^C

Gdb has the ability to gather input over several lines [1], for instance this:
...
(gdb) print 1
$1 = 1
(gdb)
...
can also be typed as:
...
(gdb) print\
 1
$2 = 1
(gdb)
...

Furthermore, if we type a command but change our mind, we can abort using ^C
and start over using a fresh gdb prompt [2]:
...
(gdb) print 1❌️ Quit
(gdb) echo 1\n
1
(gdb)
...

Now say we type a multi-line command but abort it, we get:
...
(gdb) print\
 1❌️ Quit
(gdb) echo 1\n
❌️ Undefined command: "printecho".  Try "help".
(gdb)
...

Using "set trace-commands on", we can see what happened:
...
+printecho 1\n
..

Gdb has prepended the first line of the cancelled multi-line command to the
following command.

Fix this by clearing current_ui->line_buffer on catching a gdb_exception in
start_event_loop.

Tested on x86_64-linux.

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

[1] https://sourceware.org/gdb/current/onlinedocs/gdb.html/Output.html
[2] https://sourceware.org/gdb/current/onlinedocs/gdb.html/Quitting-GDB.html

2 weeks agogdb: Remove redundant parameter for filename completion
Guinevere Larsen [Tue, 22 Jul 2025 14:35:15 +0000 (11:35 -0300)] 
gdb: Remove redundant parameter for filename completion

As I was working on an unrelated patch, I noticed that all calls to
make_source_files_completion_list had both parameters of the function
call being the same pointer.  I think we can remove that redundancy and
make that call with just one parameter.

Approved-By: Andrew Burgess <aburgess@redhat.com>
2 weeks agogdb/solib-svr4: fix indent
Simon Marchi [Tue, 22 Jul 2025 17:47:04 +0000 (13:47 -0400)] 
gdb/solib-svr4: fix indent

Change-Id: I63f78f359f55ec15fb3296a1a9ce28c9d01d663b

2 weeks agogdb: use skip_spaces in info_linker_namespace_command
Simon Marchi [Fri, 11 Jul 2025 17:22:23 +0000 (13:22 -0400)] 
gdb: use skip_spaces in info_linker_namespace_command

Change-Id: I02c7daed3740e319ee27d3512a2b941f666b103b
Approved-By: Andrew Burgess <aburgess@redhat.com>
2 weeks agogdb: fix formatting in solib.c
Simon Marchi [Fri, 11 Jul 2025 17:22:22 +0000 (13:22 -0400)] 
gdb: fix formatting in solib.c

I found these two small nits while working in this file.

Change-Id: Ibdaa57262f3fe363b039fbad746e285fa7b52f8b
Approved-By: Andrew Burgess <aburgess@redhat.com>
2 weeks agoUpdated translations for various sub-directories
Nick Clifton [Tue, 22 Jul 2025 14:58:21 +0000 (15:58 +0100)] 
Updated translations for various sub-directories

2 weeks agoRemove steps for adding .dirstamp when creating pre-release tarball
Nick Clifton [Tue, 22 Jul 2025 14:40:00 +0000 (15:40 +0100)] 
Remove steps for adding .dirstamp when creating pre-release tarball

2 weeks agold: Rename a file on Windows fails if target already exists
Torbjörn SVENSSON [Fri, 18 Jul 2025 15:04:09 +0000 (17:04 +0200)] 
ld: Rename a file on Windows fails if target already exists

To rename a file on Windows, the target name cannot exist. Removing file
prior to renaming ensures this is handled.
To remove a file on Windows, the file cannot be open. Closing the bfd
handle ensures this is handled.
Moved call to free on isympp / osympp to after bfd is closed to align
with comment earlier in the cmdline_add_object_only_section function.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
2 weeks agoFix failing test: i386-avx-reverse
Shiven Kashyap [Tue, 22 Jul 2025 08:32:57 +0000 (14:02 +0530)] 
Fix failing test: i386-avx-reverse

Running the standalone test `gdb.reverse` with the target board configuration `unix/-fPIE/-pie` leads to the following failure:
'''
FAIL: gdb.reverse/i386-avx-reverse.exp: verify ymm15 before vbroadcastsd
'''

This happens because the test expects values stored in `dyn_buf0`, but instead (in the test source) the address of the buffer itself
got broadcast to xmm15 (and thus to ymm15).
This happened because the pointer to the start of `dyn_buf0` wasn't dereferenced (see 'vpbroadcast_test' in 'i386-avx-reverse.c'):
'''
asm volatile ("vbroadcastss %0, %%xmm15": : "m" (dyn_buf0));
 ^
'''
and this consequently lead to the test failing for the next instruction (`vbroadcastsd`), which depended on the correct value being broadcast to the register.

Also, updated the corresponding expected output (gdb.reverse/i386-avx-reverse.exp) to match.

Tested on x86-64 Linux.

Signed-off-by: Shiven Kashyap <shivenkashyap24@gmail.com>
Approved-By: Guinevere Larsen <guinevere@redhat.com>
2 weeks agoRISC-V: Don't allocate dynamic relocation if it's section was discarded
Nelson Chu [Thu, 3 Jul 2025 03:16:25 +0000 (11:16 +0800)] 
RISC-V: Don't allocate dynamic relocation if it's section was discarded

2 weeks agoRISC-V: Fix the assert fail when linking discarded sections under -pie for got
Nelson Chu [Thu, 3 Jul 2025 03:16:24 +0000 (11:16 +0800)] 
RISC-V: Fix the assert fail when linking discarded sections under -pie for got

Considering the following case,
% cat tmp.s
.option pic
.text
.global _start
_start:
nop
.section .discard.s, "ax"
la x1, _start
% cat tmp.ld
OUTPUT_ARCH(riscv)
ENTRY(_start)
SECTIONS
{
  /DISCARD/ : { *(.discard.*) }
  . = 0x10000;
  .text : { *(.text) }
  . = 0x20000;
  .got  : { *(.got) *(.got.plt)}
  . = 0x30000;
  .data : { *(.data) *(.data.*) }
}
% riscv64-unknown-linux-gnu-as tmp.s -o tmp.o
% riscv64-unknown-linux-gnu-ld -pie -Ttmp.ld tmp.o
riscv64-unknown-linux-gnu-ld: BFD (GNU Binutils) 2.44.50.20250624 assertion fail binutils-gdb/bfd/elfnn-riscv.c:3638

This happens when pie and the input sections, which refers to the global
symbol by got, are all discarded.  Since referenced sections are all discarded,
we won't go into relocate_section for those sections, the got entry also won't
be initialized.  Therefore, we will get assert fail when adding the RELATIVE
reloc in the finish_dynamic_symbol.

After seeing other target codes, there are two root causes as follows,

1. risc-v may call bfd_elf_link_record_dynamic_symbol in the allocate_dynrelocs
   for not only undefweak symbols.

2. risc-v is missing the code to add RELATIVE to R_RISCV_GOT entries in the
   relocate_section if a symbol is not dynamic and is not undefined weak under
   pic and pie.

If we call bfd_elf_link_record_dynamic_symbol, then the global symbol will be
forced to dynamic, so the h->dynindx will forced to be a number rather than -1,
even it should be -1.  Once h->dynindx != -1 and pic/pie, it will go into
finish_dynamic_symbol and insert RELATIVE/64 relocs for the got entry;  For the
above case there are two issues,

1. The global symbol _start is forced to be dynamic in the allocate_dynrelocs.
   when pie and all the referenced section are discarded, it won't go into
   relocate_section to initialize the got entry, so it will cause assert fail
   when adding RELATIVE reloc in the finish_dynamic_symbol.  The assert fail
   represents another problem - if we don't initialize the got entry in the
   relocate_section under pie, which means we don't need to go into the
   finish_dynamic_symbol and don't need a RELATIVE reloc for the got entry,
   it should be NONE reloc.

2. Without linking any discarded section, it originally forces every RELATIVE
   relocs added for every got by the finish_dynamic_symbol.  Even The final
   result looks correct under pie (genearte a RELATIVE reloc for got entry),
   not sure if it may cause other problems for some special cases, excpet the
   above one.

Therefore, this patch try to fix the above assert fail, and also clarify the
behavior of the allocate_dynrelocs which should only call bfd_elf_link_record_dynamic_symbol
for undefweak symbols, and add the missing code to generate RELATIVE reloc to
R_RISCV_GOT entries in the relocate_section if a symbol is not dynamic and is
not undefined weak under pic and pie.

Passed the gcc/binutils regressions of riscv-gnu-toolchain at least.

2 weeks agoRISC-V: Indent and reorder backend define functions for bfd/elfnn-riscv.c
Nelson Chu [Tue, 22 Jul 2025 05:39:23 +0000 (13:39 +0800)] 
RISC-V: Indent and reorder backend define functions for bfd/elfnn-riscv.c

2 weeks agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Jul 2025 00:01:48 +0000 (00:01 +0000)] 
Automatic date update in version.in

2 weeks agogdb: remove unused includes
Simon Marchi [Mon, 21 Jul 2025 19:30:01 +0000 (15:30 -0400)] 
gdb: remove unused includes

Remove a bunch of includes reported as unused by clangd.

Change-Id: I3f05f98a298036fadf1acce4ddc198405ec056ee

2 weeks agogdb/solib-svr4: remove an unnecessary static cast
Simon Marchi [Mon, 21 Jul 2025 19:25:53 +0000 (15:25 -0400)] 
gdb/solib-svr4: remove an unnecessary static cast

The type is already lm_info_svr4.

Change-Id: Id681eb1685462610b202c76147739ac885555f6b

2 weeks agoaarch64: Use an enum to refer to indices in the opcode table
Richard Earnshaw [Mon, 21 Jul 2025 15:40:12 +0000 (16:40 +0100)] 
aarch64: Use an enum to refer to indices in the opcode table

The indices into the auto-generated tables for opcodes are relatively
unstable.  Adding a new opcode can permute the code significantly.
But most of this churn is down to changes in the index values.  To
minimize this use enumerated constants.  While the index values
change, the enumeration names will need to do so far less often, so
most of the changes in the generated code become localized to the
addition (occasionally removal) of opcodes.  This change also makes
the state-change comments unnecessary.  The enumeration names contain
the same information (and more), so these are simply deleted.

The enumeration values are placed in a new header file, aarch64-tbl-2.h,
so aarch64-gen gains a new option to build this header and the Makefile
rules are adjusted accordingly.

2 weeks agoaarch64: use an enumeration for operand indices.
Richard Earnshaw [Mon, 14 Jul 2025 16:30:01 +0000 (17:30 +0100)] 
aarch64: use an enumeration for operand indices.

The generated aarch64 operand tables use index values into an array.  But if
the table of operands is modified by inserting a new operand into the middle
of the table, *all* the index values can change, leading to a lot of
churn in the generated output.

include/opcode/aarch64.h already provides an enumeration for the operands,
so make use of that instead of printing out the raw index values.

2 weeks agoaarch64: Fix operand name MOPS_WB_Rd -> MOPS_WB_Rn
Richard Earnshaw [Tue, 15 Jul 2025 16:32:20 +0000 (17:32 +0100)] 
aarch64: Fix operand name MOPS_WB_Rd -> MOPS_WB_Rn

This field was misnamed in aarch64_opcode_table.  It previously didn't
matter too much as the name field only appeared in dumps.  But it
doesn't match the enum in include/opcode/aarch64.h and we will shortly
start to rely on that.

2 weeks agoaarch64: minor code cleanups to aarch64-gen.c
Richard Earnshaw [Mon, 21 Jul 2025 14:42:55 +0000 (15:42 +0100)] 
aarch64: minor code cleanups to aarch64-gen.c

Fix some overly-long lines.

2 weeks agogdb/solib-svr4: remove unused svr4_solib_ops method declarations
Simon Marchi [Fri, 18 Jul 2025 19:19:16 +0000 (15:19 -0400)] 
gdb/solib-svr4: remove unused svr4_solib_ops method declarations

These method declarations are unused, remove them.  I guess that when
writing a previous patch, changed some free functions to be methods,
then changed my mind, and forgot to remove the declarations.

Change-Id: I7452bb773af0f32c4aae2fe6a4fc663ec65c3f15

2 weeks agoRemove NaCl/arm target support
H.J. Lu [Sun, 28 Jun 2020 17:50:19 +0000 (10:50 -0700)] 
Remove NaCl/arm target support

NaCl has been deprecated:

https://developer.chrome.com/docs/native-client/migration/

It is now in the process of being removed from llvm:

https://github.com/llvm/llvm-project/pull/133661

Remove NaCl/arm target support from bfd, binutils, gas and ld.

bfd/

* Makefile.am (BFD32_BACKENDS): Remove elf-nacl.lo.
(BFD32_BACKENDS_CFILES): Remove elf-nacl.c.
(SOURCE_HFILES): Remove elf-nacl.h.
* Makefile.in: Regenerated.
* config.bfd: Add *-*-nacl* to obsolete targets.
Remove *-*-nacl* targets.
* configure.ac: Remove nacl target vectors.
* elf-bfd.h (elf_target_os): Remove is_nacl.
* elf-nacl.c: Removed.
* elf-nacl.h: Likewise.
* elf32-arm.c: Don't include "elf-nacl.h".
(elf32_arm_nacl_plt0_entry): Removed.
(elf32_arm_nacl_plt_entry): Likewise.
(elf32_arm_stub_long_branch_arm_nacl): Likewise.
(elf32_arm_stub_long_branch_arm_nacl_pic): Likewise.
(arm_movw_immediate): Likewise.
(arm_movt_immediate): Likewise.
(arm_nacl_put_plt0): Likewise.
(elf32_arm_nacl_link_hash_table_create): Likewise.
(elf32_arm_nacl_modify_segment_map): Likewise.
(elf32_arm_nacl_final_write_processing): Likewise.
(elf32_arm_nacl_plt_sym_val): Likewise.
(elf32_arm_stub_cmse_branch_thumb_only): Remove
long_branch_arm_nacl and long_branch_arm_nacl_pic entries.
(arm_type_of_stub): Updated.
(elf32_arm_create_or_find_stub_sec): Likewise.
(arm_stub_required_alignment): Likewise.
(elf32_arm_allocate_plt_entry): Likewise.
(elf32_arm_populate_plt_entry): Likewise.
(elf32_arm_finish_dynamic_sections): Likewise.
(elf32_arm_output_plt_map_1): Likewise.
(elf32_arm_output_arch_local_syms): Likewise.
Remove elf32_arm_nacl_bed.
* targets.c: Remove NaCl target vectors.
* bfd-in2.h: Regenerated.
* configure: Likewise.
* po/SRC-POTFILES.in: Likewise.

binutils/

* NEWS: Mention NaCl target support removal.
* testsuite/lib/binutils-common.exp: Remove NaCl target support.

gas/

* NEWS: Mention NaCl target support removal.
* configure.tgt: Likewise.
* config/tc-arm.c: Remove NaCl target support.
* testsuite/gas/arm/any-armv8m.d: Likewise.
* testsuite/gas/arm/any-cmse-main.d: Likewise.
* testsuite/gas/arm/any-cmse.d: Likewise.
* testsuite/gas/arm/any-idiv.d: Likewise.
* testsuite/gas/arm/arch4t-eabi.d: Likewise.
* testsuite/gas/arm/arch4t.d: Likewise.
* testsuite/gas/arm/armv8m.base-idiv.d: Likewise.
* testsuite/gas/arm/armv9-a_arch.d: Likewise.
* testsuite/gas/arm/attr-abi-hardfp-use-0.d: Likewise.
* testsuite/gas/arm/attr-abi-hardfp-use-1.d: Likewise.
* testsuite/gas/arm/attr-abi-hardfp-use-2.d: Likewise.
* testsuite/gas/arm/attr-abi-hardfp-use-3.d: Likewise.
* testsuite/gas/arm/attr-any-armv4t.d: Likewise.
* testsuite/gas/arm/attr-any-thumbv6.d: Likewise.
* testsuite/gas/arm/attr-arch-assumption.d: Likewise.
* testsuite/gas/arm/attr-cpu-directive.d: Likewise.
* testsuite/gas/arm/attr-default.d: Likewise.
* testsuite/gas/arm/attr-empty-string.d: Likewise.
* testsuite/gas/arm/attr-ext-fpv5-d16.d: Likewise.
* testsuite/gas/arm/attr-ext-fpv5.d: Likewise.
* testsuite/gas/arm/attr-ext-idiv.d: Likewise.
* testsuite/gas/arm/attr-ext-mp.d: Likewise.
* testsuite/gas/arm/attr-ext-neon-fp16.d: Likewise.
* testsuite/gas/arm/attr-ext-neon-vfpv3.d: Likewise.
* testsuite/gas/arm/attr-ext-neon-vfpv4.d: Likewise.
* testsuite/gas/arm/attr-ext-sec.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv3-d16-fp16.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv3-d16.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv3-fp16.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv3.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv3xd-fp.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv3xd.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv4-d16.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv4-sp-d16.d: Likewise.
* testsuite/gas/arm/attr-ext-vfpv4.d: Likewise.
* testsuite/gas/arm/attr-march-all.d: Likewise.
* testsuite/gas/arm/attr-march-armv1.d: Likewise.
* testsuite/gas/arm/attr-march-armv2.d: Likewise.
* testsuite/gas/arm/attr-march-armv2a.d: Likewise.
* testsuite/gas/arm/attr-march-armv2s.d: Likewise.
* testsuite/gas/arm/attr-march-armv3.d: Likewise.
* testsuite/gas/arm/attr-march-armv3m.d: Likewise.
* testsuite/gas/arm/attr-march-armv4.d: Likewise.
* testsuite/gas/arm/attr-march-armv4t.d: Likewise.
* testsuite/gas/arm/attr-march-armv4txm.d: Likewise.
* testsuite/gas/arm/attr-march-armv4xm.d: Likewise.
* testsuite/gas/arm/attr-march-armv5.d: Likewise.
* testsuite/gas/arm/attr-march-armv5t.d: Likewise.
* testsuite/gas/arm/attr-march-armv5te.d: Likewise.
* testsuite/gas/arm/attr-march-armv5tej.d: Likewise.
* testsuite/gas/arm/attr-march-armv5texp.d: Likewise.
* testsuite/gas/arm/attr-march-armv5txm.d: Likewise.
* testsuite/gas/arm/attr-march-armv6-m+os.d: Likewise.
* testsuite/gas/arm/attr-march-armv6-m.d: Likewise.
* testsuite/gas/arm/attr-march-armv6.d: Likewise.
* testsuite/gas/arm/attr-march-armv6j.d: Likewise.
* testsuite/gas/arm/attr-march-armv6k+sec.d: Likewise.
* testsuite/gas/arm/attr-march-armv6k.d: Likewise.
* testsuite/gas/arm/attr-march-armv6kt2.d: Likewise.
* testsuite/gas/arm/attr-march-armv6kz.d: Likewise.
* testsuite/gas/arm/attr-march-armv6kzt2.d: Likewise.
* testsuite/gas/arm/attr-march-armv6s-m.d: Likewise.
* testsuite/gas/arm/attr-march-armv6t2.d: Likewise.
* testsuite/gas/arm/attr-march-armv6z.d: Likewise.
* testsuite/gas/arm/attr-march-armv6zk.d: Likewise.
* testsuite/gas/arm/attr-march-armv6zkt2.d: Likewise.
* testsuite/gas/arm/attr-march-armv6zt2.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-a+idiv.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-a+mp.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-a+sec+virt.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-a+sec.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-a+virt.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-m.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-r+mp.d: Likewise.
* testsuite/gas/arm/attr-march-armv7-r.d: Likewise.
* testsuite/gas/arm/attr-march-armv7.d: Likewise.
* testsuite/gas/arm/attr-march-armv7a.d: Likewise.
* testsuite/gas/arm/attr-march-armv7em.d: Likewise.
* testsuite/gas/arm/attr-march-armv7m.d: Likewise.
* testsuite/gas/arm/attr-march-armv7r.d: Likewise.
* testsuite/gas/arm/attr-march-armv7ve.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-a+crypto.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-a+fp.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-a+rdma.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-a+simd.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-r+crypto.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-r+fp.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-r+simd.d: Likewise.
* testsuite/gas/arm/attr-march-armv8-r.d: Likewise.
* testsuite/gas/arm/attr-march-armv8_1-a+simd.d: Likewise.
* testsuite/gas/arm/attr-march-armv8_1-m.main.d: Likewise.
* testsuite/gas/arm/attr-march-armv8_4-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv8_5-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv8_6-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv8_7-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv8_8-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv8_9-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv9_1-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv9_2-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv9_3-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv9_4-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv9_5-a.d: Likewise.
* testsuite/gas/arm/attr-march-armv8m.base.d: Likewise.
* testsuite/gas/arm/attr-march-armv8m.main.d: Likewise.
* testsuite/gas/arm/attr-march-armv8m.main.dsp.d: Likewise.
* testsuite/gas/arm/attr-march-iwmmxt.d: Likewise.
* testsuite/gas/arm/attr-march-iwmmxt2.d: Likewise.
* testsuite/gas/arm/attr-march-xscale.d: Likewise.
* testsuite/gas/arm/attr-mcpu.d: Likewise.
* testsuite/gas/arm/attr-mfpu-arm1020e.d: Likewise.
* testsuite/gas/arm/attr-mfpu-arm1020t.d: Likewise.
* testsuite/gas/arm/attr-mfpu-arm1136jf-s.d: Likewise.
* testsuite/gas/arm/attr-mfpu-arm1136jfs.d: Likewise.
* testsuite/gas/arm/attr-mfpu-neon-fp16.d: Likewise.
* testsuite/gas/arm/attr-mfpu-neon.d: Likewise.
* testsuite/gas/arm/attr-mfpu-softvfp+vfp.d: Likewise.
* testsuite/gas/arm/attr-mfpu-softvfp.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfp.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfp10-r0.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfp10.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfp3.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfp9.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfpv2.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfpv3-d16.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfpv3.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfpv4-d16.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfpv4.d: Likewise.
* testsuite/gas/arm/attr-mfpu-vfpxd.d: Likewise.
* testsuite/gas/arm/attr-names.d: Likewise.
* testsuite/gas/arm/attr-non-null-terminated-string.d: Likewise.
* testsuite/gas/arm/attr-order.d: Likewise.
* testsuite/gas/arm/attr-override-cpu-directive.d: Likewise.
* testsuite/gas/arm/attr-override-mcpu.d: Likewise.
* testsuite/gas/arm/bl-local-2.d: Likewise.
* testsuite/gas/arm/bl-local-v4t.d: Likewise.
* testsuite/gas/arm/blx-local.d: Likewise.
* testsuite/gas/arm/branch-reloc.d: Likewise.
* testsuite/gas/arm/directives.d: Likewise.
* testsuite/gas/arm/got_prel.d: Likewise.
* testsuite/gas/arm/mapdir.d: Likewise.
* testsuite/gas/arm/mapmisc.d: Likewise.
* testsuite/gas/arm/mapsecs.d: Likewise.
* testsuite/gas/arm/mapshort-eabi.d: Likewise.
* testsuite/gas/arm/mov-highregs-any.d: Likewise.
* testsuite/gas/arm/mov-lowregs-any.d: Likewise.
* testsuite/gas/arm/note-march-armv2.d: Likewise.
* testsuite/gas/arm/note-march-armv2a.d: Likewise.
* testsuite/gas/arm/note-march-armv3.d: Likewise.
* testsuite/gas/arm/note-march-armv3m.d: Likewise.
* testsuite/gas/arm/note-march-armv4.d: Likewise.
* testsuite/gas/arm/note-march-armv4t.d: Likewise.
* testsuite/gas/arm/note-march-armv5.d: Likewise.
* testsuite/gas/arm/note-march-armv5t.d: Likewise.
* testsuite/gas/arm/note-march-armv5te.d: Likewise.
* testsuite/gas/arm/note-march-iwmmxt.d: Likewise.
* testsuite/gas/arm/note-march-iwmmxt2.d: Likewise.
* testsuite/gas/arm/note-march-xscale.d: Likewise.
* testsuite/gas/arm/pr12198-1.d: Likewise.
* testsuite/gas/arm/pr12198-2.d: Likewise.
* testsuite/gas/arm/thumb-eabi.d: Likewise.
* testsuite/gas/arm/thumb.d: Likewise.
* testsuite/gas/arm/thumbrel.d: Likewise.
* config/te-nacl.h: Removed.

ld/

* Makefile.am (ALL_EMULATION_SOURCES): Remove earmelf_nacl.c and
and earmelfb_nacl.c.
Remove NaCl dep files.
* NEWS: Mention NaCl target support removal.
* configure.tgt: Remove NaCl target support.
* Makefile.in: Regenerated.
* configure: Likewise.
* po/BLD-POTFILES.in: Likewise.
* emulparams/armelf_nacl.sh: Removed.
* emulparams/armelfb_nacl.sh: Likewise.
* emulparams/elf_nacl.sh: Likewise.
* testsuite/ld-arm/farcall-arm-nacl-pic.d: Likewise.
* testsuite/ld-arm/farcall-arm-nacl.d: Likewise.
* testsuite/ld-arm/farcall-data-nacl.d: Likewise.
* testsuite/ld-arm/farcall-thumb2-purecode-consecutive-veneer.d:
Adjusted.
* testsuite/ld-arm/arm-elf.exp: Remove NaCl target support.
* testsuite/ld-arm/cortex-a8-far.d: Likewise.
* testsuite/ld-arm/non-contiguous-arm3.d: Likewise.
* testsuite/ld-arm/non-contiguous-arm6.d: Likewise.
* testsuite/ld-elf/binutils.exp: Likewise.
* testsuite/ld-elf/build-id.exp: Likewise.
* testsuite/ld-elf/ehdr_start-missing.d: Likewise.
* testsuite/ld-elf/ehdr_start-shared.d: Likewise.
* testsuite/ld-elf/ehdr_start-userdef.d: Likewise.
* testsuite/ld-elf/ehdr_start-weak.d: Likewise.
* testsuite/ld-elf/ehdr_start.d: Likewise.
* testsuite/ld-elf/elf.exp: Likewise.
* testsuite/ld-elf/export-class.exp: Likewise.
* testsuite/ld-elf/fatal-warnings-1a.d: Likewise.
* testsuite/ld-elf/fatal-warnings-1b.d: Likewise.
* testsuite/ld-elf/orphan-region.d: Likewise.
* testsuite/ld-elf/package-note.exp: Likewise.
* testsuite/ld-elf/pr16322.d: Likewise.
* testsuite/ld-elf/pr16498a.d: Likewise.
* testsuite/ld-elf/pr16498b.d: Likewise.
* testsuite/ld-elf/pr19162.d: Likewise.
* testsuite/ld-elf/pr22269a.d: Likewise.
* testsuite/ld-elf/pr22269b.d: Likewise.
* testsuite/ld-elf/pr22393-1a.d: Likewise.
* testsuite/ld-elf/pr22393-1b.d: Likewise.
* testsuite/ld-elf/pr22393-1c.d: Likewise.
* testsuite/ld-elf/pr22393-1d.d: Likewise.
* testsuite/ld-elf/pr22393-1e.d: Likewise.
* testsuite/ld-elf/pr22393-1f.d: Likewise.
* testsuite/ld-elf/pr22393-2a.rd: Likewise.
* testsuite/ld-elf/pr22393-2b.rd: Likewise.
* testsuite/ld-elf/pr23900-1-32.rd: Likewise.
* testsuite/ld-elf/pr23900-1-64.rd: Likewise.
* testsuite/ld-elf/pr23900-1.d: Likewise.
* testsuite/ld-elf/pr23900-2a.d: Likewise.
* testsuite/ld-elf/pr23900-2b.d: Likewise.
* testsuite/ld-elf/pr30508.d: Likewise.
* testsuite/ld-elf/pr30907-1.d: Likewise.
* testsuite/ld-elf/pr30907-2.d: Likewise.
* testsuite/ld-elf/pr32341.d: Likewise.
* testsuite/ld-elf/shared.exp: Likewise.
* testsuite/ld-elf/tls.exp: Likewise.
* testsuite/ld-elf/tls_common.exp: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-gc/gc.exp: Likewise.
* testsuite/ld-ifunc/binutils.exp: Likewise.
* testsuite/ld-pie/pie.exp: Likewise.
* testsuite/ld-plugin/lto-binutils.exp: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-scripts/rgn-at3.d: Likewise.
* testsuite/ld-shared/shared.exp: Likewise.
* testsuite/ld-size/size.exp: Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agogold: Remove NaCl target support
H.J. Lu [Sat, 19 Jul 2025 20:55:56 +0000 (13:55 -0700)] 
gold: Remove NaCl target support

NaCl has been deprecated:

https://developer.chrome.com/docs/native-client/migration/

It is now in the process of being removed from llvm:

https://github.com/llvm/llvm-project/pull/133661

Remove NaCl target support from gold.

* Makefile.am (CCFILES): Remove nacl.cc.
(HFILES): Remove nacl.h.
* Makefile.in: Regenerated.
* aarch64.cc: Don't include nacl.h.
* arm.cc: Don't include nacl.h.
(Target_arm_nacl): Removed.
(Output_data_plt_arm_nacl): Likewise.
(target_selector_arm): Replace Target_arm_nacl with
Target_selector_arm.
* i386.cc: Don't include nacl.h.
(Output_data_plt_i386_nacl): Removed.
(Target_i386_nacl): Likewise.
(target_selector_i386): Replace Target_selector_i386_nacl with
Target_selector_i386.
* mips.cc: Don't include nacl.h.
(Target_mips_nacl): Removed.
(Target_selector_mips_nacl): Likewise.
(target_selector_mips32): Replace Target_selector_mips_nacl with
Target_selector_mips.
(target_selector_mips32el): Likewise.
(target_selector_mips64): Likewise.
(target_selector_mips64el): Likewise.
* nacl.cc: Removed.
* nacl.h: Likewise.
* x86_64.cc: Don't include nacl.h.
(Output_data_plt_x86_64_nacl): Removed.
(Target_x86_64_nacl): Likewise.
(target_selector_x86_64): Replace Target_x86_64_nacl with
Target_selector_x86_64.
(target_selector_x32): Likewise.
* po/POTFILES.in: Regenerated.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Jul 2025 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

2 weeks agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Jul 2025 00:01:29 +0000 (00:01 +0000)] 
Automatic date update in version.in

2 weeks agogprofng: do not skip weak symbols
Dmitrii Bordukov [Sat, 19 Jul 2025 12:21:46 +0000 (15:21 +0300)] 
gprofng: do not skip weak symbols

PR gprofng/33151

gprofng ignores functions that are compiled as weak symbols. This
heavily affects C++ class methods that are always compiled by g++
and clang++ as weak symbols. In this case 'gprofng display text'
just displays <static>@ADDRESS(<FILENAME>) instead of proper method
name.

The bug has been introduced in the commit 470a0288a818.

2 weeks ago[gdb/cli] Document \001 and \002 usage for set prompt
Tom de Vries [Sat, 19 Jul 2025 15:37:01 +0000 (17:37 +0200)] 
[gdb/cli] Document \001 and \002 usage for set prompt

PR cli/28887 reports the following problem when using a custom prompt.

First, we set up the custom prompt (with ^ marking the position of the
blinking cursor on the line above):
...
$ gdb -q -ex "set prompt \033[31mgdb$ \033[0m"
gdb$
     ^
...

Then we type some string, and enter it into the command history:
...
gdb$ some long command
❌️ Undefined command: "some".  Try "help".
gdb$
     ^
...

We use C-p to fetch the previous command:
...
gdb$ some long command
                      ^
...
Sofar, so good.

Finally, we use C-a which should move the cursor to just after the prompt, but
instead we get:
...
gdb$ some long command
              ^
...

This is fixed by using \001 and \002:
...
(gdb) set prompt \001\033[31m\002gdb$ \001\033[0m\002
...
aka as RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE [1].

Add an example to the documentation showing the use of these markers.

The added example is the equivalent of the "\[\e[0;34m\](gdb)\[\e[0m\]"
example documented at gdb.prompt.substitute_string that can be used with
"set extended-prompt".

While working on this, I noticed that "show prompt" doesn't show back the
original string, using '\e' instead of '\033':
...
gdb$ show prompt
Gdb's prompt is "\001\e[31m\002gdb$ \001\e[0m\002".
...
and that the shown string can't be used as an argument to "set prompt":
...
gdb$ set prompt \001\e[31m\002gdb$ \001\e[0m\002
e[31mgdb$ e[0m
...

I've filed this as PR cli/33184.

Approved-By: Eli Zaretskii <eliz@gnu.org>
[1] https://tiswww.case.edu/php/chet/readline/readline.html

2 weeks ago[gdb/testsuite] Restructure gdb.base/backtrace-through-cu-nodebug.exp
Tom de Vries [Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)] 
[gdb/testsuite] Restructure gdb.base/backtrace-through-cu-nodebug.exp

I noticed that the test names in test-case
gdb.base/backtrace-through-cu-nodebug.exp are a bit inconsistent:
...
PASS: $exp: no-cfi: maint frame-unwinder disable ARCH
PASS: $exp: verify no-filters unwind fail without CFI
PASS: $exp: maint flush register-cache
PASS: $exp: verify unwind fail without CFI
PASS: $exp: cfi: maint frame-unwinder disable ARCH
PASS: $exp: Verify unwinding works based only on CFI information
...

There's both a no-cfi prefix, and "without CFI".

Fix this by using proc_with_prefix, getting us a consistent prefix:
...
PASS: $exp: no-cfi: maint frame-unwinder disable ARCH
PASS: $exp: no-cfi: verify no-filters unwind fail
PASS: $exp: no-cfi: maint flush register-cache
PASS: $exp: no-cfi: verify unwind fail
PASS: $exp: cfi: maint frame-unwinder disable ARCH
PASS: $exp: cfi: Verify unwinding works
...

While we're at it, use multi_line to make a regexp more readable.

Tested on aarch64-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
2 weeks ago[gdb/testsuite] Fix gdb.base/backtrace-through-cu-nodebug.exp without python support
Tom de Vries [Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)] 
[gdb/testsuite] Fix gdb.base/backtrace-through-cu-nodebug.exp without python support

With a gdb build without python support, and test-case
gdb.base/backtrace-through-cu-nodebug.exp I run into:
...
(gdb) bt^M
Required frame unwinder may have been disabled, \
  see 'maint info frame-unwinders'^M
(gdb) FAIL: $exp: verify unwind fail without CFI
...

With a gdb build with python support we have instead:
...
(gdb) bt^M
Python Exception <class 'gdb.error'>: \
  Required frame unwinder may have been disabled, \
  see 'maint info frame-unwinders'^M
(gdb) PASS: $exp: verify unwind fail without CFI
...
but if I change the "bt" into "bt -no-filters" I get the same FAIL and
corresponding output.

So there are two scenarios here.

In the first:
- the bt command is called
- frame #0 is printed
- trying to get the next frame fails and an error is thrown, aborting the
  backtrace
- the error is caught and printed

In the second:
- the bt command is called
- the frame filter is applied
- doing so triggers the same error, which is caught and printed by
  gdbpy_apply_frame_filter, returning EXT_LANG_BT_NO_FILTERS
- frame #0 is printed
- getting the next frame fails, and the backtrace stops

It seems worthwhile to exercise both scenarios if possible, so add a
"bt -no-filters" test.

Fix the FAIL by updating the regexp to allow both scenarios.

Tested on aarch64-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
2 weeks ago[gdb/testsuite] Fix gdb.multi/pending-bp.exp without python support
Tom de Vries [Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)] 
[gdb/testsuite] Fix gdb.multi/pending-bp.exp without python support

With a gdb build without python support and test-case
gdb.multi/pending-bp.exp, I run into:
...
(gdb) python bp=[b for b in gdb.breakpoints() if b.number == 5][0]^M
Python scripting is not supported in this copy of GDB.^M
(gdb) FAIL: $exp: py_test_toggle_thread: find Python gdb.Breakpoint object
...

Fix this by requiring python support for part of the test-case.

Tested on aarch64-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
2 weeks ago[gdb/testsuite] Fix gdb.base/break-dbg.exp without xml support
Tom de Vries [Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)] 
[gdb/testsuite] Fix gdb.base/break-dbg.exp without xml support

With a gdb build without xml support and test-case gdb.base/break-dbg.exp, I
run into:
...
(gdb) catch syscall^M
warning: Can not parse XML syscalls information; \
  XML support was disabled at compile time.^M
Catchpoint 11 (any syscall)^M
(gdb) FAIL: $exp: catch syscall
...

Fix this by updating the regexp.

Tested on aarch64-linux.

Reviewed-By: Keith Seitz <keiths@redhat.com>
2 weeks agoRe: RELOC_AGAINST_DISCARDED_SECTION zero size reloc sections
Alan Modra [Sat, 19 Jul 2025 05:57:04 +0000 (15:27 +0930)] 
Re: RELOC_AGAINST_DISCARDED_SECTION zero size reloc sections

Update the testsuite, so that is_generic ELF targets still do the
linkonce1 test (as linkonce3).

2 weeks agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Jul 2025 00:01:16 +0000 (00:01 +0000)] 
Automatic date update in version.in

2 weeks agoRELOC_AGAINST_DISCARDED_SECTION zero size reloc sections
Alan Modra [Thu, 17 Jul 2025 23:56:10 +0000 (09:26 +0930)] 
RELOC_AGAINST_DISCARDED_SECTION zero size reloc sections

For some reason the initial implementation (commit 0672748ac053) of
this macro didn't allow discarding of all relocs in a section, perhaps
because doing so would require a testsuite change.  This patch allows
zero size relocation sections to result, and adjusts the testsuite.
i386, x86_64, ppc and ppc64 code that avoids a memmove is also changed
to allow zero size reloc sections, and arc fixed to actually adjust
the reloc section header.

2 weeks ago[gdb/testsuite] Fix gdb.arch/amd64-disp-step-self-call.exp on freebsd
Tom de Vries [Fri, 18 Jul 2025 17:51:46 +0000 (19:51 +0200)] 
[gdb/testsuite] Fix gdb.arch/amd64-disp-step-self-call.exp on freebsd

On x86_64-freebsd, with test-case gdb.arch/amd64-disp-step-self-call.exp, I
run into:
...
(gdb) continue
Continuing.

Program received signal SIGBUS, Bus error.
Object-specific hardware error.
0x000000080051492c in alarm () from /lib/libc.so.7
(gdb) FAIL: $exp: continue to breakpoint: test_call
...

The behaviour is not specific to gdb, it can be reproduced by running the
test-case executable:
...
$ ./outputs/gdb.arch/amd64-disp-step-self-call/amd64-disp-step-self-call
Bus error (core dumped)
$
...

The bus error happens when executing this instruction in alarm:
...
0000000000093910 <alarm>:
   ...
   9392c: 0f 29 45 d0                   movaps %xmm0, -0x30(%rbp)
...
because $rbp is not 16-byte aligned.

This can be fixed by adding the missing frame setup instructions at the start
of main in amd64-disp-step-self-call.S:
...
 main:
+ pushq %rbp
+ movq %rsp, %rbp
...

Instead, fix this by moving main from the assembly file to the c file, which
has the same effect.

Also remove the done label, which looks like a copy-past left-over.  Instead,
add an unreachable function and use it where appropriate.

Do the same for i386 case (which makes the source files identical for the
amd64 and i386 case, but I decided to leave it like that).

Tested on x86_64-freebsd and x86_64-linux.

2 weeks agogdb/testsuite: mark the start of each gdb.in.* log file
Andrew Burgess [Wed, 16 Jul 2025 14:30:48 +0000 (15:30 +0100)] 
gdb/testsuite: mark the start of each gdb.in.* log file

Emit a line in the gdb.log file each time a new gdb.in.NUM command log
is started.  The gdb.log line includes the full filename for the new
gdb.in.NUM file.

This change will make it trivial to go from a FAIL in the gdb.log file
to the gdb.in.NUM file that (should) reproduce the failure.  When I
encounter a failing test one of my first steps is usually to identify
the gdb.in.NUM file and try re-running it to see if that reproduces
the failure.  Some tests create many very similar gdb.in.NUM files, so
finding the exact one can sometimes be difficult.  With this patch
that task is now trivial.

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

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2 weeks agold: Limit PR ld/25617 tests to glibc targets
H.J. Lu [Thu, 17 Jul 2025 12:34:22 +0000 (05:34 -0700)] 
ld: Limit PR ld/25617 tests to glibc targets

Since PR ld/25617 tests expects glibc specific features, limit PR ld/25617
tests to glibc targets.

PR ld/33169
* testsuite/ld-elf/no-section-header.exp: Return if not glibc
targets.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2 weeks agoFix more unused variable warnings
Alan Modra [Fri, 18 Jul 2025 07:23:38 +0000 (16:53 +0930)] 
Fix more unused variable warnings

2 weeks agoFix unused variable warnings
Alan Modra [Fri, 18 Jul 2025 05:10:17 +0000 (14:40 +0930)] 
Fix unused variable warnings

2 weeks agoasan: undefined shift
Alan Modra [Fri, 18 Jul 2025 04:56:56 +0000 (14:26 +0930)] 
asan: undefined shift

 .bundle_align_mode 32
 nop
read.c:776:26: runtime error: shift exponent 32 is too large for
32-bit type 'unsigned int'

Avoid this by using wider types in the expressions.

2 weeks agovisium: use RELOC_AGAINST_DISCARDED_SECTION
Alan Modra [Thu, 17 Jul 2025 23:54:30 +0000 (09:24 +0930)] 
visium: use RELOC_AGAINST_DISCARDED_SECTION

The initial visium support added in commit d924db559be9 didn't make
use of RELOC_AGAINST_DISCARDED_SECTION, and so lacked code to remove
relocations in debug sections.

2 weeks agoMETAG_RELOC_AGAINST_DISCARDED_SECTION
Alan Modra [Thu, 17 Jul 2025 23:52:43 +0000 (09:22 +0930)] 
METAG_RELOC_AGAINST_DISCARDED_SECTION

Delete this macro which duplicates RELOC_AGAINST_DISCARDED_SECTION,
and instead add an rnone parameter to the standard version.

2 weeks agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Jul 2025 00:01:20 +0000 (00:01 +0000)] 
Automatic date update in version.in

2 weeks ago[gdb/testsuite] Use pagination_prompt var more often
Tom de Vries [Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)] 
[gdb/testsuite] Use pagination_prompt var more often

In some test-cases, matching the pagination prompt is split up to address a
matching race but that's no longer necessary, thanks to commit c3f814a1433
("Fix paginate-*.exp races").

Fix this by using the pagination_prompt variable.

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>
2 weeks ago[gdb/testsuite] Require minimum width in gdb.base/style.exp
Tom de Vries [Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)] 
[gdb/testsuite] Require minimum width in gdb.base/style.exp

In test-case gdb.base/style.exp, we have proc test_pagination_prompt_styling,
which:
- determines a "desired width" by parsing the output of "info files",
- sets width to the "desired width", and
- runs "info files" again.

The "desired width" on my system is 88, but if I override it to 65, I run
into:
...
(gdb) info files^M
Symbols from "^[[32;49;22;27m/data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.base/style/style^[[m".^M
--Type <RET> for more, q to quit, c to continue without paging--^M
^MFAIL: gdb.base/style.exp: check pagination prompt styling (timeout)
...
with make target check, and with check-read1 into:
...
(gdb) info files^M
Symbols from "^[[32;49;22;27m/data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.base/style/style^[[m".^M
--Type <RET> for more, q to quit, c to continue without paging--^M
^M^[[A^M
Native process:^M
        Using the running image of child process 6179.^M
--Type <RET> for more, q to quit, c to continue without paging--ERROR: Window too small.
UNRESOLVED: gdb.base/style.exp: check pagination prompt styling
...

This is caused by the following.

The size of the pagination prompt is 64:
...
         1         2         3         4         5         6
1234567890123456789012345678901234567890123456789012345678901234
--Type <RET> for more, q to quit, c to continue without paging--
...
and because we have TERM=ansi and width == 65, readline wraps at 64:
...
(gdb) maint info screen
Number of characters gdb thinks are in a line is 65.
Number of characters readline reports are in a line is 64.
...

In other words, readline wraps when printing the pagination prompt.

This causes some unusual output, and the test is not prepared to handle this.

Fix this by requiring that desired_width is at least
<length of pagination prompt> + 2.

Tested on x86_64-linux.

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

2 weeks ago[gdb/testsuite] Fix regexp in gdb.base/style.exp
Tom de Vries [Thu, 17 Jul 2025 20:06:38 +0000 (22:06 +0200)] 
[gdb/testsuite] Fix regexp in gdb.base/style.exp

In test-case gdb.base/style.exp, we have proc test_pagination_prompt_styling,
which:
- determines a "desired width" by parsing the output of "info files",
- sets width to the "desired width", and
- runs "info files" again.

The "desired width" on my system is 88, but if I override it to 66, I run into:
...
FAIL: gdb.base/style.exp: check pagination prompt styling
...
due to the test classifying this line as a bad line:
...
  $hex - $hex is .init_array in --Type <RET> for more, ...
...

This is due to a bug in this regexp:
...
    # For lines that don't match this pattern, we cannot comment on
    # where the style reset should occur, so lets just claim the line
    # is fine.
    if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in " $str] } {
return true
    }
...
which is supposed to determine whether the line needs to contain a style
reset.

For aforementioned line, the regexp matches, so the test concludes that the
line should have a style reset, and because it hasn't, it classifies it as a
bad line.

Fix this by making the regexp more strict:
...
    if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in \033" $str] } {
...

Tested on x86_64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>