aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2025-08-14[gdb/testsuite] Disable CLI styling by default in Term::prepare_tuiTom de Vries4-1/+14
On x86_64-freebsd, with test-case gdb.tui/main.exp, I ran into a failure to match the output of the file command, for which I submitted a patch [1]. However, after switching to TERM=ansiw for bsd, I could no longer reproduce the problem. Investigation showed that the difference was caused by CLI styling. A command: ... (gdb) file <filename> ... gives an output: ... Reading symbols from <filename>... (gdb) ... On x86_64-linux, with CLI styling I get: ... Reading symbols from ^[[32m/data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.tui/main/main^[[39m^[[0;10m... ... After disabling CLI styling using "set style enabled off", I simply get: ... Reading symbols from /data/vries/gdb/leap-15-6/build/gdb/testsuite/outputs/gdb.tui/main/main... ... and run into the same failure as on x86_64-freebsd. The extra csi sequence "^[[32m" causes an additional matching attempt in Term::wait_for, and the way we're currently matching relies on this: ... send_gdb "file [standard_output_file $testfile]\n" gdb_assert { [Term::wait_for "Reading symbols from"] } "file command" ... Make the TUI testsuite more stable and matching more simple by disabling CLI styling by default, and: - fix the resulting fallout in test-cases gdb.tui/main.exp and gdb.tui/new-layout.exp, and - re-enable CLI styling in the one test-case that needs it: gdb.tui/tui-disasm-styling.exp. Tested on x86_64-linux. [1] https://sourceware.org/pipermail/gdb-patches/2025-June/218942.html
2025-08-14Recognise ECOFF armap in bfd_slurp_armapAlan Modra1-10/+24
Recognise ECOFF archives and reject them so that the ecoff archive support has a chance to handle the archive. Also use memcmp rather than startswith (strncmp) as we know the string length. * archive.c (bfd_slurp_armap): Recognize ECOFF armap. Use memcmp to match names, and tidy buffer sizes.
2025-08-14objcopy/strip of IR files and is_strip_inputAlan Modra4-114/+86
This tidies objcopy/strip handling of IR objects, in the process of removing the unnecessary is_strip_input flag. The first thing I noticed when looking at is_strip_input code was that the abfd->my_archive test in bfd_check_format_matches meant that plugins were disabled when reading archive elements. We can instead disable plugins by setting bfd_no_plugin, so there doesn't seem to be a need for is_strip_input in objcopy.c:copy_archive. This isn't exactly the same, because bfd_no_plugin prevents the plugin target recognising archive elements in the bfd_check_format_matches loop over all targets as well as just the first !target_defaulted test. But that turns out to be fine. IR code is handled in copy_archive as for other unknown format files. In fact, the only need for the plugin target when copying archives is when reading symbols for the archive map. I've made that plain by moving the plugin target override and commenting on why it is really needed. So on to plain object files. Here, IR code is also copied unchanged, so there doesn't seem a need for the plugin target there either. It isn't quite so simple though, because the objcopy/strip code handling object files wants to verify the format of the object file. Allowing objcopy/strip to copy unknown format files would be a change in behaviour (and results in mmix testsuite fails, ld-mmix/b-badfil1 and others). However, always excluding the plugin target results in a fail of tests added in commit c2729c37f10a. So I've enabled a plugin format check only for files that are otherwise unrecognised, and commented why this is done. I question the need to objcopy LLVM bytecode files. bfd/ * bfd.c (struct bfd<is_strip_input>): Delete. * format.c (bfd_check_format_matches): Delete is_strip_input special case code. * bfd-in2.h: Regenerate. binutils/ * objcopy.c (copy_archive): Don't set is_strip_input. Always set bfd_plugin_no when reading elements. Enable plugins when opening copied elements. (check_format_object): Delete. (copy_file): Don't enable plugin target here. Don't set is_strip_input. Set bfd_plugin_no. Move bfd_core handling code earlier to remove goto. Enable plugin for llvm bytecode. Copy slim IR files as unknown objects.
2025-08-14Correct readelf thin archive testAlan Modra1-3/+2
If we have an existing archive, the test may fail due to it being the wrong format. Also, downloading bintest.thin.a from a remote host (before creating it!) is wrong. * testsuite/binutils-all/readelf.exp (readelf_thin_archive_test): Don't remote_download bintest.thin.a. Delete lib before creating.
2025-08-14[gdb/testsuite] Make prompt matching in Term::wait_for more strictTom de Vries2-8/+66
On x86_64-freebsd, I run into: ... Box Dump (80 x 24) @ (0, 0): 0 (gdb) maint info screen 1 Number of characters gdb thinks are in a line is 90. 2 Number of characters readline reports are in a line is 89. 3 Number of characters curses thinks are in a line is 90. 4 Number of characters environment thinks are in a line is 90 (COLUMNS). 5 Number of lines gdb thinks are in a page is 40. 6 Number of lines readline reports are in a page is 40. 7 Number of lines curses thinks are in a page is 40. 8 Number of lines environment thinks are in a page is 40 (LINES). 9 Readline wrapping mode: readline (terminal is not auto wrap capable, last column 10 . 11 (gdb) tui disable 12 (gdb) tui disable 13 (gdb) maint info screen 14 15 16 17 18 19 20 21 22 23 FAIL: gdb.tui/resize-2.exp: again: curses width 80 ... The problem is that the prompt matching in Term::wait for is not strict enough. It will accept a line: ... (gdb) foo ... as long as the cursor is pointing just after the prompt, like so: ... (gdb) foo ^ ... Fix this by also checking that the line is empty. Tested on x86_64-linux.
2025-08-14[gdb/testsuite] Stop on main in gdb.gdb/{python-helper,selftest}.expTom de Vries3-16/+34
With a gdb build with gcc 15.1.1 and "-O2 -flto=auto -g", I run into: ... UNTESTED: gdb.gdb/selftest.exp: \ Cannot set breakpoint at captured_main, skipping testcase. UNTESTED: gdb.gdb/python-helper.exp: \ Cannot set breakpoint at captured_main, skipping testcase. ... I don't know why we're trying to stop in captured_main. Stopping in main also works, and main is more likely to be present in an lto build. Fix this by using main instead. This requires us to update the expected file name from main.c to gdb.c in selftest_setup. After doing so, we get: ... XFAIL: gdb.gdb/selftest.exp: \ run until breakpoint at main (line numbers scrambled?) XFAIL: gdb.gdb/python-helper.exp: \ run until breakpoint at main (line numbers scrambled?) ... because main is reported to be in run-on-main-thread.c instead of gdb.c: . Breakpoint 1, main (...) at gdb/run-on-main-thread.c:120^M ... This is due to picking the last line entry for pc == 0x455e40 that has is_stmt == true: ... File name Line number Starting address View Stmt gdb/gdb.c: gdb.c 25 0x455e40 x gdb.c 30 0x455e40 1 x gdb/run-on-main-thread.c: run-on-main-thread.c 116 0x455e40 2 x run-on-main-thread.c 120 0x455e40 3 x gdb/gdb.c: gdb.c 25 0x455e40 4 /usr/include/c++/15/bits/std_thread.h: std_thread.h 366 0x455e4b ... While we're at it, update the corresponding gdb_test_multiple in selftest_setup using multi_line and -wrap. Tested on x86_64-linux.
2025-08-14[gdb/testsuite] Make ^C cancel i-searchTom de Vries2-3/+5
PR cli/21690 reports the following: say we start gdb: ... $ gdb -q (gdb) ... and press ^R for reverse-i-search: ... (reverse-i-search)`': ... Pressing the p key has the effect of showing both the pressed key and a matching entry, which happens to be up: ... (reverse-i-search)`p': up ... Now we press ^C to cancel the search: ... (reverse-i-search)`p': u❌️ Quit (gdb) ... and type "down". We expected to get: ... (gdb) down ... but instead we get: ... (failed reverse-i-search)`pdown': ... So we're stuck in reverse-i-search, until we use the workaround of ^G. The same problem happened with python [1], was reported upstream [2], and fixed in cpython commit d6990d221b0 ("Issue #24266: Cancel history search mode with Ctrl+C in Readline 7") using rl_callback_sigcleanup. Fix this likewise in quit using rl_callback_sigcleanup, a new callback function in readline 7.0: ... i. rl_callback_sigcleanup: a new application function that can clean up and unset any state set by readline's callback mode. Intended to be used after a signal. ... giving us instead: ... $ gdb (gdb) u❌️ Quit (gdb) down ... Remove the corresponding kfail in gdb.tui/pr30056.exp. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=21690 [1] https://bugs.python.org/issue24266 [2] https://lists.gnu.org/archive/html/bug-readline/2015-05/msg00014.html
2025-08-14RISC-V: PR33216, Allow c.slli, c.srai, c.srli with 0 immediate as a hintNelson Chu4-45/+20
The original patch, e6f372ba661bb0d8eec1e22a6dc1ad9937336e4d Since recently c.slli64, c.srai64, and c.srli64 have been removed from the riscv-isa-manual, c.slli, c.srli, and c.srai with 0 immediate are now listed as hints, https://github.com/riscv/riscv-isa-manual/pull/1942 and https://github.com/riscv/riscv-isa-manual/pull/2093 So allow c.slli, c.srli, and c.srai with 0 immediate as a hint. Also allow to assemble slli, srli and srai with 0 immediate to hint c.slli, c.srli and c.srai when rvc is enabled. The c.slli64, c.srai64, and c.srli64 should be kept as aliases, so dis-assembler should disassemble to c.slli, c.srli, and c.srai with 0 immediate. Passed rv32/64-elf/linux binutils testcases. gas/ PR 33216 * testsuite/gas/riscv/c-zero-imm.d: Updated since allow c.slli64, c.srai64, and c.srli64 with 0 immediate as a hint. * testsuite/gas/riscv/c-zero-imm.s: Likewise. * testsuite/gas/riscv/zca.d: Likewise. opcodes/ PR 33216 * riscv-opc.c (riscv_opcodes): Updated since allow c.slli64, c.srai64, and c.srli64 with 0 immediate as a hint.
2025-08-14Automatic date update in version.inGDB Administrator1-1/+1
2025-08-13Refine range check in create_addrmap_from_gdb_indexTom Tromey1-1/+1
PR symtab/33247 points out that this check in create_addrmap_from_gdb_index: if (lo > hi) { complaint (_(".gdb_index address table has invalid range (%s - %s)"), hex_string (lo), hex_string (hi)); ... should probably use ">=" instead. Reading a bit further the reason seems obvious: mutable_map.set_empty (lo, hi - 1, index->units[cu_index]); Here if lo==hi, then this will insert a "reversed" range into the addrmap. Apparently some LLVM tool can erroneously create a .gdb_index like this. No test because it seems like more trouble to write than it's worth. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33247 Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-08-13Remove cast from captured_mainTom Tromey1-3/+1
captured_main takes a 'void *', but then immediately casts it to the correct type. There's no reason for this any more, the caller passes in the correct type. This patch cleans this up. Tested by rebuilding.
2025-08-12gnulib: Update obsolete autoconf macrosPietro Monteiro3-53/+19
Remove AM_PROG_CC_STDC, the correct macro AC_PROG_CC is already being used. Update AC_OUTPUT (file list, [cmd list]) by adding the file list to the previous AC_CONFIG_FILES and using AC_CONFIG_COMMANDS to output the command list. Approved-By: Tom Tromey <tom@tromey.com>
2025-08-13Automatic date update in version.inGDB Administrator1-1/+1
2025-08-12[gdb/tui] Make tui_disassemble more efficientTom de Vries1-15/+19
Function tui_disassemble (with addr_size parameter) has two modes of operation: - addr_size != nullptr, and - addr_size == nullptr. I noticed that for the addr_size == nullptr case, more than necessary is done. Fix this by using continue and null_stream. While we're at it, eliminate the unnecessary variables new_size and orig_pc. Tested on x86_64-linux. Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-08-12[gdb/tdep] Handle M1 ldp in aarch64_stopped_data_addressTom de Vries2-4/+10
In test-case gdb.base/watchpoint-unaligned.exp, in function write_size8twice, two adjacent 8-byte vars are written. For aarch64, we use a single stp instruction for that. If we do the same in function read_size8twice for two adjacent 8-byte var reads using aarch64 insn ldp, on an aarch64-linux M1 system we get a hang: ... (gdb) continue^M Continuing.^M FAIL: $exp: fun=read_size8twice: offset=0: index=1: continue (timeout) FAIL: $exp: fun=read_size8twice: offset=0: index=1: $got_hit ... The same problem was observed for stp in PR tdep/29423, fixed by commit 9a03f218534 ("[gdb/tdep] Fix gdb.base/watchpoint-unaligned.exp on aarch64"). See that commit for an explanation of the hang. That commit introduced max_access_size in aarch64_stopped_data_address: ... The access size also can be larger than that of the watchpoint itself. For instance, the access size of an stp instruction is 16. So, if we use stp to store to address p, and set a watchpoint on address p + 8, the reported ADDR_TRAP can be p + 8 (observed on RK3399 SOC). But it also can be p (observed on M1 SOC). Checking for this situation introduces the possibility of false positives, so we only do this for hw_write watchpoints. */ const CORE_ADDR max_access_size = type == hw_write ? 16 : 8; ... If we say that hangs are worse than false positives, then we should also fix this case. Fix this by setting max_access_size to 16 for all watchpoint types. Tested on aarch64-linux, both on an M1 SOC and an RK3399 SOC. Approved-By: Luis Machado <luis.machado.foss@gmail.com>
2025-08-12[gdb/testsuite] Extend gdb.base/watchpoint-unaligned.expTom de Vries2-10/+40
Extend the part of gdb.base/watchpoint-unaligned.exp handling write_size8twice to also check read hardware watchpoints. Tested on x86_64-linux. Approved-By: Luis Machado <luis.machado.foss@gmail.com>
2025-08-12[gdb/testsuite] Improve gdb.base/watchpoint-unaligned.expTom de Vries2-41/+69
Improve the part of gdb.base/watchpoint-unaligned.exp handling write_size8twice: - move the code into a proc - use -wrap - use $decimal more often - don't use gdb_test_multiple $test $test - add comments - start test when entering write_size8twice function, instead of main - finish test when leaving write_size8twice function, instead of main - add insn in between: - insn triggering watchpoint, and - insn triggering breakpoint to ensure that the watchpoint triggers before the breakpoint, and add a comment explaining this. Tested on x86_64-linux.
2025-08-12Change type::fields to return an array_viewTom Tromey14-139/+115
This patch changes type::fields to return an array_view of the fields, then fixes up the fallout. More cleanups would be possible here (in particular in the field initialization code) but I haven't done so. The main motivation for this patch was to make it simpler to iterate over the fields of a type. Regression tested on x86-64 Fedora 41. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-08-12x86: Always treat protected symbols as localH.J. Lu15-18/+87
Since linker never generates dynamic relocation for protected symbol in: __attribute__((visibility("protected"))) int my_data; int * func (void) { return &my_data; } we should always treat protected symbols as local. bfd/ PR ld/33260 * elfxx-x86.h (COPY_INPUT_RELOC_P): Always treat protected symbols as local. ld/ PR ld/33260 * testsuite/ld-i386/i386-export-class.rd: Updated. * testsuite/ld-i386/i386-export-class.xd: Likewise. * testsuite/ld-i386/i386.exp: Run pr33260-2. * testsuite/ld-i386/pr33260-2.d: New file. * testsuite/ld-i386/pr33260-2.s: Likewise. * testsuite/ld-i386/pr33260.d: Remove "-z indirect-extern-access". * testsuite/ld-x86-64/pr33260-x32.d: Likewise. * testsuite/ld-x86-64/pr33260.d: Likewise. * testsuite/ld-x86-64/pr33260-2-x32.d: New file. * testsuite/ld-x86-64/pr33260-2.d: Likewise. * testsuite/ld-x86-64/pr33260-2.s: Likewise. * testsuite/ld-x86-64/x86-64-64-export-class.rd: Updated. * testsuite/ld-x86-64/x86-64-x32-export-class.rd: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr33260-2 and pr33260-2-x32. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-12Avoid scopes.exp failure on certain architecturesTom Tromey1-2/+9
A buildbot pointed out that my changes to gdb.dap/scopes.exp caused a test failure. The new code iterates over all the registers, fetching their children (when possible). The failure comes because this code failed to consider that a register might have "indexed" children, which I believe can occur when a register is vector-like. This patch fixes the problem by arranging to fetch indexed children when indicated.
2025-08-12Automatic date update in version.inGDB Administrator1-1/+1
2025-08-11i386: Add Linux/x86-64 support to export-class.expH.J. Lu1-6/+9
Add Linux/x86-64 support to export-class.exp by passing --32 to assembler and passing -melf_i386 to linker. * testsuite/ld-i386/export-class.exp: Run for Linux/x86-64. Pass --32 to assembler. Pass -melf_i386 to linker. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-11ld: Add a test for PR ld/24576H.J. Lu2-0/+4
PR ld/24576 * testsuite/ld-scripts/pr24576-1.d: New. * testsuite/ld-scripts/script.exp: Run pr24576-1. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-11Emit DAPException when too many variable children are reqeustedTom Tromey2-0/+11
PR dap/33228 points out a failure that occurs when the DAP client requests more children of a variable than actually exist. Currently, gdb throws a somewhat confusing exception. This patch changes this code to throw a DAPException instead, resulting in a more ordinary and readable failure. The spec seems to be silent on what to do in this case. I chose an exception on the theory that it's easier to be strict now and lift the restriction later (if needed) than vice versa. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33228
2025-08-11Do not allow DAP clients to dereference "void *"Tom Tromey3-10/+36
While investigating a different bug, I noticed that the DAP code would report a "void *"-typed register as having children -- however, requesting the children of this register would fail. The issue here is that a plain "void *" can't be dereferenced. This patch changes the default visualizer to treat a "void *" as a scalar. This adds a new test; but also arranges to examine all the returned registers -- this was the first thing I attempted and it seemed reasonable to have a test that double-checks that all the registers really can be dereferenced as appropriate. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33228
2025-08-11Automatic date update in version.inGDB Administrator1-1/+1
2025-08-10Automatic date update in version.inGDB Administrator1-1/+1
2025-08-09x86: Treat protected symbols with indirect external access as localH.J. Lu8-2/+122
If all external symbol accesses are indirect, we can treat protected symbols as local since there will be no copy relocation for data and external function pointer access will go through GOT, instead of PLT. No PLT slot should be used for external function pointer in executable. bfd/ PR ld/33260 * elfxx-x86.h (COPY_INPUT_RELOC_P): Treat protected symbols with indirect external access as local. ld/ PR ld/33260 * testsuite/ld-i386/i386.exp: Run PR ld/33260 test. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr33260.d: New file. * testsuite/ld-i386/pr33260.s: Likewise. * testsuite/ld-x86-64/pr33260-x32.d: Likewise. * testsuite/ld-x86-64/pr33260.d: Likewise. * testsuite/ld-x86-64/pr33260.s: Likewise. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-09Automatic date update in version.inGDB Administrator1-1/+1
2025-08-08binutils: add ia64 marker in name of testranges-ia64Sam James1-1/+1
Otherwise, the same test appears twice, once with PASS, once with UNSUPPORTED on non-ia64. Just add '(ia64)' to the name so binutils.log is clearer. * testsuite/binutils-all/testranges-ia64.d (#name): Add suffix.
2025-08-08run_lto_binutils_test: Pass $plug_opt to nmH.J. Lu1-1/+1
Pass $plug_opt to nm when setting dump_prog to nm to load plugin. PR binutils/21479 * testsuite/ld-plugin/lto-binutils.exp (run_lto_binutils_test): Pass $plug_opt to nm. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-08should_validate_memtags: Do not dereference referencesKeith Seitz3-1/+115
should_validate_memtags uses value_as_address to evalute whether an address for a value is tagged. The comments for that function simply say, "Extract a value as a C pointer." While that sounds innoncuous, that function calls coerce_array, which will dereference any references. This is not what is desired here. This can be demonstrated on an MTE-enabled host, such as aarch64- based Ampere (example taken from tests introduced in this patch): (gdb) p b.get_foo () Could not validate memory tag: Value can't be converted to integer. $2 = (const foo &) @0xffffffffed88: {m_a = 42} While the command completes, gdb didn't actually attempt to evaluate any memory tags. Fix this by using unpack_pointer instead. Tested on x86_64 Fedora 40 and aarch64 RHEL 9.6.
2025-08-08[gdb/testsuite] Fix gdb.tui/basic.exp for TERM=ansisTom de Vries1-1/+5
With test-case gdb.tui/basic.exp and TERM=ansis, I run into (with some logging added): ... status line: '<reverse:1><intensity:dim>exec No process (asm) In: L?? PC: ?? <reverse:0><intensity:normal>' FAIL: gdb.tui/basic.exp: status window: reverse ... The status window uses ncurses attribute standout, which can differ between different terminal settings. Fix this by making the matching less strict. Tested on x86_64-linux.
2025-08-08[gdb/testsuite] Fix gdb.tui/main-2.exp for TERM=ansisTom de Vries1-2/+2
When running test-case gdb.tui/main-2.exp with TERM=ansis, I get: ... screen line 6: 'B+><fg:black><intensity:bold> 21 <reverse:1><fg:default><intensity:normal> return 0;<reverse:0> ' FAIL: gdb.tui/main-2.exp: highlighted line in middle of source window ... The test tries to check the highlighting of the source line, but also gets the part with the line number, which makes it more complicated to parse. Fix this by getting just the part with the source line: ... screen line 6: '<reverse:1> return 0;<reverse:0> \ ' ... Tested on x86_64-linux.
2025-08-08[gdb/testsuite] Initial TERM=ansis support in tuitermTom de Vries1-1/+11
While investigating using TERM=ansiw for freebsd, I also came across TERM=ansis which unlike ansiw is present on both linux and freebsd. Add initial support for TERM=ansi in tuiterm: - handle ansis in Term::_have_bw - add Term::_csi_x to support (well, ignore) DECREQTPARM (Request Terminal Parameters) This is sufficient to make the TUI testsuite pass on x86_64-freebsd.
2025-08-08[gdb/testsuite] Fix gdb.tui/tui-layout-asm-short-prog.S compilationTom de Vries1-3/+7
The test-case gdb.tui/tui-layout-asm-short-prog.exp uses an assembly file gdb.tui/tui-layout-asm-short-prog.S that it compiles using -nostdlib and -nostartfiles. However, on x86_64-linux the resulting executable still has dependencies on libm and libc: ... $ ldd outputs/gdb.tui/tui-layout-asm-short-prog/tui-layout-asm-short-prog linux-vdso.so.1 (0x00007ffddf3ec000) libm.so.6 => /lib64/libm.so.6 (0x00007f8b13406000) libc.so.6 => /lib64/libc.so.6 (0x00007f8b13000000) /lib64/ld-linux-x86-64.so.2 (0x00007f8b1350f000) ... due -lm being added by default_target_compile. On x86_64-freebsd, using -nostdlib and -nostartfiles in combination with -lm causes the compilation to fail. Fix this by using -static as well. Tested on x86_64-linux and x86_64-freebsd.
2025-08-08[gdb/testsuite] Fix gdb.base/exprs.exp for gdb build with byaccTom de Vries1-1/+4
On x86_64-freebsd, with test-case gdb.base/exprs.exp I get: ... (gdb) print 23 yydebug: state 0, reading 257 (INT) yydebug: state 0, shifting to state 1 yydebug: state 1, reducing by rule 94 (exp : INT) yydebug: after reduction, shifting from state 0 to state 59 yydebug: state 59, reading 0 (end-of-file) yydebug: state 59, reducing by rule 7 (exp1 : exp) yydebug: after reduction, shifting from state 0 to state 60 yydebug: state 60, reducing by rule 1 (start : exp1) yydebug: after reduction, shifting from state 0 to state 58 $220 = 23 (gdb) FAIL: gdb.base/exprs.exp: print with debugging ... The test fails because it's not finding the string "Starting parse". In this case, the .y files are processed used byacc. I suppose the testcase matches the case that bison is used. Fix this by grepping for something more generic: shift or Shift. Tested on x86_64-linux and x86_64-freebsd.
2025-08-08bfd/ELF/Arm: make various arrays static / constJan Beulich1-17/+18
There's no reason to have the compiler materialize objects onto the stack. And there's also no reason to allow comb[] and name_table[] to be modifiable.
2025-08-08bfd/ELF/RISC-V: make one local array static and several constJan Beulich1-13/+13
There's no reason for riscv_all_supported_ext[] to appear in libbfd.so's dynamic symbol table. There's also no reason for various pieces of data to live in .data, when .data.rel.ro or even .rodata can do.
2025-08-08bfd/ELF: make three local arrays staticJan Beulich3-5/+5
... and const. There's no reason to have the compiler copy anonymous objects onto the stack. And there's also no reason to allow the arrays to be modifiable.
2025-08-08Arm: parse_neon_type() weaknessesJan Beulich4-5/+54
The custom parsing done there and in one of its callers allowed various bogus constructs to be accepted. Insist on a non-zero leading digit when parsing numbers, don't lose upper bits, and insist on proper separation of operands.
2025-08-08opcodes/aarch64: shrink aarch64_ext_ldst_reglist()'s data[]Jan Beulich1-14/+14
The values are all pretty small; one is even a boolean. No point in wasting 32 bits for every one of the fields.
2025-08-08opcodes/aarch64: rename fields[]Jan Beulich4-16/+13
To be a fair global name space citizen, give it an aarch64_ prefix. In two cases, drop a variable that's used only once.
2025-08-08[gdb/testsuite] Add gdb.base/color-prompt.expTom de Vries4-6/+138
After updating the documentation in commit cf03713dd1c ("[gdb/cli] Document \001 and \002 usage for set prompt"), I started to wonder if I could reproduce the CLI issue described in PR cli/28887 using the TUI. That turned out not to be the case, but I noticed handling of the markers in tui_puts and tui_puts_internal, and no test-case exercising this, so I decided to add this. After doing so in gdb.tui/color-prompt.exp, I realized I could use the same code to test the CLI case. Add test-case gdb.base/color-prompt.exp that shares code with gdb.tui/color-prompt.exp in gdb.tui/color-prompt.exp.tcl. For the CLI case, I was hoping to reproduce the behaviour described in the PR, but it didn't trigger. FTR, I manually reproduced the behaviour and used script to record it. I observed the following sequence after the C-a: - ^M (CR) : go to start of line - ^[[K (EL) : erase line - ^M (CR) : go to start of line - ^[[31m(gdb) ^[[0m : output prompt - some long command : output text - ^M (CR) : go to start of line - ^[[C, 15 times (CUF): cursor forward 15 times giving me: ... (gdb) some long command ^ ... Perhaps we'll trigger this on some other os, or once we start using a different TERM value. Tested on x86_64-linux.
2025-08-08[gdb/tdep] Fix inferior call return of small char array for ppc64 v1 abiTom de Vries5-2/+107
In ppc64_sysv_abi_return_value I came across this if clause: ... /* Small character arrays are returned, right justified, in r3. */ if (valtype->code () == TYPE_CODE_ARRAY && !valtype->is_vector () && valtype->length () <= 8 && valtype->target_type ()->code () == TYPE_CODE_INT && valtype->target_type ()->length () == 1) ... I decided to write a test-case to try and trigger this. AFAIU, in C/C++, we're not allowed to return an array, so I wrote an Ada test-case instead, with a function returning this type: ... type T is new String (1 .. 4); ... After doing so I realized that the clause above is not triggering because valtype->target_type ()->code () == TYPE_CODE_CHAR. Fix this by allowing both TYPE_CODE_INT and TYPE_CODE_CHAR. Then I realized that the specific "small character array" handling comes from the v1 abi. Add a check for this as well. Tested on ppc64le-linux, with v2 abi. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-08-08Automatic date update in version.inGDB Administrator1-1/+1
2025-08-07ldlang.c: Don't include "elf-bfd.h" twiceH.J. Lu1-4/+0
* ldlang.c: Don't include "elf-bfd.h" twice. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-08-07Move struct plugin_data_struct to plugin.cAlan Modra10-22/+19
It isn't needed anywhere except plugin.c. The typedef can disappear. Also make a forward declaraion for ld_plugin_input_file in plugin.h so that this header can be used without first including plugin-api.h. bfd/ * plugin.h (struct ld_plugin_input_file): Forward declare. (struct plugin_data_struct): Move to.. * plugin.c: ..here. (add_symbols): Size plugin_data without using type. * archive.c: Don't include plugin-api.h. * elflink.c: Likewise. * format.c: Likewise. binutils/ * ar.c: Don't include plugin-api.h or ansidecl.h. Only include plugin.h when BFD_SUPPORTS_PLUGINS. * nm.c: Don't include plugin-api.h. Only include plugin.h when BFD_SUPPORTS_PLUGINS. * objcopy.c: Likewise. ld/ * ldfile.c: Don't include plugin-api.h. * ldmain.c: Likewise.
2025-08-07Update obsolete autoconf macrosPietro Monteiro6-38/+38
bfd/ * bfd.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. binutils/ * configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. gas/ * acinclude.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE. Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE. gprof/ * configure.ac: Replace AC_OUTPUT(file list) with AC_CONFIG_FILES([file list])\nAC_OUTPUT. libctf/ * configure.ac: Replace AC_TRY_LINK with AC_LINK_IFELSE. opcodes/ * configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
2025-08-07gdb: change default initialization for register numbers on x86Christina Schimpe2-69/+44
As defined by the enums amd64_regnum and i386_regnum the register numbering starts at 0. Defaults for register numbers are currently set to 0 which seems to be the wrong default. Set them to -1 instead. Configure the right register number if we find out it's supported in i386_gdbarch_init. Similarly we don't have to set the num_*regname* variables to 0 in i386_gdbarch_init, as it's already assigned to 0 by default. Approved-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Simon Marchi <simon.marchi@efficios.com>